mirror of
https://github.com/glest/glest-source.git
synced 2025-09-01 20:12:40 +02:00
- added more debug statements to try to track beta bugs
- added safer customization of ini files - added ability to customize game keys - added more error checking for ogg file loading - added faction loader progress - added a few more thread protections on custom menu
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace Shared{ namespace Util{
|
||||
namespace Shared { namespace Util {
|
||||
|
||||
bool strToBool(const string &s);
|
||||
int strToInt(const string &s);
|
||||
@@ -32,6 +32,8 @@ string intToHex(int i);
|
||||
string floatToStr(float f,int precsion=2);
|
||||
string doubleToStr(double f,int precsion=2);
|
||||
|
||||
bool IsNumeric(const char *p, bool allowNegative=true);
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
||||
|
@@ -93,11 +93,11 @@ void BaseThread::shutdownAndWait(BaseThread *pThread) {
|
||||
if(pThread != NULL && pThread->getRunningStatus() == true) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
pThread->signalQuit();
|
||||
for( time_t elapsed = time(NULL); difftime(time(NULL),elapsed) <= 10; ) {
|
||||
for( time_t elapsed = time(NULL); difftime(time(NULL),elapsed) <= 7; ) {
|
||||
if(pThread->getRunningStatus() == false) {
|
||||
break;
|
||||
}
|
||||
sleep(10);
|
||||
sleep(0);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
@@ -108,6 +108,7 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||
|
||||
XFontStruct* fontInfo = XLoadQueryFont(display, type.c_str());
|
||||
if(!fontInfo) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] CANNOT load font %s, falling back to default\n",__FILE__,__FUNCTION__,__LINE__,type.c_str());
|
||||
fontInfo = XLoadQueryFont(display, "fixed");
|
||||
if(!fontInfo) {
|
||||
throw std::runtime_error("Font not found: " + type);
|
||||
|
@@ -543,6 +543,8 @@ char Window::getKey(SDL_keysym keysym) {
|
||||
return '8';
|
||||
case SDLK_9:
|
||||
return '9';
|
||||
case SDLK_QUESTION:
|
||||
return '?';
|
||||
case SDLK_a:
|
||||
return 'A';
|
||||
case SDLK_b:
|
||||
|
@@ -15,10 +15,12 @@
|
||||
#include <vorbis/vorbisfile.h>
|
||||
|
||||
#include "sound.h"
|
||||
#include "util.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
using namespace Shared::Platform;
|
||||
using namespace std;
|
||||
using namespace Shared::Util;
|
||||
|
||||
namespace Shared{ namespace Sound{
|
||||
|
||||
@@ -146,14 +148,31 @@ void OggSoundFileLoader::open(const string &path, SoundInfo *soundInfo){
|
||||
}
|
||||
|
||||
vf= new OggVorbis_File();
|
||||
if(vf==NULL) {
|
||||
throw runtime_error("Can't create ogg object for file: "+path);
|
||||
}
|
||||
|
||||
ov_open(f, vf, NULL, 0);
|
||||
|
||||
vorbis_info *vi= ov_info(vf, -1);
|
||||
if(vi==NULL) {
|
||||
throw runtime_error("Can't read ogg header info for file: "+path);
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s] vi->version = %d, vi->channels = %d, vi->rate = %d, vi->bitrate_upper = %d, vi->bitrate_nominal = %d, vi->bitrate_lower = %d, vi->bitrate_window = %d\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),vi->version,vi->channels,vi->rate,vi->bitrate_upper,vi->bitrate_nominal,vi->bitrate_lower,vi->bitrate_window);
|
||||
|
||||
soundInfo->setChannels(vi->channels);
|
||||
soundInfo->setsamplesPerSecond(vi->rate);
|
||||
soundInfo->setBitsPerSample(16);
|
||||
soundInfo->setSize(static_cast<uint32>(ov_pcm_total(vf, -1))*2);
|
||||
|
||||
uint32 samples = static_cast<uint32>(ov_pcm_total(vf, -1));
|
||||
|
||||
//if(vi->channels == 1) {
|
||||
soundInfo->setSize(samples * 2);
|
||||
//}
|
||||
//else {
|
||||
// soundInfo->setSize(samples * 4);
|
||||
//}
|
||||
}
|
||||
|
||||
uint32 OggSoundFileLoader::read(int8 *samples, uint32 size){
|
||||
|
@@ -128,5 +128,18 @@ string doubleToStr(double d,int precsion){
|
||||
return str;
|
||||
}
|
||||
|
||||
bool IsNumeric(const char *p, bool allowNegative)
|
||||
{
|
||||
int index = 0;
|
||||
for ( ; *p; p++) {
|
||||
if (*p < '0' || *p > '9') {
|
||||
if(allowNegative == false || (*p != '-' && index == 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}}//end namespace
|
||||
|
Reference in New Issue
Block a user