From b68df8336ac2e98679516771d9ac1c1c3bf5f4b1 Mon Sep 17 00:00:00 2001 From: BeniS Date: Fri, 18 Jan 2013 03:23:01 +1300 Subject: [PATCH] Minor fixes to some previous commits. * Fixed a bug with storing the protocol version. * Fixed an issue with text windows cancelling. * Fixed a typo in the source. --- modules/client/client.lua | 6 +++--- modules/game_textwindow/textwindow.lua | 8 +++++--- src/client/spritemanager.cpp | 2 +- src/framework/core/application.cpp | 4 ++-- src/framework/core/eventdispatcher.cpp | 2 +- src/framework/core/graphicalapplication.cpp | 2 +- src/framework/core/scheduledevent.h | 2 +- src/framework/luafunctions.cpp | 2 +- src/framework/net/protocol.cpp | 6 +++--- 9 files changed, 18 insertions(+), 16 deletions(-) diff --git a/modules/client/client.lua b/modules/client/client.lua index 9641b0f0..16fd2bce 100644 --- a/modules/client/client.lua +++ b/modules/client/client.lua @@ -91,8 +91,8 @@ function terminate() g_settings.set('window-pos', g_window.getUnmaximizedPos()) g_settings.set('window-maximized', g_window.isMaximized()) - local clientVersion = g_game.getProtocolVersion() - if clientVersion ~= 0 then - g_settings.set('client-version', clientVersion) + local protocolVersion = g_game.getProtocolVersion() + if protocolVersion ~= 0 then + g_settings.set('protocol-version', protocolVersion) end end diff --git a/modules/game_textwindow/textwindow.lua b/modules/game_textwindow/textwindow.lua index db252937..de04b4f2 100644 --- a/modules/game_textwindow/textwindow.lua +++ b/modules/game_textwindow/textwindow.lua @@ -85,13 +85,13 @@ function onGameEditText(id, itemId, maxLength, text, writter, time) end okButton.onClick = doneFunc - cancelButton.onClick = destroy + cancelButton.onClick = destroyWindows if not writeable then textWindow.onEnter = doneFunc end - textWindow.onEscape = destroy + textWindow.onEscape = destroyWindows table.insert(windows, textWindow) end @@ -121,8 +121,10 @@ function onGameEditList(id, doorId, text) end okButton.onClick = doneFunc + cancelButton.onClick = destroyWindows + textWindow.onEnter = doneFunc - textWindow.onEscape = destroy + textWindow.onEscape = destroyWindows table.insert(windows, textWindow) end diff --git a/src/client/spritemanager.cpp b/src/client/spritemanager.cpp index 165f66b4..b773054a 100644 --- a/src/client/spritemanager.cpp +++ b/src/client/spritemanager.cpp @@ -127,7 +127,7 @@ ImagePtr SpriteManager::getSpriteImage(int id) read += 4 + (3 * coloredPixels); } - // fill reamaning pixels with alpha + // fill remaining pixels with alpha while(writePos < SPRITE_DATA_SIZE) { pixels[writePos + 0] = 0x00; pixels[writePos + 1] = 0x00; diff --git a/src/framework/core/application.cpp b/src/framework/core/application.cpp index 2a1521ee..eb17ce96 100644 --- a/src/framework/core/application.cpp +++ b/src/framework/core/application.cpp @@ -109,10 +109,10 @@ void Application::deinit() g_modules.unloadModules(); g_modules.clear(); - // release reamaning lua object references + // release remaining lua object references g_lua.collectGarbage(); - // poll reamaning events + // poll remaining events poll(); // disable dispatcher events diff --git a/src/framework/core/eventdispatcher.cpp b/src/framework/core/eventdispatcher.cpp index b000b46b..10365003 100644 --- a/src/framework/core/eventdispatcher.cpp +++ b/src/framework/core/eventdispatcher.cpp @@ -45,7 +45,7 @@ void EventDispatcher::poll() int loops = 0; for(int count = 0, max = m_scheduledEventList.size(); count < max && !m_scheduledEventList.empty(); ++count) { ScheduledEventPtr scheduledEvent = m_scheduledEventList.top(); - if(scheduledEvent->reamaningTicks() > 0) + if(scheduledEvent->remainingTicks() > 0) break; m_scheduledEventList.pop(); scheduledEvent->execute(); diff --git a/src/framework/core/graphicalapplication.cpp b/src/framework/core/graphicalapplication.cpp index 53557fad..f1007509 100644 --- a/src/framework/core/graphicalapplication.cpp +++ b/src/framework/core/graphicalapplication.cpp @@ -76,7 +76,7 @@ void GraphicalApplication::terminate() // destroy particles g_particles.terminate(); - // destroy any reamaning widget + // destroy any remaining widget g_ui.terminate(); Application::terminate(); diff --git a/src/framework/core/scheduledevent.h b/src/framework/core/scheduledevent.h index 83b9339a..6e7f0c61 100644 --- a/src/framework/core/scheduledevent.h +++ b/src/framework/core/scheduledevent.h @@ -35,7 +35,7 @@ public: bool nextCycle(); int ticks() { return m_ticks; } - int reamaningTicks() { return m_ticks - g_clock.millis(); } + int remainingTicks() { return m_ticks - g_clock.millis(); } int delay() { return m_delay; } int cyclesExecuted() { return m_cyclesExecuted; } int maxCycles() { return m_maxCycles; } diff --git a/src/framework/luafunctions.cpp b/src/framework/luafunctions.cpp index b749e823..0abd2db1 100644 --- a/src/framework/luafunctions.cpp +++ b/src/framework/luafunctions.cpp @@ -213,7 +213,7 @@ void Application::registerLuaFunctions() g_lua.registerClass(); g_lua.bindClassMemberFunction("nextCycle", &ScheduledEvent::nextCycle); g_lua.bindClassMemberFunction("ticks", &ScheduledEvent::ticks); - g_lua.bindClassMemberFunction("reamaningTicks", &ScheduledEvent::reamaningTicks); + g_lua.bindClassMemberFunction("remainingTicks", &ScheduledEvent::remainingTicks); g_lua.bindClassMemberFunction("delay", &ScheduledEvent::delay); g_lua.bindClassMemberFunction("cyclesExecuted", &ScheduledEvent::cyclesExecuted); g_lua.bindClassMemberFunction("maxCycles", &ScheduledEvent::maxCycles); diff --git a/src/framework/net/protocol.cpp b/src/framework/net/protocol.cpp index 586347de..e90b3f0d 100644 --- a/src/framework/net/protocol.cpp +++ b/src/framework/net/protocol.cpp @@ -110,11 +110,11 @@ void Protocol::internalRecvHeader(uint8* buffer, uint16 size) { // read message size m_inputMessage->fillBuffer(buffer, size); - uint16 reamaningSize = m_inputMessage->readSize(); + uint16 remainingSize = m_inputMessage->readSize(); - // read reamaning message data + // read remaining message data if(m_connection) - m_connection->read(reamaningSize, std::bind(&Protocol::internalRecvData, asProtocol(), std::placeholders::_1, std::placeholders::_2)); + m_connection->read(remainingSize, std::bind(&Protocol::internalRecvData, asProtocol(), std::placeholders::_1, std::placeholders::_2)); } void Protocol::internalRecvData(uint8* buffer, uint16 size)