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.
This commit is contained in:
parent
cf77c2baf3
commit
b68df8336a
|
@ -91,8 +91,8 @@ function terminate()
|
||||||
g_settings.set('window-pos', g_window.getUnmaximizedPos())
|
g_settings.set('window-pos', g_window.getUnmaximizedPos())
|
||||||
g_settings.set('window-maximized', g_window.isMaximized())
|
g_settings.set('window-maximized', g_window.isMaximized())
|
||||||
|
|
||||||
local clientVersion = g_game.getProtocolVersion()
|
local protocolVersion = g_game.getProtocolVersion()
|
||||||
if clientVersion ~= 0 then
|
if protocolVersion ~= 0 then
|
||||||
g_settings.set('client-version', clientVersion)
|
g_settings.set('protocol-version', protocolVersion)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,13 +85,13 @@ function onGameEditText(id, itemId, maxLength, text, writter, time)
|
||||||
end
|
end
|
||||||
|
|
||||||
okButton.onClick = doneFunc
|
okButton.onClick = doneFunc
|
||||||
cancelButton.onClick = destroy
|
cancelButton.onClick = destroyWindows
|
||||||
|
|
||||||
if not writeable then
|
if not writeable then
|
||||||
textWindow.onEnter = doneFunc
|
textWindow.onEnter = doneFunc
|
||||||
end
|
end
|
||||||
|
|
||||||
textWindow.onEscape = destroy
|
textWindow.onEscape = destroyWindows
|
||||||
|
|
||||||
table.insert(windows, textWindow)
|
table.insert(windows, textWindow)
|
||||||
end
|
end
|
||||||
|
@ -121,8 +121,10 @@ function onGameEditList(id, doorId, text)
|
||||||
end
|
end
|
||||||
|
|
||||||
okButton.onClick = doneFunc
|
okButton.onClick = doneFunc
|
||||||
|
cancelButton.onClick = destroyWindows
|
||||||
|
|
||||||
textWindow.onEnter = doneFunc
|
textWindow.onEnter = doneFunc
|
||||||
textWindow.onEscape = destroy
|
textWindow.onEscape = destroyWindows
|
||||||
|
|
||||||
table.insert(windows, textWindow)
|
table.insert(windows, textWindow)
|
||||||
end
|
end
|
||||||
|
|
|
@ -127,7 +127,7 @@ ImagePtr SpriteManager::getSpriteImage(int id)
|
||||||
read += 4 + (3 * coloredPixels);
|
read += 4 + (3 * coloredPixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill reamaning pixels with alpha
|
// fill remaining pixels with alpha
|
||||||
while(writePos < SPRITE_DATA_SIZE) {
|
while(writePos < SPRITE_DATA_SIZE) {
|
||||||
pixels[writePos + 0] = 0x00;
|
pixels[writePos + 0] = 0x00;
|
||||||
pixels[writePos + 1] = 0x00;
|
pixels[writePos + 1] = 0x00;
|
||||||
|
|
|
@ -109,10 +109,10 @@ void Application::deinit()
|
||||||
g_modules.unloadModules();
|
g_modules.unloadModules();
|
||||||
g_modules.clear();
|
g_modules.clear();
|
||||||
|
|
||||||
// release reamaning lua object references
|
// release remaining lua object references
|
||||||
g_lua.collectGarbage();
|
g_lua.collectGarbage();
|
||||||
|
|
||||||
// poll reamaning events
|
// poll remaining events
|
||||||
poll();
|
poll();
|
||||||
|
|
||||||
// disable dispatcher events
|
// disable dispatcher events
|
||||||
|
|
|
@ -45,7 +45,7 @@ void EventDispatcher::poll()
|
||||||
int loops = 0;
|
int loops = 0;
|
||||||
for(int count = 0, max = m_scheduledEventList.size(); count < max && !m_scheduledEventList.empty(); ++count) {
|
for(int count = 0, max = m_scheduledEventList.size(); count < max && !m_scheduledEventList.empty(); ++count) {
|
||||||
ScheduledEventPtr scheduledEvent = m_scheduledEventList.top();
|
ScheduledEventPtr scheduledEvent = m_scheduledEventList.top();
|
||||||
if(scheduledEvent->reamaningTicks() > 0)
|
if(scheduledEvent->remainingTicks() > 0)
|
||||||
break;
|
break;
|
||||||
m_scheduledEventList.pop();
|
m_scheduledEventList.pop();
|
||||||
scheduledEvent->execute();
|
scheduledEvent->execute();
|
||||||
|
|
|
@ -76,7 +76,7 @@ void GraphicalApplication::terminate()
|
||||||
// destroy particles
|
// destroy particles
|
||||||
g_particles.terminate();
|
g_particles.terminate();
|
||||||
|
|
||||||
// destroy any reamaning widget
|
// destroy any remaining widget
|
||||||
g_ui.terminate();
|
g_ui.terminate();
|
||||||
|
|
||||||
Application::terminate();
|
Application::terminate();
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
bool nextCycle();
|
bool nextCycle();
|
||||||
|
|
||||||
int ticks() { return m_ticks; }
|
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 delay() { return m_delay; }
|
||||||
int cyclesExecuted() { return m_cyclesExecuted; }
|
int cyclesExecuted() { return m_cyclesExecuted; }
|
||||||
int maxCycles() { return m_maxCycles; }
|
int maxCycles() { return m_maxCycles; }
|
||||||
|
|
|
@ -213,7 +213,7 @@ void Application::registerLuaFunctions()
|
||||||
g_lua.registerClass<ScheduledEvent, Event>();
|
g_lua.registerClass<ScheduledEvent, Event>();
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("nextCycle", &ScheduledEvent::nextCycle);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("nextCycle", &ScheduledEvent::nextCycle);
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("ticks", &ScheduledEvent::ticks);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("ticks", &ScheduledEvent::ticks);
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("reamaningTicks", &ScheduledEvent::reamaningTicks);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("remainingTicks", &ScheduledEvent::remainingTicks);
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("delay", &ScheduledEvent::delay);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("delay", &ScheduledEvent::delay);
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("cyclesExecuted", &ScheduledEvent::cyclesExecuted);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("cyclesExecuted", &ScheduledEvent::cyclesExecuted);
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("maxCycles", &ScheduledEvent::maxCycles);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("maxCycles", &ScheduledEvent::maxCycles);
|
||||||
|
|
|
@ -110,11 +110,11 @@ void Protocol::internalRecvHeader(uint8* buffer, uint16 size)
|
||||||
{
|
{
|
||||||
// read message size
|
// read message size
|
||||||
m_inputMessage->fillBuffer(buffer, 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)
|
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)
|
void Protocol::internalRecvData(uint8* buffer, uint16 size)
|
||||||
|
|
Loading…
Reference in New Issue