Fix error when exiting in win32

This commit is contained in:
Eduardo Bart 2012-06-20 02:41:00 -03:00
parent 8761220deb
commit eb457bf9cd
5 changed files with 10 additions and 12 deletions

View File

@ -61,7 +61,7 @@ Application::Application()
m_foregroundFrameCounter.setMaxFps(60); m_foregroundFrameCounter.setMaxFps(60);
} }
void Application::init(const std::vector<std::string>& args) void Application::init(const std::string& compactName, const std::vector<std::string>& args)
{ {
// capture exit signals // capture exit signals
signal(SIGTERM, exitSignalHandler); signal(SIGTERM, exitSignalHandler);
@ -71,6 +71,8 @@ void Application::init(const std::vector<std::string>& args)
installCrashHandler(); installCrashHandler();
#endif #endif
m_appCompactName = compactName;
std::string startupOptions; std::string startupOptions;
for(uint i=1;i<args.size();++i) { for(uint i=1;i<args.size();++i) {
const std::string& arg = args[i]; const std::string& arg = args[i];

View File

@ -36,7 +36,7 @@ class Application
public: public:
Application(); Application();
void init(const std::vector<std::string>& args); void init(const std::string& compactName, const std::vector<std::string>& args);
void deinit(); void deinit();
void terminate(); void terminate();
void run(); void run();

View File

@ -230,7 +230,7 @@ void WIN32Window::terminate()
} }
if(m_instance) { if(m_instance) {
if(!UnregisterClassA(g_app.getName().c_str(), m_instance)) if(!UnregisterClassA(g_app.getCompactName().c_str(), m_instance))
g_logger.error("UnregisterClassA failed"); g_logger.error("UnregisterClassA failed");
m_instance = NULL; m_instance = NULL;
} }
@ -256,7 +256,7 @@ void WIN32Window::internalCreateWindow()
wc.hCursor = m_defaultCursor; wc.hCursor = m_defaultCursor;
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL; wc.lpszMenuName = NULL;
wc.lpszClassName = g_app.getName().c_str(); wc.lpszClassName = g_app.getCompactName().c_str();
if(!RegisterClassA(&wc)) if(!RegisterClassA(&wc))
g_logger.fatal("Failed to register the window class."); g_logger.fatal("Failed to register the window class.");
@ -272,7 +272,7 @@ void WIN32Window::internalCreateWindow()
updateUnmaximizedCoords(); updateUnmaximizedCoords();
m_window = CreateWindowExA(dwExStyle, m_window = CreateWindowExA(dwExStyle,
g_app.getName().c_str(), g_app.getCompactName().c_str(),
NULL, NULL,
dwStyle, dwStyle,
windowRect.left, windowRect.left,

View File

@ -30,11 +30,11 @@ int main(int argc, const char* argv[])
std::vector<std::string> args(argv, argv + argc); std::vector<std::string> args(argv, argv + argc);
// initialize application framework and otclient // initialize application framework and otclient
g_app.init(args); g_app.init("otclient", args);
g_otclient.init(args); g_otclient.init(args);
// find script init.lua and run it // find script init.lua and run it
g_resources.discoverWorkDir("otclient", "init.lua"); g_resources.discoverWorkDir(g_app.getCompactName(), "init.lua");
if(!g_lua.safeRunScript(g_resources.getWorkDir() + "init.lua")) if(!g_lua.safeRunScript(g_resources.getWorkDir() + "init.lua"))
g_logger.fatal("Unable to run script init.lua!"); g_logger.fatal("Unable to run script init.lua!");

View File

@ -117,11 +117,7 @@ protected:
public: public:
// login related // login related
void loginWorld(const std::string& account, void loginWorld(const std::string& account, const std::string& password, const std::string& worldName, const std::string& worldHost, int worldPort, const std::string& characterName);
const std::string& password,
const std::string& worldName,
const std::string& worldHost, int worldPort,
const std::string& characterName);
void cancelLogin(); void cancelLogin();
void forceLogout(); void forceLogout();
void safeLogout(); void safeLogout();