fix possible crash when reading border style, fix onLogin event

This commit is contained in:
Eduardo Bart 2012-02-08 11:44:06 -02:00
parent b56a7e3029
commit f056131ae1
3 changed files with 6 additions and 6 deletions

3
TODO
View File

@ -1,14 +1,11 @@
==================================================== ====================================================
High priority TODO in order (before first public disclose) High priority TODO in order (before first public disclose)
restore map moving
multiline text edit multiline text edit
remove UIGame remove UIGame
move windows, navigate in containers move windows, navigate in containers
complete miniwindow (close, minimize, resize, move) complete miniwindow (close, minimize, resize, move)
create and bind all game functions/events create and bind all game functions/events
let windows stay open while playing
combat controls
player status icons (poison, etc) player status icons (poison, etc)
load modules from zip files load modules from zip files
display exit box when exiting from game display exit box when exiting from game

View File

@ -122,8 +122,11 @@ void UIWidget::parseBaseStyle(const OTMLNodePtr& styleNode)
setFixedSize(node->value<bool>()); setFixedSize(node->value<bool>());
else if(node->tag() == "border") { else if(node->tag() == "border") {
auto split = Fw::split(node->value(), " "); auto split = Fw::split(node->value(), " ");
setBorderWidth(Fw::safeCast<int>(split[0])); if(split.size() == 2) {
setBorderColor(Fw::safeCast<Color>(split[1])); setBorderWidth(Fw::safeCast<int>(split[0]));
setBorderColor(Fw::safeCast<Color>(split[1]));
} else
throw OTMLException(node, "border param must have its width followed by its color");
} }
else if(node->tag() == "border-width") else if(node->tag() == "border-width")
setBorderWidth(node->value<int>()); setBorderWidth(node->value<int>());

View File

@ -1111,7 +1111,7 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
creature->setDirection(direction); creature->setDirection(direction);
// now that the local player is known, we can schedule login event // now that the local player is known, we can schedule login event
if(creature == m_localPlayer) { if(creature == m_localPlayer && !m_localPlayer->isKnown()) {
m_localPlayer->setKnown(true); m_localPlayer->setKnown(true);
g_dispatcher.addEvent([] { g_game.processLogin(); }); g_dispatcher.addEvent([] { g_game.processLogin(); });
} }