Rearranged the logic

This commit is contained in:
Kayne Ruse
2013-08-24 23:20:43 +10:00
parent 0a0b61287e
commit 7458962ad4
12 changed files with 234 additions and 121 deletions
+30
View File
@@ -0,0 +1,30 @@
#include "base_room.hpp"
#include "SDL/SDL_thread.h"
#include <iostream>
BaseRoom::BaseRoom(std::map<std::string, std::string> args):
arguments(args)
{
//
}
int roomThread(void* ptr) {
#ifdef DEBUG
std::cout << "Opening room" << std::endl;
#endif
try {
reinterpret_cast<BaseRoom*>(ptr)->Init();
reinterpret_cast<BaseRoom*>(ptr)->Loop();
reinterpret_cast<BaseRoom*>(ptr)->Quit();
}
catch(std::exception& e) {
std::cerr << "Fatal room error: " << e.what() << std::endl;
return 1;
}
#ifdef DEBUG
std::cout << "Closing room" << std::endl;
#endif
return 0;
}