From 715d07feeb01a3f633aa42aeb40a524c16ca321e Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Thu, 13 Jan 2011 17:58:50 +0100 Subject: Made the client handle better the lack of items.xml file. Now the client returns to server choice dialog with a warning instead of aborting. I'm kinda certain I'm not the only one getting crazy with such a lazy behaviour. Reviewed-by: Jaxad. --- src/client.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index 20d85ede..7ca90444 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -210,8 +210,16 @@ public: } } loginListener; -} // anonymous namespace +class ServerChoiceListener : public gcn::ActionListener +{ +public: + void action(const gcn::ActionEvent &) + { + Client::setState(STATE_CHOOSE_SERVER); + } +} serverChoiceListener; +} // anonymous namespace Client *Client::mInstance = 0; @@ -782,6 +790,19 @@ int Client::exec() // Load XML databases ColorDB::load(); itemDb = new ItemDB; + if (!itemDb || !itemDb->isLoaded()) + { + // Warn and return to login screen + errorMessage = + _("This server is missing needed world data. " + "Please contact the administrator(s)."); + mCurrentDialog = new OkDialog( + _("ItemDB: Error while loading " ITEMS_DB_FILE "!"), + errorMessage); + mCurrentDialog->addActionListener(&serverChoiceListener); + mCurrentDialog = NULL; // OkDialog deletes itself + break; + } Being::load(); // Hairstyles MonsterDB::load(); SpecialDB::load(); -- cgit v1.2.3-60-g2f50