diff options
Diffstat (limited to 'src/guiMainMenu.cpp')
-rw-r--r-- | src/guiMainMenu.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index cdf1bc7d5..4ceecbb5f 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -39,6 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "tile.h" // getTexturePath #include "filesys.h" #include "util/string.h" +#include "subgame.h" struct CreateWorldDestMainMenu : public CreateWorldDest { @@ -47,7 +48,10 @@ struct CreateWorldDestMainMenu : public CreateWorldDest {} void accepted(std::wstring name, std::string gameid) { - m_menu->createNewWorld(name, gameid); + if(!string_allowed_blacklist(wide_to_narrow(name), WORLDNAME_BLACKLISTED_CHARS)) + m_menu->displayMessageMenu(wgettext("Cannot create world: Name contains invalid characters")); + else + m_menu->createNewWorld(name, gameid); } GUIMainMenu *m_menu; }; @@ -929,3 +933,7 @@ int GUIMainMenu::getTab() return TAB_SINGLEPLAYER; // Default } +void GUIMainMenu::displayMessageMenu(std::wstring msg) +{ + (new GUIMessageMenu(env, parent, -1, menumgr, msg))->drop(); +}
\ No newline at end of file |