- attempt to make TOM happy, clickl madly while game is loading and help lame windows not choke
This commit is contained in:
parent
eeda623b4f
commit
b2f91e0f32
|
@ -26,7 +26,7 @@ using namespace Shared::Platform;
|
|||
namespace Glest{ namespace Game{
|
||||
|
||||
const string mailString= "contact_game@glest.org";
|
||||
const string glestVersionString= "v3.3.5-beta7.1";
|
||||
const string glestVersionString= "v3.3.5-beta7.2";
|
||||
|
||||
string getCrashDumpFileName(){
|
||||
return "glest" + glestVersionString + ".dmp";
|
||||
|
|
|
@ -48,6 +48,7 @@ Game::Game(Program *program, const GameSettings *gameSettings):
|
|||
{
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
sdlEventsThread = NULL;
|
||||
originalDisplayMsgCallback = NULL;
|
||||
thisGamePtr = this;
|
||||
|
||||
|
@ -79,6 +80,10 @@ Game::Game(Program *program, const GameSettings *gameSettings):
|
|||
Game::~Game(){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
BaseThread::shutdownAndWait(sdlEventsThread);
|
||||
delete sdlEventsThread;
|
||||
sdlEventsThread = NULL;
|
||||
|
||||
Logger &logger= Logger::getInstance();
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
|
||||
|
@ -125,6 +130,9 @@ void Game::load(){
|
|||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] gameSettings = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->gameSettings.toString().c_str());
|
||||
|
||||
sdlEventsThread = new PumpSDLEventsTaskThread();
|
||||
sdlEventsThread->start();
|
||||
|
||||
Logger &logger= Logger::getInstance();
|
||||
string mapName= gameSettings.getMap();
|
||||
string tilesetName= gameSettings.getTileset();
|
||||
|
@ -434,6 +442,10 @@ void Game::init()
|
|||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n\n\n=-=-=-=-=-=-=-=-=-=-= STARTING GAME =-=-=-=-=-=-=-=-=-=-=\n\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
BaseThread::shutdownAndWait(sdlEventsThread);
|
||||
delete sdlEventsThread;
|
||||
sdlEventsThread = NULL;
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "chat_manager.h"
|
||||
#include "script_manager.h"
|
||||
#include "game_settings.h"
|
||||
//#include "simple_threads.h"
|
||||
#include "simple_threads.h"
|
||||
#include "network_interface.h"
|
||||
|
||||
using std::vector;
|
||||
|
@ -84,6 +84,8 @@ private:
|
|||
time_t lastRenderLog2d;
|
||||
DisplayMessageFunction originalDisplayMsgCallback;
|
||||
|
||||
PumpSDLEventsTaskThread *sdlEventsThread;
|
||||
|
||||
public:
|
||||
Game(Program *program, const GameSettings *gameSettings);
|
||||
~Game();
|
||||
|
|
|
@ -42,8 +42,8 @@ namespace Glest { namespace Game{
|
|||
bool MeshCallbackTeamColor::noTeamColors = false;
|
||||
|
||||
// if FPS is less than this we start to skip 3D renders
|
||||
//int MIN_RENDER_FPS_ALLOWED = 10;
|
||||
int MIN_RENDER_FPS_ALLOWED = -1;
|
||||
int MIN_RENDER_FPS_ALLOWED = 10;
|
||||
//int MIN_RENDER_FPS_ALLOWED = -1;
|
||||
int MIN_RENDER_LAG_ALLOWED = 1;
|
||||
int MAX_RENDER_LAG_ITEMCOUNT_ALLOWED = 200;
|
||||
|
||||
|
|
|
@ -71,6 +71,13 @@ public:
|
|||
bool getTaskSignalled();
|
||||
};
|
||||
|
||||
class PumpSDLEventsTaskThread : public BaseThread
|
||||
{
|
||||
public:
|
||||
PumpSDLEventsTaskThread();
|
||||
virtual void execute();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
||||
|
|
|
@ -35,7 +35,8 @@ private:
|
|||
SDL_Thread* thread;
|
||||
|
||||
public:
|
||||
virtual ~Thread() {}
|
||||
Thread();
|
||||
virtual ~Thread();
|
||||
|
||||
void start();
|
||||
virtual void execute()=0;
|
||||
|
|
|
@ -155,4 +155,38 @@ bool SimpleTaskThread::getTaskSignalled() {
|
|||
return retval;
|
||||
}
|
||||
|
||||
PumpSDLEventsTaskThread::PumpSDLEventsTaskThread() : BaseThread() {
|
||||
}
|
||||
|
||||
void PumpSDLEventsTaskThread::execute() {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
setRunningStatus(true);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"SDL_PumpEvents thread is running\n");
|
||||
|
||||
try {
|
||||
unsigned int idx = 0;
|
||||
for(;getQuitStatus() == false;) {
|
||||
SDL_PumpEvents();
|
||||
sleep(100);
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
setRunningStatus(false);
|
||||
}
|
||||
catch(...) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unknown error\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
setRunningStatus(false);
|
||||
}
|
||||
|
||||
setRunningStatus(false);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"SDL_PumpEvents thread is exiting\n");
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
}}//end namespace
|
||||
|
|
|
@ -19,6 +19,15 @@ namespace Shared{ namespace Platform{
|
|||
// =====================================
|
||||
// Threads
|
||||
// =====================================
|
||||
Thread::Thread() {
|
||||
thread = NULL;
|
||||
}
|
||||
|
||||
Thread::~Thread() {
|
||||
if(thread != NULL) {
|
||||
SDL_WaitThread(thread, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void Thread::start() {
|
||||
thread = SDL_CreateThread(beginExecution, this);
|
||||
|
|
Loading…
Reference in New Issue
Block a user