diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2009-10-03 22:48:05 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2009-10-03 22:54:04 +0200 |
commit | 9d7352022369a04d957028515d2468297422f5e7 (patch) | |
tree | c74dd3f18610f004656944e793a93ed08284a7ba | |
parent | c18aa95dc6b44337c4ab63d9d892af6eb1f5a679 (diff) | |
download | mana-client-9d7352022369a04d957028515d2468297422f5e7.tar.gz mana-client-9d7352022369a04d957028515d2468297422f5e7.tar.bz2 mana-client-9d7352022369a04d957028515d2468297422f5e7.tar.xz mana-client-9d7352022369a04d957028515d2468297422f5e7.zip |
Added support for the "too fast" login error
So that next time somebody encounters it, it doesn't turn up as "unknown
error".
-rw-r--r-- | src/gui/setup_colors.h | 2 | ||||
-rw-r--r-- | src/guild.cpp | 10 | ||||
-rw-r--r-- | src/guild.h | 4 | ||||
-rw-r--r-- | src/main.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwserv/loginhandler.cpp | 3 | ||||
-rw-r--r-- | src/net/tmwserv/protocol.h | 1 | ||||
-rw-r--r-- | src/resources/wallpaper.cpp | 6 |
7 files changed, 16 insertions, 14 deletions
diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h index 023afc7a..a7aaa5b7 100644 --- a/src/gui/setup_colors.h +++ b/src/gui/setup_colors.h @@ -88,4 +88,4 @@ class Setup_Colors : public SetupTab, void updateGradType(); }; -#endif +#endif // SETUP_COLORS_H diff --git a/src/guild.cpp b/src/guild.cpp index 62c6e3f4..be4a5204 100644 --- a/src/guild.cpp +++ b/src/guild.cpp @@ -52,13 +52,13 @@ void Guild::removeMember(const std::string &name) } } -bool Guild::isMember(const std::string &name) +bool Guild::isMember(const std::string &name) const { - std::vector<std::string>::iterator itr = mMembers.begin(), - itr_end = mMembers.end(); - while(itr != itr_end) + std::vector<std::string>::const_iterator itr = mMembers.begin(), + itr_end = mMembers.end(); + while (itr != itr_end) { - if((*itr) == name) + if ((*itr) == name) { return true; } diff --git a/src/guild.h b/src/guild.h index 9ae16f0b..be800bb2 100644 --- a/src/guild.h +++ b/src/guild.h @@ -96,7 +96,7 @@ public: return mCanInviteUsers; } - bool isMember(const std::string &name); + bool isMember(const std::string &name) const; private: std::string mName; @@ -105,4 +105,4 @@ private: bool mCanInviteUsers; }; -#endif +#endif // GUILD_H diff --git a/src/main.cpp b/src/main.cpp index 63f56818..3194bf09 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -847,7 +847,7 @@ int main(int argc, char *argv[]) defaultScreenHeight)); desktop->setSize(screenWidth, screenHeight); - + if (state != STATE_ERROR) state = STATE_CHOOSE_SERVER; State oldstate = STATE_START; // We start with a status change @@ -1100,7 +1100,7 @@ int main(int argc, char *argv[]) case STATE_REGISTER_ATTEMPT: logger->log("Username is %s", loginData.username.c_str()); - + Net::getCharHandler()->setCharInfo(&charInfo); Net::getLoginHandler()->registerAccount(&loginData); break; diff --git a/src/net/tmwserv/loginhandler.cpp b/src/net/tmwserv/loginhandler.cpp index 81079a3a..645d574c 100644 --- a/src/net/tmwserv/loginhandler.cpp +++ b/src/net/tmwserv/loginhandler.cpp @@ -235,6 +235,9 @@ void LoginHandler::handleLoginResponse(MessageIn &msg) case LOGIN_SERVER_FULL: errorMessage = _("Server is full."); break; + case LOGIN_INVALID_TIME: + errorMessage = _("Too fast after previous login."); + break; default: errorMessage = _("Unknown error."); break; diff --git a/src/net/tmwserv/protocol.h b/src/net/tmwserv/protocol.h index 1a42093e..50b20216 100644 --- a/src/net/tmwserv/protocol.h +++ b/src/net/tmwserv/protocol.h @@ -230,6 +230,7 @@ enum { // Login specific return values enum { LOGIN_INVALID_VERSION = 0x40, // the user is using an incompatible protocol + LOGIN_INVALID_TIME = 0x50, // the user tried logging in too fast LOGIN_SERVER_FULL // the server is overloaded }; diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index 5794cbbd..2c7395f0 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -18,7 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <time.h> #include "resources/wallpaper.h" @@ -31,6 +30,7 @@ #include <vector> #include <physfs.h> +#include <time.h> #define WALLPAPER_FOLDER "graphics/images/" #define WALLPAPER_BASE "login_wallpaper.png" @@ -110,7 +110,6 @@ std::string Wallpaper::getWallpaper(int width, int height) wallPaperVector.push_back(wp.filename); } - if (!wallPaperVector.empty()) { // If we've got more than one occurence of a valid wallpaper... @@ -118,7 +117,7 @@ std::string Wallpaper::getWallpaper(int width, int height) { // Return randomly a wallpaper between vector[0] and // vector[vector.size() - 1] - srand((unsigned)time(0)); + srand((unsigned) time(0)); return wallPaperVector [int(wallPaperVector.size() * rand() / (RAND_MAX + 1.0))]; } @@ -132,5 +131,4 @@ std::string Wallpaper::getWallpaper(int width, int height) // Return an empty string if everything else failed return std::string(); - } |