diff --git a/src/achievements/achievement.cpp b/src/achievements/achievement.cpp index 1c06bc2f0..ef8a53b56 100644 --- a/src/achievements/achievement.cpp +++ b/src/achievements/achievement.cpp @@ -25,8 +25,10 @@ #include "config/player_manager.hpp" #include "guiengine/message_queue.hpp" #include "io/utf_writer.hpp" -#include "config/player_manager.hpp" +#include "io/xml_node.hpp" +#include "online/xml_request.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/achievements/achievement_info.cpp b/src/achievements/achievement_info.cpp index 9bad98eeb..8f09b8fad 100644 --- a/src/achievements/achievement_info.cpp +++ b/src/achievements/achievement_info.cpp @@ -22,7 +22,10 @@ #include "achievements/achievement.hpp" #include "achievements/achievements_status.hpp" #include "config/player_manager.hpp" +#include "io/xml_node.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include #include @@ -249,4 +252,10 @@ int AchievementInfo::recursiveProgressCount(goalTree &parent) return parent.children[0].value; } } -} // recursiveProgressCount +} // recursiveProgressCount + +// ---------------------------------------------------------------------------- +irr::core::stringw AchievementInfo::getDescription() const +{ + return _(m_description.c_str()); +} // recursiveProgressCount diff --git a/src/achievements/achievement_info.hpp b/src/achievements/achievement_info.hpp index 5711dc0ed..81f5666b5 100644 --- a/src/achievements/achievement_info.hpp +++ b/src/achievements/achievement_info.hpp @@ -20,16 +20,16 @@ #ifndef HEADER_ACHIEVEMENT_INFO_HPP #define HEADER_ACHIEVEMENT_INFO_HPP -#include "io/xml_node.hpp" -#include "utils/translation.hpp" #include "utils/types.hpp" #include #include +#include // ============================================================================ class Achievement; +class XMLNode; /** This class stores an achievement definition from the xml file, including * title, description, but also how to achieve this achievement. @@ -91,8 +91,8 @@ public: int getGoalCount() { return recursiveGoalCount(m_goal_tree); } int getDepth() { return getRecursiveDepth(m_goal_tree); } uint32_t getID() const { return m_id; } - irr::core::stringw getDescription() const { return _(m_description.c_str()); } - irr::core::stringw getName() const { return _LTR(m_name.c_str()); } + irr::core::stringw getDescription() const; + const irr::core::stringw& getName() const { return m_name; } bool isSecret() const { return m_is_secret; } // This function should not be called if copy already has children diff --git a/src/achievements/achievements_status.cpp b/src/achievements/achievements_status.cpp index 6f7e27e89..9bfb48fc2 100644 --- a/src/achievements/achievements_status.cpp +++ b/src/achievements/achievements_status.cpp @@ -24,11 +24,13 @@ #include "achievements/achievements_manager.hpp" #include "config/player_manager.hpp" #include "io/utf_writer.hpp" +#include "io/xml_node.hpp" +#include "online/xml_request.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" #include "utils/log.hpp" #include "utils/ptr_vector.hpp" -#include "utils/translation.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/achievements/achievements_status.hpp b/src/achievements/achievements_status.hpp index 0df012d84..3204a194d 100644 --- a/src/achievements/achievements_status.hpp +++ b/src/achievements/achievements_status.hpp @@ -20,14 +20,14 @@ #ifndef HEADER_ACHIEVEMENTS_SLOT_HPP #define HEADER_ACHIEVEMENTS_SLOT_HPP -#include "achievements/achievement.hpp" -#include "online/request_manager.hpp" -#include "online/xml_request.hpp" #include "utils/types.hpp" #include +#include #include +#include +class Achievement; class UTFWriter; class XMLNode; @@ -205,12 +205,6 @@ private: bool m_online; bool m_valid; - class SyncAchievementsRequest : public Online::XMLRequest { - virtual void callback (); - public: - SyncAchievementsRequest() : Online::XMLRequest(true) {} - }; - void setEnumToString(); void updateAchievementsProgress(UpdateType type, unsigned int enum_id); diff --git a/src/addons/addon.cpp b/src/addons/addon.cpp index 2cb6ac259..afc555f93 100644 --- a/src/addons/addon.cpp +++ b/src/addons/addon.cpp @@ -228,3 +228,19 @@ void Addon::deleteInvalidIconFile() file_manager->removeFile(icon); m_installed = false; } // redownloadIcon + +// ---------------------------------------------------------------------------- +/** A static function that checks if the given ID is an addon. This is + * done by testing if the directory name is in the addons directory. + */ +bool Addon::isAddon(const std::string &directory) +{ + return StringUtils::startsWith(directory,file_manager->getAddonsDir()); +} // isAddon + +// ---------------------------------------------------------------------------- +/** Returns the directory in which this addon is installed. */ +std::string Addon::getDataDir() const +{ + return file_manager->getAddonsFile(getTypeDirectory()+m_dir_name); +} // getDataDir diff --git a/src/addons/addon.hpp b/src/addons/addon.hpp index 078651035..86cfa3c93 100644 --- a/src/addons/addon.hpp +++ b/src/addons/addon.hpp @@ -24,14 +24,14 @@ * Handles add-ons that can be downloaded */ -#include "io/file_manager.hpp" -#include "utils/string_utils.hpp" #include "utils/time.hpp" #include #include +#include "irrString.h" class XMLNode; +using namespace irr; /** * \ingroup addonsgroup @@ -59,14 +59,7 @@ public: }; // ------------------------------------------------------------------------ - /** A static function that checks if the given ID is an addon. This is - * done by testing if the directory name is in the addons directory. - */ - static bool isAddon(const std::string &directory) - { - return StringUtils::startsWith(directory,file_manager->getAddonsDir()); - } // isAddon - + static bool isAddon(const std::string &directory); // ------------------------------------------------------------------------ /** Create an addon id by adding a 'addon_' prefix to the given id. */ static std::string createAddonId(const std::string &id) @@ -264,11 +257,7 @@ public: /** Returns if a certain status flag is set. */ bool testStatus(AddonStatus n) const {return (m_status & n) !=0; } // ------------------------------------------------------------------------ - /** Returns the directory in which this addon is installed. */ - std::string getDataDir() const - { - return file_manager->getAddonsFile(getTypeDirectory()+m_dir_name); - } // getDataDir + std::string getDataDir() const; // ------------------------------------------------------------------------ bool filterByWords(const core::stringw words) const; // ------------------------------------------------------------------------ diff --git a/src/audio/sfx_manager.cpp b/src/audio/sfx_manager.cpp index 339aebfa8..b702c2fe6 100644 --- a/src/audio/sfx_manager.cpp +++ b/src/audio/sfx_manager.cpp @@ -25,6 +25,7 @@ #include "modes/world.hpp" #include "race/race_manager.hpp" #include "utils/profiler.hpp" +#include "utils/string_utils.hpp" #include "utils/vs.hpp" #include diff --git a/src/challenges/challenge_data.cpp b/src/challenges/challenge_data.cpp index 9e31de5e1..9c0ba4c6e 100644 --- a/src/challenges/challenge_data.cpp +++ b/src/challenges/challenge_data.cpp @@ -32,6 +32,8 @@ #include "replay/replay_play.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" ChallengeData::ChallengeData(const std::string& filename) { diff --git a/src/config/player_manager.cpp b/src/config/player_manager.cpp index 57ac925a5..522d6bf22 100644 --- a/src/config/player_manager.cpp +++ b/src/config/player_manager.cpp @@ -80,19 +80,6 @@ PlayerProfile::OnlineState PlayerManager::getCurrentOnlineState() return getCurrentPlayer()->getOnlineState(); } // getCurrentOnlineState -// ---------------------------------------------------------------------------- -/** Returns the online name of this player. - */ -const irr::core::stringw& PlayerManager::getCurrentOnlineUserName() -{ - if (getCurrentOnlineState() == PlayerProfile::OS_SIGNED_IN || - getCurrentOnlineState() == PlayerProfile::OS_GUEST ) - return getCurrentOnlineProfile()->getUserName(); - - static core::stringw not_signed_in = _("Currently not signed in"); - return not_signed_in; -} // getCurrentOnlineUserName - // ---------------------------------------------------------------------------- /** Sends a request to the server to see if any new information is * available. (online friends, notifications, etc.). @@ -270,7 +257,7 @@ void PlayerManager::save() if(m_current_player) { players_file << " getName(true/*ignoreRTL*/)) << L"\"/>\n"; + << StringUtils::xmlEncode(m_current_player->getName()) << L"\"/>\n"; } // Save all non-guest players @@ -328,8 +315,7 @@ void PlayerManager::enforceCurrentPlayer() if (!player->isGuestAccount()) { Log::info("PlayerManager", "Enforcing current player '%s'.", - StringUtils::wideToUtf8(player->getName(true/*ignoreRTL*/)) - .c_str()); + StringUtils::wideToUtf8(player->getName()).c_str()); m_current_player = player; return; } @@ -343,8 +329,7 @@ void PlayerManager::enforceCurrentPlayer() if (!player->isGuestAccount()) { Log::info("PlayerManager", "Enforcing current player '%s'.", - StringUtils::wideToUtf8(player->getName(true/*ignoreRTL*/)) - .c_str()); + StringUtils::wideToUtf8(player->getName()).c_str()); m_current_player = player; return; } @@ -392,12 +377,12 @@ void PlayerManager::createGuestPlayers(int n) if(i==0) { // I18N: Name of first guest player (without number) - guest_name = _LTR("Guest"); + guest_name = _("Guest"); } else { // I18N: Name of further guest players, with a 1, 2, ... attached - guest_name = _LTR("Guest %d", i); + guest_name = _("Guest %d", i); } PlayerProfile *guest = new Online::OnlinePlayerProfile(guest_name, /*guest*/ true); @@ -457,7 +442,7 @@ PlayerProfile *PlayerManager::getPlayer(const irr::core::stringw &name) { for (PlayerProfile* player : m_all_players) { - if(player->getName(true/*ignoreRTL*/)==name) + if(player->getName()==name) return player; } return NULL; diff --git a/src/config/player_manager.hpp b/src/config/player_manager.hpp index 6bc7dca58..bf4edef14 100644 --- a/src/config/player_manager.hpp +++ b/src/config/player_manager.hpp @@ -106,7 +106,6 @@ public: static Online::OnlineProfile* getCurrentOnlineProfile(); static PlayerProfile::OnlineState getCurrentOnlineState(); - static const irr::core::stringw& getCurrentOnlineUserName(); static void requestOnlinePoll(); static void resumeSavedSession(); static void onSTKQuit(); diff --git a/src/config/player_profile.cpp b/src/config/player_profile.cpp index 60a9c40e3..005d457c8 100644 --- a/src/config/player_profile.cpp +++ b/src/config/player_profile.cpp @@ -21,11 +21,12 @@ #include "achievements/achievements_manager.hpp" #include "challenges/unlock_manager.hpp" #include "config/player_manager.hpp" +#include "io/file_manager.hpp" +#include "io/utf_writer.hpp" +#include "io/xml_node.hpp" #include "karts/kart_properties.hpp" #include "karts/kart_properties_manager.hpp" #include "online/online_player_profile.hpp" -#include "io/xml_node.hpp" -#include "io/utf_writer.hpp" #include "utils/string_utils.hpp" //------------------------------------------------------------------------------ diff --git a/src/config/player_profile.hpp b/src/config/player_profile.hpp index ddf6adacf..7a4a00338 100644 --- a/src/config/player_profile.hpp +++ b/src/config/player_profile.hpp @@ -24,7 +24,6 @@ #include "utils/leak_check.hpp" #include "utils/no_copy.hpp" #include "utils/types.hpp" -#include "utils/translation.hpp" #include using namespace irr; @@ -158,17 +157,10 @@ public: // ------------------------------------------------------------------------ /** Returns the name of this player. */ - const core::stringw getName(bool ignore_rtl = false) const + const core::stringw& getName() const { assert(m_magic_number == 0xABCD1234); - if (ignore_rtl) - return m_local_name; - else - { - const core::stringw fribidized_name = - translations->fribidize(m_local_name); - return fribidized_name; - } + return m_local_name; } // getName // ------------------------------------------------------------------------ @@ -182,16 +174,9 @@ public: } // isGuestAccount // ------------------------------------------------------------------------ /** Returns the last used online name. */ - const core::stringw getLastOnlineName(bool ignore_rtl = false) const + const core::stringw& getLastOnlineName() const { - if (ignore_rtl) - return m_last_online_name; - else - { - const core::stringw fribidized_name = - translations->fribidize(m_last_online_name); - return fribidized_name; - } + return m_last_online_name; } // getLastOnlineName // ------------------------------------------------------------------------ /** Sets the last used online name. */ diff --git a/src/config/stk_config.cpp b/src/config/stk_config.cpp index e3f77e700..8e5e17555 100644 --- a/src/config/stk_config.cpp +++ b/src/config/stk_config.cpp @@ -28,6 +28,7 @@ #include "items/item.hpp" #include "karts/kart_properties.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" STKConfig* stk_config=0; float STKConfig::UNDEFINED = -99.9f; diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 6719bf416..2054b0a53 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -71,6 +71,7 @@ #include "utils/constants.hpp" #include "utils/log.hpp" #include "utils/profiler.hpp" +#include "utils/string_utils.hpp" #include "utils/vs.hpp" #include diff --git a/src/graphics/shader_files_manager.cpp b/src/graphics/shader_files_manager.cpp index cbc14406a..baf1d061c 100644 --- a/src/graphics/shader_files_manager.cpp +++ b/src/graphics/shader_files_manager.cpp @@ -25,6 +25,7 @@ #include "guiengine/message_queue.hpp" #include "io/file_manager.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/guiengine/engine.cpp b/src/guiengine/engine.cpp index 85ba836cc..4a8194a6e 100644 --- a/src/guiengine/engine.cpp +++ b/src/guiengine/engine.cpp @@ -684,6 +684,8 @@ namespace GUIEngine #include "modes/world.hpp" #include "states_screens/race_gui_base.hpp" #include "utils/debug.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include #include diff --git a/src/guiengine/screen_loader.cpp b/src/guiengine/screen_loader.cpp index 0931555df..c477b8d8b 100644 --- a/src/guiengine/screen_loader.cpp +++ b/src/guiengine/screen_loader.cpp @@ -19,6 +19,7 @@ #include "guiengine/screen.hpp" #include "guiengine/engine.hpp" #include "guiengine/widgets.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include #include diff --git a/src/guiengine/skin.cpp b/src/guiengine/skin.cpp index 5da61bd9e..d219cac80 100644 --- a/src/guiengine/skin.cpp +++ b/src/guiengine/skin.cpp @@ -34,6 +34,7 @@ #include "io/file_manager.hpp" #include "states_screens/state_manager.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" using namespace GUIEngine; using namespace irr; diff --git a/src/guiengine/widgets/icon_button_widget.cpp b/src/guiengine/widgets/icon_button_widget.cpp index a41b91e82..fff7997ee 100644 --- a/src/guiengine/widgets/icon_button_widget.cpp +++ b/src/guiengine/widgets/icon_button_widget.cpp @@ -24,7 +24,7 @@ #include "guiengine/scalable_font.hpp" #include "io/file_manager.hpp" #include "utils/log.hpp" -#include "utils/translation.hpp" +#include "utils/string_utils.hpp" #include #include @@ -243,7 +243,6 @@ void IconButtonWidget::add() setLabelFont(); - m_label->setRightToLeft(translations->isRTLText(message)); m_label->setTextRestrainedInside(false); } diff --git a/src/guiengine/widgets/player_kart_widget.cpp b/src/guiengine/widgets/player_kart_widget.cpp index 2fd1597c5..a50fc15d8 100644 --- a/src/guiengine/widgets/player_kart_widget.cpp +++ b/src/guiengine/widgets/player_kart_widget.cpp @@ -29,6 +29,9 @@ #include "karts/kart_properties.hpp" #include "karts/kart_properties_manager.hpp" #include "states_screens/kart_selection.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" + #include using namespace GUIEngine; diff --git a/src/input/device_manager.cpp b/src/input/device_manager.cpp index 2d4963a8b..2b52cbe7f 100644 --- a/src/input/device_manager.cpp +++ b/src/input/device_manager.cpp @@ -32,9 +32,9 @@ #include "states_screens/kart_selection.hpp" #include "states_screens/state_manager.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" - #define INPUT_MODE_DEBUG 0 static const char INPUT_FILE_NAME[] = "input.xml"; diff --git a/src/input/gamepad_android_config.cpp b/src/input/gamepad_android_config.cpp index d87296777..e0e4a51c9 100644 --- a/src/input/gamepad_android_config.cpp +++ b/src/input/gamepad_android_config.cpp @@ -18,6 +18,7 @@ #include "input/gamepad_android_config.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/io/xml_node.cpp b/src/io/xml_node.cpp index 9ef5eabbb..d409af05e 100644 --- a/src/io/xml_node.cpp +++ b/src/io/xml_node.cpp @@ -20,6 +20,7 @@ #include "io/xml_node.hpp" #include "utils/interpolation_array.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" #include "utils/vec3.hpp" #include diff --git a/src/io/xml_node.hpp b/src/io/xml_node.hpp index 8f6fe3083..551432fe1 100644 --- a/src/io/xml_node.hpp +++ b/src/io/xml_node.hpp @@ -33,7 +33,6 @@ using namespace irr; #include "utils/leak_check.hpp" #include "utils/no_copy.hpp" -#include "utils/string_utils.hpp" #include "utils/time.hpp" #include "utils/types.hpp" diff --git a/src/items/item.cpp b/src/items/item.cpp index 764b5c7ae..047929b66 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -33,6 +33,7 @@ #include "tracks/drive_node.hpp" #include "tracks/track.hpp" #include "utils/constants.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/items/projectile_manager.cpp b/src/items/projectile_manager.cpp index 3e75546b0..4aa30d0b0 100644 --- a/src/items/projectile_manager.cpp +++ b/src/items/projectile_manager.cpp @@ -32,6 +32,7 @@ #include "network/network_config.hpp" #include "network/network_string.hpp" #include "network/rewind_manager.hpp" +#include "utils/string_utils.hpp" #include diff --git a/src/karts/abstract_kart.cpp b/src/karts/abstract_kart.cpp index 7c43623e4..11043c0cb 100644 --- a/src/karts/abstract_kart.cpp +++ b/src/karts/abstract_kart.cpp @@ -85,6 +85,7 @@ void AbstractKart::loadKartProperties(const std::string& new_ident, kp = kart_properties_manager->getKart(std::string("tux")); } m_kart_properties->copyForPlayer(kp, difficulty); + m_name = m_kart_properties->getName(); m_difficulty = difficulty; m_kart_animation = NULL; assert(m_kart_properties); @@ -116,12 +117,6 @@ void AbstractKart::changeKart(const std::string& new_ident, loadKartProperties(new_ident, difficulty, ri); } // changeKart -// ---------------------------------------------------------------------------- -/** Returns a name to be displayed for this kart. */ -core::stringw AbstractKart::getName() const -{ - return m_kart_properties->getName(); -} // getName; // ---------------------------------------------------------------------------- /** Returns a unique identifier for this kart (name of the directory the * kart was loaded from). */ diff --git a/src/karts/abstract_kart.hpp b/src/karts/abstract_kart.hpp index f4994a114..a54af1769 100644 --- a/src/karts/abstract_kart.hpp +++ b/src/karts/abstract_kart.hpp @@ -75,6 +75,9 @@ private: /** Index of kart in world. */ unsigned int m_world_kart_id; + /** Name of the kart with translation. */ + core::stringw m_name; + // ------------------------------------------------------------------------ void loadKartProperties(const std::string& new_ident, PerPlayerDifficulty difficulty, @@ -113,7 +116,10 @@ public: PerPlayerDifficulty difficulty, std::shared_ptr ri); virtual ~AbstractKart(); - virtual core::stringw getName() const; + // ------------------------------------------------------------------------ + /** Returns a name to be displayed for this kart. */ + const core::stringw& getName() const { return m_name; } + // ------------------------------------------------------------------------ virtual void reset(); virtual void init(RaceManager::KartType type) = 0; // ======================================================================== diff --git a/src/karts/controller/local_player_controller.cpp b/src/karts/controller/local_player_controller.cpp index ea7782a9e..40d8ceffc 100644 --- a/src/karts/controller/local_player_controller.cpp +++ b/src/karts/controller/local_player_controller.cpp @@ -47,6 +47,7 @@ #include "tracks/track.hpp" #include "utils/constants.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" /** The constructor for a loca player kart, i.e. a player that is playing diff --git a/src/karts/controller/player_controller.cpp b/src/karts/controller/player_controller.cpp index c1a2be07c..710ba1b10 100644 --- a/src/karts/controller/player_controller.cpp +++ b/src/karts/controller/player_controller.cpp @@ -38,6 +38,7 @@ #include "states_screens/race_gui_base.hpp" #include "utils/constants.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/karts/controller/spare_tire_ai.cpp b/src/karts/controller/spare_tire_ai.cpp index 9d179c1c4..ce42ea344 100644 --- a/src/karts/controller/spare_tire_ai.cpp +++ b/src/karts/controller/spare_tire_ai.cpp @@ -27,6 +27,8 @@ #include "tracks/arena_node.hpp" #include "physics/physics.hpp" #include "utils/random_generator.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 8126fabfa..5761a1342 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -85,8 +85,10 @@ #include "tracks/track_sector.hpp" #include "utils/constants.hpp" #include "utils/log.hpp" //TODO: remove after debugging is done -#include "utils/vs.hpp" #include "utils/profiler.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" +#include "utils/vs.hpp" #include #include diff --git a/src/karts/kart_properties.cpp b/src/karts/kart_properties.cpp index ee7f04007..ae622e5a5 100644 --- a/src/karts/kart_properties.cpp +++ b/src/karts/kart_properties.cpp @@ -576,6 +576,13 @@ float KartProperties::getAccelerationEfficiency() const return (sum / 10395); } // getAccelerationEfficiency +// ---------------------------------------------------------------------------- +/** Returns the name of this kart. */ +core::stringw KartProperties::getName() const +{ + return _(m_name.c_str()); +} // getName + // ---------------------------------------------------------------------------- // Script-generated content generated by tools/create_kart_properties.py getter // Please don't change the following tag. It will be automatically detected diff --git a/src/karts/kart_properties.hpp b/src/karts/kart_properties.hpp index 6913cf7cc..88227329b 100644 --- a/src/karts/kart_properties.hpp +++ b/src/karts/kart_properties.hpp @@ -251,14 +251,7 @@ public: // ------------------------------------------------------------------------ void setHatMeshName(const std::string &hat_name); // ------------------------------------------------------------------------ - /** Returns the name of this kart. - \note Pass it through fridibi as needed, this is the LTR name - */ - core::stringw getName() const - { - return _LTR(m_name.c_str()); - } - + core::stringw getName() const; // ------------------------------------------------------------------------ const std::string getNonTranslatedName() const {return m_name;} diff --git a/src/karts/kart_rewinder.cpp b/src/karts/kart_rewinder.cpp index 1421e811c..5cf129a50 100644 --- a/src/karts/kart_rewinder.cpp +++ b/src/karts/kart_rewinder.cpp @@ -36,6 +36,8 @@ #include "network/rewind_manager.hpp" #include "network/network_string.hpp" #include "physics/btKart.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include "utils/vec3.hpp" #include diff --git a/src/main_loop.cpp b/src/main_loop.cpp index 727224397..314506779 100644 --- a/src/main_loop.cpp +++ b/src/main_loop.cpp @@ -44,7 +44,9 @@ #include "race/race_manager.hpp" #include "states_screens/state_manager.hpp" #include "utils/profiler.hpp" +#include "utils/string_utils.hpp" #include "utils/time.hpp" +#include "utils/translation.hpp" #ifndef WIN32 #include diff --git a/src/modes/capture_the_flag.cpp b/src/modes/capture_the_flag.cpp index 28caa9198..f7fd8df4d 100644 --- a/src/modes/capture_the_flag.cpp +++ b/src/modes/capture_the_flag.cpp @@ -33,6 +33,8 @@ #include "states_screens/race_gui.hpp" #include "tracks/track.hpp" #include "tracks/track_object_manager.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include diff --git a/src/modes/cutscene_world.cpp b/src/modes/cutscene_world.cpp index b2506700a..e285dae26 100644 --- a/src/modes/cutscene_world.cpp +++ b/src/modes/cutscene_world.cpp @@ -41,6 +41,7 @@ #include "tracks/track_object_manager.hpp" #include "utils/constants.hpp" #include "utils/ptr_vector.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/modes/easter_egg_hunt.cpp b/src/modes/easter_egg_hunt.cpp index d91ee15b8..9e635eabd 100644 --- a/src/modes/easter_egg_hunt.cpp +++ b/src/modes/easter_egg_hunt.cpp @@ -23,6 +23,8 @@ #include "karts/ghost_kart.hpp" #include "replay/replay_play.hpp" #include "tracks/track.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" //----------------------------------------------------------------------------- /** Constructor. Sets up the clock mode etc. diff --git a/src/modes/follow_the_leader.cpp b/src/modes/follow_the_leader.cpp index 2b00f1b2d..10b0ea91c 100644 --- a/src/modes/follow_the_leader.cpp +++ b/src/modes/follow_the_leader.cpp @@ -26,6 +26,7 @@ #include "karts/controller/controller.hpp" #include "states_screens/race_gui_base.hpp" #include "tracks/track.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/modes/free_for_all.cpp b/src/modes/free_for_all.cpp index d8dd8bf72..ec3e010f4 100644 --- a/src/modes/free_for_all.cpp +++ b/src/modes/free_for_all.cpp @@ -23,6 +23,7 @@ #include "network/protocols/game_events_protocol.hpp" #include "network/stk_host.hpp" #include "tracks/track.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/modes/profile_world.cpp b/src/modes/profile_world.cpp index 147577aa0..d24e22dc9 100644 --- a/src/modes/profile_world.cpp +++ b/src/modes/profile_world.cpp @@ -29,6 +29,7 @@ #include #include +#include ProfileWorld::ProfileType ProfileWorld::m_profile_mode=PROFILE_NONE; int ProfileWorld::m_num_laps = 0; diff --git a/src/modes/three_strikes_battle.cpp b/src/modes/three_strikes_battle.cpp index ef04284de..6d1fcb081 100644 --- a/src/modes/three_strikes_battle.cpp +++ b/src/modes/three_strikes_battle.cpp @@ -36,6 +36,8 @@ #include "tracks/track.hpp" #include "tracks/track_object_manager.hpp" #include "utils/constants.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include #include diff --git a/src/network/game_setup.cpp b/src/network/game_setup.cpp index bb569a68b..d738a973f 100644 --- a/src/network/game_setup.cpp +++ b/src/network/game_setup.cpp @@ -30,6 +30,7 @@ #include "network/stk_host.hpp" #include "race/race_manager.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/network/protocols/client_lobby.cpp b/src/network/protocols/client_lobby.cpp index a5d7b1239..55626dcb8 100644 --- a/src/network/protocols/client_lobby.cpp +++ b/src/network/protocols/client_lobby.cpp @@ -49,6 +49,8 @@ #include "network/server_config.hpp" #include "network/stk_host.hpp" #include "network/stk_peer.hpp" +#include "online/online_profile.hpp" +#include "online/xml_request.hpp" #include "states_screens/online/networking_lobby.hpp" #include "states_screens/online/network_kart_selection.hpp" #include "states_screens/race_result_gui.hpp" @@ -56,6 +58,8 @@ #include "tracks/track.hpp" #include "tracks/track_manager.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" // ============================================================================ /** The protocol that manages starting a race with the server. It uses a @@ -397,7 +401,10 @@ void ClientLobby::update(int ticks) { ns->addUInt32(id).addUInt32(0); if (id != 0) - ns->encodeString(PlayerManager::getCurrentOnlineUserName()); + { + ns->encodeString( + PlayerManager::getCurrentOnlineProfile()->getUserName()); + } } rest->encodeString(ServerConfig::m_private_server_password) @@ -1333,7 +1340,7 @@ void ClientLobby::sendChat(irr::core::stringw text) PlayerProfile* player = PlayerManager::getCurrentPlayer(); if (PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_IN) - name = PlayerManager::getCurrentOnlineUserName(); + name = PlayerManager::getCurrentOnlineProfile()->getUserName(); else name = player->getName(); chat->encodeString16(name + L": " + text); diff --git a/src/network/protocols/connect_to_server.cpp b/src/network/protocols/connect_to_server.cpp index a857d040c..6528d1f0e 100644 --- a/src/network/protocols/connect_to_server.cpp +++ b/src/network/protocols/connect_to_server.cpp @@ -19,6 +19,8 @@ #include "network/protocols/connect_to_server.hpp" #include "config/user_config.hpp" +#include "io/file_manager.hpp" +#include "io/xml_node.hpp" #include "network/crypto.hpp" #include "network/event.hpp" #include "network/network.hpp" diff --git a/src/network/protocols/connect_to_server.hpp b/src/network/protocols/connect_to_server.hpp index 2c7cc51e9..815abf711 100644 --- a/src/network/protocols/connect_to_server.hpp +++ b/src/network/protocols/connect_to_server.hpp @@ -26,6 +26,8 @@ #include #include +#include "irrString.h" + class Server; class ConnectToServer : public Protocol diff --git a/src/network/protocols/server_lobby.cpp b/src/network/protocols/server_lobby.cpp index 8ab1463e8..6013126de 100644 --- a/src/network/protocols/server_lobby.cpp +++ b/src/network/protocols/server_lobby.cpp @@ -42,7 +42,7 @@ #include "network/stk_host.hpp" #include "network/stk_peer.hpp" #include "online/online_profile.hpp" -#include "online/request_manager.hpp" +#include "online/xml_request.hpp" #include "race/race_manager.hpp" #include "states_screens/online/networking_lobby.hpp" #include "states_screens/race_result_gui.hpp" @@ -51,6 +51,7 @@ #include "tracks/track_manager.hpp" #include "utils/log.hpp" #include "utils/random_generator.hpp" +#include "utils/string_utils.hpp" #include "utils/time.hpp" #include diff --git a/src/network/server.cpp b/src/network/server.cpp index 19eab77a4..404470a08 100644 --- a/src/network/server.cpp +++ b/src/network/server.cpp @@ -186,4 +186,19 @@ Track* Server::getCurrentTrack() const if (!m_current_track.empty()) return track_manager->getTrack(m_current_track); return NULL; -} +} // getCurrentTrack + +// ---------------------------------------------------------------------------- +bool Server::searchByName(const std::string& lower_case_word) +{ + auto list = StringUtils::split(lower_case_word, ' ', false); + bool server_name_found = true; + for (auto& word : list) + { + const std::string& for_search = m_lower_case_name + + m_lower_case_player_names; + server_name_found = server_name_found && + for_search.find(word) != std::string::npos; + } + return server_name_found; +} // searchByName diff --git a/src/network/server.hpp b/src/network/server.hpp index 01c9bce23..92f314eee 100644 --- a/src/network/server.hpp +++ b/src/network/server.hpp @@ -161,19 +161,7 @@ public: // ------------------------------------------------------------------------ void setSupportsEncryption(bool val) { m_supports_encrytion = val; } // ------------------------------------------------------------------------ - bool searchByName(const std::string& lower_case_word) - { - auto list = StringUtils::split(lower_case_word, ' ', false); - bool server_name_found = true; - for (auto& word : list) - { - const std::string& for_search = m_lower_case_name + - m_lower_case_player_names; - server_name_found = server_name_found && - for_search.find(word) != std::string::npos; - } - return server_name_found; - } + bool searchByName(const std::string& lower_case_word); // ------------------------------------------------------------------------ Track* getCurrentTrack() const; // ------------------------------------------------------------------------ diff --git a/src/network/servers_manager.cpp b/src/network/servers_manager.cpp index a354207a0..5267d4e93 100644 --- a/src/network/servers_manager.cpp +++ b/src/network/servers_manager.cpp @@ -20,6 +20,7 @@ #include "config/stk_config.hpp" #include "config/user_config.hpp" +#include "io/xml_node.hpp" #include "network/network.hpp" #include "network/network_config.hpp" #include "network/network_string.hpp" diff --git a/src/network/stk_host.cpp b/src/network/stk_host.cpp index 2ce5baccd..ae0e80149 100644 --- a/src/network/stk_host.cpp +++ b/src/network/stk_host.cpp @@ -37,6 +37,7 @@ #include "tracks/track_manager.hpp" #include "utils/log.hpp" #include "utils/separate_process.hpp" +#include "utils/string_utils.hpp" #include "utils/time.hpp" #include "utils/vs.hpp" diff --git a/src/network/transport_address.cpp b/src/network/transport_address.cpp index bbbc64be1..6f19c9fd5 100644 --- a/src/network/transport_address.cpp +++ b/src/network/transport_address.cpp @@ -18,6 +18,7 @@ #include "network/transport_address.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" #ifdef WIN32 # include @@ -28,6 +29,37 @@ # include #endif +// ---------------------------------------------------------------------------- +/** Construct an IO address from a string in the format x.x.x.x with a + * port number. */ +TransportAddress::TransportAddress(const std::string& str, uint16_t port_number) +{ + std::vector ip = StringUtils::splitToUInt(str, '.'); + m_ip = 0; + m_port = 0; + if (ip.size() >= 4) + m_ip = (ip[0] << 24) + (ip[1] << 16) + (ip[2] << 8) + ip[3]; + + m_port = port_number; +} // TransportAddress(string of ip, port number) + +// ---------------------------------------------------------------------------- +/** Construct an IO address from a string in the format x.x.x.x:x. */ +TransportAddress::TransportAddress(const std::string& str) +{ + std::string combined = StringUtils::replace(str, ":", "."); + std::vector ip = StringUtils::splitToUInt(combined, '.'); + m_ip = 0; + m_port = 0; + if (ip.size() >= 4) + m_ip = (ip[0] << 24) + (ip[1] << 16) + (ip[2] << 8) + ip[3]; + + if(ip.size()==5) + m_port = (uint16_t)(ip[4] < 65536 ? ip[4] : 0); + else + m_port = 0; +} // TransportAddress(string of ip) + // ---------------------------------------------------------------------------- /** Returns if this IP address belongs to a LAN, i.e. is in 192.168* or * 10*, 172.16-31.*, or is on the same host, i.e. 127* or same public address. @@ -218,3 +250,20 @@ void TransportAddress::unitTesting() assert(t20.getPort() == 123); } // unitTesting + +// ---------------------------------------------------------------------------- +/** Returns a std::string representing the ip address and port in human + * readable format. + * \param show_port True if the port should be shown as well, otherwise + * only the ip address will be returned. + */ +std::string TransportAddress::toString(bool show_port) const +{ + std::string s = + StringUtils::insertValues("%d.%d.%d.%d", + ((m_ip >> 24) & 0xff), ((m_ip >> 16) & 0xff), + ((m_ip >> 8) & 0xff), ((m_ip >> 0) & 0xff)); + if (show_port) + s += StringUtils::insertValues(":%d", m_port); + return s; +} // toString diff --git a/src/network/transport_address.hpp b/src/network/transport_address.hpp index 028f0b8a2..1e2f4a970 100644 --- a/src/network/transport_address.hpp +++ b/src/network/transport_address.hpp @@ -22,7 +22,6 @@ #ifndef HEADER_TRANSPORT_ADDRESS_HPP #define HEADER_TRANSPORT_ADDRESS_HPP -#include "utils/string_utils.hpp" #include "utils/types.hpp" #include "enet/enet.h" @@ -65,36 +64,9 @@ public: } // TransportAddress(EnetAddress) // ------------------------------------------------------------------------ - /** Construct an IO address from a string in the format x.x.x.x with a - * port number. */ - TransportAddress(const std::string& str, uint16_t port_number) - { - std::vector ip = StringUtils::splitToUInt(str, '.'); - m_ip = 0; - m_port = 0; - if (ip.size() >= 4) - m_ip = (ip[0] << 24) + (ip[1] << 16) + (ip[2] << 8) + ip[3]; - - m_port = port_number; - } // TransportAddress(string of ip, port number) - + TransportAddress(const std::string& str, uint16_t port_number); // ------------------------------------------------------------------------ - /** Construct an IO address from a string in the format x.x.x.x:x. */ - TransportAddress(const std::string& str) - { - std::string combined = StringUtils::replace(str, ":", "."); - std::vector ip = StringUtils::splitToUInt(combined, '.'); - m_ip = 0; - m_port = 0; - if (ip.size() >= 4) - m_ip = (ip[0] << 24) + (ip[1] << 16) + (ip[2] << 8) + ip[3]; - - if(ip.size()==5) - m_port = (uint16_t)(ip[4] < 65536 ? ip[4] : 0); - else - m_port = 0; - } // TransportAddress(string of ip) - + TransportAddress(const std::string& str); // ------------------------------------------------------------------------ ~TransportAddress() {} // ------------------------------------------------------------------------ @@ -163,21 +135,7 @@ public: return other.m_ip != m_ip || other.m_port != m_port; } // operator!= // ------------------------------------------------------------------------ - /** Returns a std::string representing the ip address and port in human - * readable format. - * \param show_port True if the port should be shown as well, otherwise - * only the ip address will be returned. - */ - std::string toString(bool show_port = true) const - { - std::string s = - StringUtils::insertValues("%d.%d.%d.%d", - ((m_ip >> 24) & 0xff), ((m_ip >> 16) & 0xff), - ((m_ip >> 8) & 0xff), ((m_ip >> 0) & 0xff)); - if (show_port) - s += StringUtils::insertValues(":%d", m_port); - return s; - } // toString + std::string toString(bool show_port = true) const; }; // TransportAddress #endif // TYPES_HPP diff --git a/src/online/http_request.cpp b/src/online/http_request.cpp index 808e10bfa..5fcb9d684 100644 --- a/src/online/http_request.cpp +++ b/src/online/http_request.cpp @@ -18,6 +18,7 @@ #include "config/user_config.hpp" #include "config/stk_config.hpp" +#include "io/file_manager.hpp" #include "online/request_manager.hpp" #include "utils/constants.hpp" #include "utils/translation.hpp" diff --git a/src/online/http_request.hpp b/src/online/http_request.hpp index 2b5f5ebab..3394f2de5 100644 --- a/src/online/http_request.hpp +++ b/src/online/http_request.hpp @@ -19,7 +19,6 @@ #ifndef HEADER_HTTP_REQUEST_HPP #define HEADER_HTTP_REQUEST_HPP -#include "io/file_manager.hpp" #include "online/request.hpp" #include "utils/cpp2011.hpp" #include "utils/string_utils.hpp" diff --git a/src/online/online_player_profile.cpp b/src/online/online_player_profile.cpp index 6b6514c21..a1f9b227e 100644 --- a/src/online/online_player_profile.cpp +++ b/src/online/online_player_profile.cpp @@ -26,6 +26,8 @@ #include "network/network_config.hpp" #include "online/online_profile.hpp" #include "online/profile_manager.hpp" +#include "online/request_manager.hpp" +#include "online/xml_request.hpp" #include "states_screens/main_menu_screen.hpp" #include "states_screens/online/online_profile_friends.hpp" #include "states_screens/options/user_screen.hpp" @@ -44,6 +46,25 @@ using namespace Online; namespace Online { + namespace PrivateRequest + { + // ---------------------------------------------------------------- + class SignInRequest : public XMLRequest + { + virtual void callback(); + public: + SignInRequest(bool manage_memory) + : XMLRequest(manage_memory, /*priority*/10) {} + }; // SignInRequest + + // ---------------------------------------------------------------- + class PollRequest : public XMLRequest + { + virtual void callback(); + public: + PollRequest(); + }; // PollRequest + } // ------------------------------------------------------------------------ /** Adds the login credential to a http request. It sets the name of * the script to invokce, token, and user id. @@ -94,7 +115,8 @@ namespace Online { if (m_online_state == OS_SIGNED_OUT && hasSavedSession()) { - SignInRequest *request = new SignInRequest(true); + PrivateRequest::SignInRequest *request = + new PrivateRequest::SignInRequest(true); setUserDetails(request, "saved-session"); // The userid must be taken from the saved data, @@ -118,7 +140,8 @@ namespace Online // logout stil happening. assert(m_online_state == OS_SIGNED_OUT || m_online_state == OS_SIGNING_OUT); - SignInRequest * request = new SignInRequest(true); + PrivateRequest::SignInRequest * request = + new PrivateRequest::SignInRequest(true); // We can't use setUserDetail here, since there is no token yet request->setApiURL(API::USER_PATH, "connect"); @@ -134,7 +157,7 @@ namespace Online // ------------------------------------------------------------------------ /** Called when the signin request is finished. */ - void OnlinePlayerProfile::SignInRequest::callback() + void PrivateRequest::SignInRequest::callback() { PlayerManager::getCurrentPlayer()->signIn(isSuccess(), getXMLData()); GUIEngine::Screen *screen = GUIEngine::getCurrentScreen(); @@ -149,8 +172,7 @@ namespace Online PlayerProfile *player = PlayerManager::get()->getPlayer(i); if(player != current && player->hasSavedSession() && - player->getLastOnlineName(true/*ignoreRTL*/) == - current->getLastOnlineName(true/*ignoreRTL*/)) + player->getLastOnlineName() == current->getLastOnlineName()) { player->clearSession(); } @@ -339,13 +361,14 @@ namespace Online { assert(m_online_state == OS_SIGNED_IN); - OnlinePlayerProfile::PollRequest *request = new OnlinePlayerProfile::PollRequest(); + PrivateRequest::PollRequest *request = + new PrivateRequest::PollRequest(); setUserDetails(request, "poll"); request->queue(); } // requestPoll() // ------------------------------------------------------------------------ - OnlinePlayerProfile::PollRequest::PollRequest() + PrivateRequest::PollRequest::PollRequest() : XMLRequest(true) { } // PollRequest @@ -354,7 +377,7 @@ namespace Online /** Callback for the poll request. Parses the information and spawns * notifications accordingly. */ - void OnlinePlayerProfile::PollRequest::callback() + void PrivateRequest::PollRequest::callback() { // connection error if (!isSuccess()) diff --git a/src/online/online_player_profile.hpp b/src/online/online_player_profile.hpp index 2a7b9a222..1c8ccbf2f 100644 --- a/src/online/online_player_profile.hpp +++ b/src/online/online_player_profile.hpp @@ -20,10 +20,6 @@ #define HEADER_CURRENT_ONLINE_USER_HPP #include "config/player_profile.hpp" -#include "online/http_request.hpp" -#include "online/online_profile.hpp" -#include "online/request_manager.hpp" -#include "online/xml_request.hpp" #include "utils/synchronised.hpp" #include "utils/types.hpp" @@ -38,32 +34,12 @@ namespace Online { class OnlineProfile; - // ============================================================================ - /** * \brief Class that represents an online registered user * \ingroup online */ class OnlinePlayerProfile : public PlayerProfile { - public: - // ---------------------------------------------------------------- - class SignInRequest : public XMLRequest - { - virtual void callback (); - public: - SignInRequest(bool manage_memory) - : XMLRequest(manage_memory, /*priority*/10) {} - }; // SignInRequest - - // ---------------------------------------------------------------- - class PollRequest : public XMLRequest - { - virtual void callback (); - public: - PollRequest(); - }; // PollRequest - private: std::string m_token; OnlineProfile *m_profile; diff --git a/src/online/online_profile.cpp b/src/online/online_profile.cpp index 0beea1de9..346c5066a 100644 --- a/src/online/online_profile.cpp +++ b/src/online/online_profile.cpp @@ -20,10 +20,12 @@ #include "config/player_manager.hpp" #include "config/user_config.hpp" +#include "io/xml_node.hpp" #include "online/profile_manager.hpp" #include "online/request_manager.hpp" +#include "online/xml_request.hpp" #include "utils/log.hpp" -#include "utils/translation.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/online/online_profile.hpp b/src/online/online_profile.hpp index 29fda22bc..e2b98efa3 100644 --- a/src/online/online_profile.hpp +++ b/src/online/online_profile.hpp @@ -19,16 +19,17 @@ #ifndef HEADER_ONLINE_PROFILE_HPP #define HEADER_ONLINE_PROFILE_HPP -#include "online/request_manager.hpp" -#include "online/xml_request.hpp" #include "utils/types.hpp" #include "utils/ptr_vector.hpp" +#include "irrString.h" + #include -#include #include #include +class XMLNode; + namespace Online { /** Class that represents an online profile. It manages the online profile @@ -102,7 +103,7 @@ private: bool m_has_fetched_achievements; std::vector m_achievements; - std::map m_friend_server_map; + std::map m_friend_server_map; bool m_cache_bit; void storeFriends(const XMLNode * input); @@ -123,7 +124,7 @@ public: const IDList& getAchievements(); void merge(OnlineProfile * profile); // ------------------------------------------------------------------------ - std::map& getFriendServerMap() + std::map& getFriendServerMap() { return m_friend_server_map; } // ------------------------------------------------------------------------ /** Returns true if the achievements for this profile have been fetched. */ diff --git a/src/online/request.hpp b/src/online/request.hpp index e4ccb7342..001516d7f 100644 --- a/src/online/request.hpp +++ b/src/online/request.hpp @@ -19,11 +19,9 @@ #ifndef HEADER_ONLINE_REQUEST_HPP #define HEADER_ONLINE_REQUEST_HPP -#include "io/file_manager.hpp" #include "utils/cpp2011.hpp" #include "utils/leak_check.hpp" #include "utils/no_copy.hpp" -#include "utils/string_utils.hpp" #include "utils/synchronised.hpp" #ifdef WIN32 diff --git a/src/online/request_manager.hpp b/src/online/request_manager.hpp index 8921ae9b9..1b2d1b156 100644 --- a/src/online/request_manager.hpp +++ b/src/online/request_manager.hpp @@ -21,10 +21,8 @@ #ifndef HEADER_REQUEST_MANAGER_HPP #define HEADER_REQUEST_MANAGER_HPP -#include "io/xml_node.hpp" #include "online/request.hpp" #include "utils/can_be_deleted.hpp" -#include "utils/string_utils.hpp" #include "utils/synchronised.hpp" #include diff --git a/src/online/xml_request.cpp b/src/online/xml_request.cpp index 6101bb318..6330c3554 100644 --- a/src/online/xml_request.cpp +++ b/src/online/xml_request.cpp @@ -17,8 +17,10 @@ #include "online/xml_request.hpp" #include "config/user_config.hpp" -#include "online/request_manager.hpp" +#include "io/file_manager.hpp" +#include "io/xml_node.hpp" #include "utils/constants.hpp" +#include "utils/log.hpp" #include "utils/translation.hpp" #ifdef WIN32 diff --git a/src/online/xml_request.hpp b/src/online/xml_request.hpp index 88d8cc1ac..030255f0a 100644 --- a/src/online/xml_request.hpp +++ b/src/online/xml_request.hpp @@ -19,10 +19,8 @@ #ifndef HEADER_XML_REQUEST_HPP #define HEADER_XML_REQUEST_HPP -#include "io/file_manager.hpp" #include "online/http_request.hpp" #include "utils/cpp2011.hpp" -#include "utils/string_utils.hpp" #include "utils/synchronised.hpp" #ifdef WIN32 @@ -33,6 +31,7 @@ #include #include +class XMLNode; namespace Online { diff --git a/src/race/grand_prix_data.cpp b/src/race/grand_prix_data.cpp index 90ca62cb3..99f7915c4 100644 --- a/src/race/grand_prix_data.cpp +++ b/src/race/grand_prix_data.cpp @@ -609,4 +609,18 @@ void GrandPrixData::remove(const unsigned int track) m_reversed.erase(m_reversed.begin() + track); } +// ---------------------------------------------------------------------------- +irr::core::stringw GrandPrixData::getRandomGPName() +{ + return _("Random Grand Prix"); +} + +// ---------------------------------------------------------------------------- +/** @return the (potentially translated) user-visible name of the Grand + * Prix, m_editable is true if it's custom GP name. */ +irr::core::stringw GrandPrixData::getName() const +{ + return m_editable ? m_name.c_str() : _(m_name.c_str()); +} + /* EOF */ diff --git a/src/race/grand_prix_data.hpp b/src/race/grand_prix_data.hpp index f6d650ea6..2a8d98d6c 100644 --- a/src/race/grand_prix_data.hpp +++ b/src/race/grand_prix_data.hpp @@ -24,8 +24,6 @@ #include #include -#include "utils/translation.hpp" - using irr::core::stringw; class Track; @@ -149,9 +147,7 @@ public: void remove(const unsigned int track); // ------------------------------------------------------------------------- - /** @return the (potentially translated) user-visible name of the Grand - * Prix (apply fribidi as needed) */ - irr::core::stringw getName() const { return m_editable ? m_name.c_str() : _LTR(m_name.c_str()); } + irr::core::stringw getName() const; // ------------------------------------------------------------------------- /** @return the internal indentifier of the Grand Prix (not translated) */ @@ -171,7 +167,7 @@ public: enum GPReverseType getReverseType() const { return m_reverse_type; } static const char* getRandomGPID() { return "random"; } - static irr::core::stringw getRandomGPName() { return _LTR("Random Grand Prix"); } + static irr::core::stringw getRandomGPName(); }; // GrandPrixData #endif diff --git a/src/race/race_manager.cpp b/src/race/race_manager.cpp index 7f59498d1..23ee02c1d 100644 --- a/src/race/race_manager.cpp +++ b/src/race/race_manager.cpp @@ -60,6 +60,7 @@ #include "states_screens/state_manager.hpp" #include "tracks/track_manager.hpp" #include "utils/ptr_vector.hpp" +#include "utils/string_utils.hpp" RaceManager* race_manager= NULL; @@ -1129,3 +1130,46 @@ void RaceManager::clearNetworkGrandPrixResult() m_reverse_track.clear(); } // clearNetworkGrandPrixResult + +//----------------------------------------------------------------------------- +/** Returns a (translated) name of a minor race mode. + * \param mode Minor race mode. + */ +const core::stringw RaceManager::getNameOf(const MinorRaceModeType mode) +{ + switch (mode) + { + //I18N: Game mode + case MINOR_MODE_NORMAL_RACE: return _("Normal Race"); + //I18N: Game mode + case MINOR_MODE_TIME_TRIAL: return _("Time Trial"); + //I18N: Game mode + case MINOR_MODE_FOLLOW_LEADER: return _("Follow the Leader"); + //I18N: Game mode + case MINOR_MODE_3_STRIKES: return _("3 Strikes Battle"); + //I18N: Game mode + case MINOR_MODE_FREE_FOR_ALL: return _("Free-For-All"); + //I18N: Game mode + case MINOR_MODE_CAPTURE_THE_FLAG: return _("Capture The Flag"); + //I18N: Game mode + case MINOR_MODE_EASTER_EGG: return _("Egg Hunt"); + //I18N: Game mode + case MINOR_MODE_SOCCER: return _("Soccer"); + default: assert(false); return L""; + } +} // getNameOf + +//----------------------------------------------------------------------------- +/** Returns the specified difficulty as a string. */ +core::stringw RaceManager::getDifficultyName(Difficulty diff) const +{ + switch (diff) + { + case RaceManager::DIFFICULTY_EASY: return _("Novice"); break; + case RaceManager::DIFFICULTY_MEDIUM: return _("Intermediate"); break; + case RaceManager::DIFFICULTY_HARD: return _("Expert"); break; + case RaceManager::DIFFICULTY_BEST: return _("SuperTux"); break; + default: assert(false); + } + return ""; +} // getDifficultyName diff --git a/src/race/race_manager.hpp b/src/race/race_manager.hpp index 0ead9a8cf..08a73a611 100644 --- a/src/race/race_manager.hpp +++ b/src/race/race_manager.hpp @@ -176,33 +176,7 @@ public: } // getIconOf // ------------------------------------------------------------------------ - /** Returns a (translated) name of a minor race mode. - * \param mode Minor race mode. - */ - static const core::stringw getNameOf(const MinorRaceModeType mode) - { - switch (mode) - { - //I18N: Game mode - case MINOR_MODE_NORMAL_RACE: return _("Normal Race"); - //I18N: Game mode - case MINOR_MODE_TIME_TRIAL: return _("Time Trial"); - //I18N: Game mode - case MINOR_MODE_FOLLOW_LEADER: return _("Follow the Leader"); - //I18N: Game mode - case MINOR_MODE_3_STRIKES: return _("3 Strikes Battle"); - //I18N: Game mode - case MINOR_MODE_FREE_FOR_ALL: return _("Free-For-All"); - //I18N: Game mode - case MINOR_MODE_CAPTURE_THE_FLAG: return _("Capture The Flag"); - //I18N: Game mode - case MINOR_MODE_EASTER_EGG: return _("Egg Hunt"); - //I18N: Game mode - case MINOR_MODE_SOCCER: return _("Soccer"); - default: assert(false); return L""; - } - } // getNameOf - + static const core::stringw getNameOf(const MinorRaceModeType mode); // ------------------------------------------------------------------------ /** Returns if the currently set minor game mode can be used by the AI. */ bool hasAI() @@ -601,19 +575,7 @@ public: } // getDifficultyAsString // ------------------------------------------------------------------------ - /** Returns the specified difficulty as a string. */ - core::stringw getDifficultyName(Difficulty diff) const - { - switch (diff) - { - case RaceManager::DIFFICULTY_EASY: return _("Novice"); break; - case RaceManager::DIFFICULTY_MEDIUM: return _("Intermediate"); break; - case RaceManager::DIFFICULTY_HARD: return _("Expert"); break; - case RaceManager::DIFFICULTY_BEST: return _("SuperTux"); break; - default: assert(false); - } - return ""; - } // getDifficultyName + core::stringw getDifficultyName(Difficulty diff) const; // ------------------------------------------------------------------------ const std::string& getTrackName() const { return m_tracks[m_track_number];} // ------------------------------------------------------------------------ diff --git a/src/replay/replay_play.cpp b/src/replay/replay_play.cpp index 7450b06ca..34d921a3a 100644 --- a/src/replay/replay_play.cpp +++ b/src/replay/replay_play.cpp @@ -26,6 +26,7 @@ #include "race/race_manager.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/replay/replay_recorder.cpp b/src/replay/replay_recorder.cpp index d3059649b..054d2153a 100644 --- a/src/replay/replay_recorder.cpp +++ b/src/replay/replay_recorder.cpp @@ -34,6 +34,8 @@ #include "physics/btKart.hpp" #include "race/race_manager.hpp" #include "tracks/track.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include #include diff --git a/src/scriptengine/script_gui.cpp b/src/scriptengine/script_gui.cpp index 6620ea14e..5900121e2 100644 --- a/src/scriptengine/script_gui.cpp +++ b/src/scriptengine/script_gui.cpp @@ -28,6 +28,7 @@ #include "tracks/track.hpp" #include "tracks/track_object.hpp" #include "tracks/track_object_manager.hpp" +#include "utils/string_utils.hpp" #include #include "scriptarray.hpp" diff --git a/src/scriptengine/script_track.cpp b/src/scriptengine/script_track.cpp index 006dd2e39..8d4cbba57 100644 --- a/src/scriptengine/script_track.cpp +++ b/src/scriptengine/script_track.cpp @@ -37,6 +37,7 @@ #include "tracks/track.hpp" #include "tracks/track_object.hpp" #include "tracks/track_object_manager.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/scriptengine/script_utils.cpp b/src/scriptengine/script_utils.cpp index adfd3f83a..4215f5830 100644 --- a/src/scriptengine/script_utils.cpp +++ b/src/scriptengine/script_utils.cpp @@ -29,6 +29,7 @@ #include "tracks/track.hpp" #include "tracks/track_object.hpp" #include "tracks/track_object_manager.hpp" +#include "utils/string_utils.hpp" #include diff --git a/src/states_screens/addons_screen.cpp b/src/states_screens/addons_screen.cpp index ba36bd293..080d03ba2 100644 --- a/src/states_screens/addons_screen.cpp +++ b/src/states_screens/addons_screen.cpp @@ -30,8 +30,9 @@ #include "states_screens/dialogs/addons_loading.hpp" #include "states_screens/dialogs/message_dialog.hpp" #include "states_screens/state_manager.hpp" -#include "utils/translation.hpp" +#include "utils/string_utils.hpp" #include "utils/ptr_vector.hpp" +#include "utils/translation.hpp" #include diff --git a/src/states_screens/arenas_screen.cpp b/src/states_screens/arenas_screen.cpp index 1ea35dc97..3eebd483d 100644 --- a/src/states_screens/arenas_screen.cpp +++ b/src/states_screens/arenas_screen.cpp @@ -29,6 +29,7 @@ #include "tracks/track.hpp" #include "tracks/track_manager.hpp" #include "utils/random_generator.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/states_screens/dialogs/achievement_progress_dialog.cpp b/src/states_screens/dialogs/achievement_progress_dialog.cpp index 10a9d15b5..b5d713486 100644 --- a/src/states_screens/dialogs/achievement_progress_dialog.cpp +++ b/src/states_screens/dialogs/achievement_progress_dialog.cpp @@ -26,6 +26,7 @@ #include "guiengine/widgets/list_widget.hpp" #include "guiengine/widgets/ribbon_widget.hpp" #include "states_screens/state_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/states_screens/dialogs/addons_loading.cpp b/src/states_screens/dialogs/addons_loading.cpp index 25df20243..9d868559f 100644 --- a/src/states_screens/dialogs/addons_loading.cpp +++ b/src/states_screens/dialogs/addons_loading.cpp @@ -28,6 +28,8 @@ #include "guiengine/widgets.hpp" #include "input/input_manager.hpp" #include "io/file_manager.hpp" +#include "online/request_manager.hpp" +#include "online/xml_request.hpp" #include "states_screens/addons_screen.hpp" #include "states_screens/dialogs/message_dialog.hpp" #include "states_screens/dialogs/vote_dialog.hpp" @@ -169,18 +171,18 @@ void AddonsLoading::beforeAddingWidgets() float f = ((int)(n/1024.0f/1024.0f*10.0f+0.5f))/10.0f; char s[32]; sprintf(s, "%.1f", f); - unit = _LTR("%s MB", s); + unit = _("%s MB", s); } else if(n>1024) { float f = ((int)(n/1024.0f*10.0f+0.5f))/10.0f; char s[32]; sprintf(s, "%.1f", f); - unit = _LTR("%s KB", s); + unit = _("%s KB", s); } else // Anything smaller just let it be 1 KB - unit = _LTR("%s KB", 1); + unit = _("%s KB", 1); core::stringw size = _("Size: %s", unit.c_str()); getWidget("size")->setText(size, false); #endif diff --git a/src/states_screens/dialogs/change_password_dialog.cpp b/src/states_screens/dialogs/change_password_dialog.cpp index 90c4c3e19..d1c465ae8 100644 --- a/src/states_screens/dialogs/change_password_dialog.cpp +++ b/src/states_screens/dialogs/change_password_dialog.cpp @@ -21,9 +21,10 @@ #include "config/player_manager.hpp" #include "guiengine/engine.hpp" #include "guiengine/widgets.hpp" +#include "online/xml_request.hpp" #include "states_screens/state_manager.hpp" -#include "utils/translation.hpp" #include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include #include diff --git a/src/states_screens/dialogs/custom_video_settings.cpp b/src/states_screens/dialogs/custom_video_settings.cpp index f36d87f30..dbee5c488 100644 --- a/src/states_screens/dialogs/custom_video_settings.cpp +++ b/src/states_screens/dialogs/custom_video_settings.cpp @@ -24,6 +24,8 @@ #include "utils/translation.hpp" #include "graphics/central_settings.hpp" #include "graphics/irr_driver.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include diff --git a/src/states_screens/dialogs/ghost_replay_info_dialog.cpp b/src/states_screens/dialogs/ghost_replay_info_dialog.cpp index c229b9a37..9bf1a07c2 100644 --- a/src/states_screens/dialogs/ghost_replay_info_dialog.cpp +++ b/src/states_screens/dialogs/ghost_replay_info_dialog.cpp @@ -28,6 +28,8 @@ #include "states_screens/state_manager.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" using namespace GUIEngine; using namespace irr::core; diff --git a/src/states_screens/dialogs/kart_color_slider_dialog.cpp b/src/states_screens/dialogs/kart_color_slider_dialog.cpp index 93862d38f..030299db4 100644 --- a/src/states_screens/dialogs/kart_color_slider_dialog.cpp +++ b/src/states_screens/dialogs/kart_color_slider_dialog.cpp @@ -29,6 +29,8 @@ #include "guiengine/widgets/model_view_widget.hpp" #include "guiengine/widgets/spinner_widget.hpp" #include "states_screens/state_manager.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" using namespace GUIEngine; diff --git a/src/states_screens/dialogs/message_dialog.cpp b/src/states_screens/dialogs/message_dialog.cpp index 6ec8af032..988b3b516 100644 --- a/src/states_screens/dialogs/message_dialog.cpp +++ b/src/states_screens/dialogs/message_dialog.cpp @@ -21,6 +21,7 @@ #include "guiengine/widgets/ribbon_widget.hpp" #include "modes/world.hpp" #include "states_screens/state_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" using namespace GUIEngine; diff --git a/src/states_screens/dialogs/race_paused_dialog.cpp b/src/states_screens/dialogs/race_paused_dialog.cpp index 1503e7bbd..cc7579b60 100644 --- a/src/states_screens/dialogs/race_paused_dialog.cpp +++ b/src/states_screens/dialogs/race_paused_dialog.cpp @@ -40,6 +40,7 @@ #include "states_screens/race_setup_screen.hpp" #include "states_screens/options/options_screen_general.hpp" #include "states_screens/state_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" using namespace GUIEngine; diff --git a/src/states_screens/dialogs/ranking_callback.hpp b/src/states_screens/dialogs/ranking_callback.hpp index cb082d933..23bab15ed 100644 --- a/src/states_screens/dialogs/ranking_callback.hpp +++ b/src/states_screens/dialogs/ranking_callback.hpp @@ -21,6 +21,7 @@ #include "config/player_manager.hpp" #include "guiengine/widgets/label_widget.hpp" +#include "io/xml_node.hpp" #include "online/xml_request.hpp" #include diff --git a/src/states_screens/dialogs/recovery_dialog.cpp b/src/states_screens/dialogs/recovery_dialog.cpp index ead80ea28..e19e6def5 100644 --- a/src/states_screens/dialogs/recovery_dialog.cpp +++ b/src/states_screens/dialogs/recovery_dialog.cpp @@ -20,6 +20,7 @@ #include "audio/sfx_manager.hpp" #include "config/player_manager.hpp" #include "guiengine/engine.hpp" +#include "online/xml_request.hpp" #include "states_screens/state_manager.hpp" #include "utils/translation.hpp" #include "utils/string_utils.hpp" diff --git a/src/states_screens/dialogs/select_challenge.cpp b/src/states_screens/dialogs/select_challenge.cpp index 7f30b2141..078b71793 100644 --- a/src/states_screens/dialogs/select_challenge.cpp +++ b/src/states_screens/dialogs/select_challenge.cpp @@ -35,6 +35,8 @@ #include "tracks/track_manager.hpp" #include "tracks/track.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" using namespace GUIEngine; diff --git a/src/states_screens/dialogs/server_configuration_dialog.cpp b/src/states_screens/dialogs/server_configuration_dialog.cpp index b8d7a844e..49abf209f 100644 --- a/src/states_screens/dialogs/server_configuration_dialog.cpp +++ b/src/states_screens/dialogs/server_configuration_dialog.cpp @@ -25,6 +25,8 @@ #include "network/protocols/lobby_protocol.hpp" #include "network/stk_host.hpp" #include "states_screens/state_manager.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" using namespace GUIEngine; diff --git a/src/states_screens/dialogs/splitscreen_player_dialog.cpp b/src/states_screens/dialogs/splitscreen_player_dialog.cpp index 33fa63faa..2c3b4f93d 100644 --- a/src/states_screens/dialogs/splitscreen_player_dialog.cpp +++ b/src/states_screens/dialogs/splitscreen_player_dialog.cpp @@ -31,6 +31,7 @@ #include "guiengine/widgets/spinner_widget.hpp" #include "network/network_config.hpp" #include "states_screens/online/networking_lobby.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/states_screens/dialogs/user_info_dialog.cpp b/src/states_screens/dialogs/user_info_dialog.cpp index e6cefaec8..000be59c0 100644 --- a/src/states_screens/dialogs/user_info_dialog.cpp +++ b/src/states_screens/dialogs/user_info_dialog.cpp @@ -21,10 +21,12 @@ #include "guiengine/dialog_queue.hpp" #include "guiengine/engine.hpp" #include "online/online_profile.hpp" +#include "online/xml_request.hpp" #include "states_screens/online/online_profile_achievements.hpp" #include "states_screens/online/online_profile_friends.hpp" #include "states_screens/state_manager.hpp" #include "utils/translation.hpp" +#include "utils/string_utils.hpp" #include diff --git a/src/states_screens/dialogs/vote_dialog.cpp b/src/states_screens/dialogs/vote_dialog.cpp index 697ea6c16..3e58c10fe 100644 --- a/src/states_screens/dialogs/vote_dialog.cpp +++ b/src/states_screens/dialogs/vote_dialog.cpp @@ -21,9 +21,10 @@ #include "audio/sfx_manager.hpp" #include "config/player_manager.hpp" #include "guiengine/engine.hpp" +#include "online/xml_request.hpp" #include "states_screens/state_manager.hpp" -#include "utils/translation.hpp" #include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include diff --git a/src/states_screens/easter_egg_screen.cpp b/src/states_screens/easter_egg_screen.cpp index 91f0d65bd..14753d667 100644 --- a/src/states_screens/easter_egg_screen.cpp +++ b/src/states_screens/easter_egg_screen.cpp @@ -29,6 +29,7 @@ #include "states_screens/track_info_screen.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/states_screens/edit_gp_screen.cpp b/src/states_screens/edit_gp_screen.cpp index 2603a4830..9960a4616 100644 --- a/src/states_screens/edit_gp_screen.cpp +++ b/src/states_screens/edit_gp_screen.cpp @@ -28,7 +28,8 @@ #include "states_screens/state_manager.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" - +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" using namespace GUIEngine; @@ -253,7 +254,7 @@ void EditGPScreen::loadList(const int selected) m_icons.push_back(m_icon_bank->addTextureAsSprite(screenShot)); row.push_back(GUIEngine::ListWidget::ListCell( - _LTR(m_gp->getTrackName(i).c_str()), m_icons[i], 3, false)); + _(m_gp->getTrackName(i).c_str()), m_icons[i], 3, false)); row.push_back(GUIEngine::ListWidget::ListCell( StringUtils::toWString(m_gp->getLaps(i)), -1, 1, true)); row.push_back(GUIEngine::ListWidget::ListCell( diff --git a/src/states_screens/edit_track_screen.cpp b/src/states_screens/edit_track_screen.cpp index c20014e6a..7bf2b7534 100644 --- a/src/states_screens/edit_track_screen.cpp +++ b/src/states_screens/edit_track_screen.cpp @@ -26,7 +26,8 @@ #include "states_screens/state_manager.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" - +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" using namespace GUIEngine; using namespace irr::core; diff --git a/src/states_screens/feature_unlocked.cpp b/src/states_screens/feature_unlocked.cpp index 3a63ab89a..5d36b1b53 100644 --- a/src/states_screens/feature_unlocked.cpp +++ b/src/states_screens/feature_unlocked.cpp @@ -45,6 +45,7 @@ #include "states_screens/state_manager.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/states_screens/ghost_replay_selection.cpp b/src/states_screens/ghost_replay_selection.cpp index 51193cc8e..f406a4d5f 100644 --- a/src/states_screens/ghost_replay_selection.cpp +++ b/src/states_screens/ghost_replay_selection.cpp @@ -29,6 +29,7 @@ #include "states_screens/online/tracks_screen.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" using namespace GUIEngine; diff --git a/src/states_screens/gp_info_screen.cpp b/src/states_screens/gp_info_screen.cpp index cb357938a..77915b616 100644 --- a/src/states_screens/gp_info_screen.cpp +++ b/src/states_screens/gp_info_screen.cpp @@ -37,6 +37,7 @@ #include "states_screens/state_manager.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/states_screens/grand_prix_cutscene.cpp b/src/states_screens/grand_prix_cutscene.cpp index fa47f8fb9..e04f6619f 100644 --- a/src/states_screens/grand_prix_cutscene.cpp +++ b/src/states_screens/grand_prix_cutscene.cpp @@ -25,6 +25,8 @@ #include "states_screens/grand_prix_editor_screen.hpp" #include "states_screens/dialogs/general_text_field_dialog.hpp" #include "tracks/track_manager.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include #include diff --git a/src/states_screens/grand_prix_editor_screen.cpp b/src/states_screens/grand_prix_editor_screen.cpp index 8d6f71bcd..599537d8f 100644 --- a/src/states_screens/grand_prix_editor_screen.cpp +++ b/src/states_screens/grand_prix_editor_screen.cpp @@ -31,6 +31,7 @@ #include "states_screens/dialogs/general_text_field_dialog.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" using namespace GUIEngine; diff --git a/src/states_screens/grand_prix_lose.cpp b/src/states_screens/grand_prix_lose.cpp index db9c297ee..ca86c6405 100644 --- a/src/states_screens/grand_prix_lose.cpp +++ b/src/states_screens/grand_prix_lose.cpp @@ -43,6 +43,7 @@ #include "tracks/track.hpp" #include "tracks/track_object.hpp" #include "tracks/track_object_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/states_screens/grand_prix_win.cpp b/src/states_screens/grand_prix_win.cpp index 0b052c802..424f936ff 100644 --- a/src/states_screens/grand_prix_win.cpp +++ b/src/states_screens/grand_prix_win.cpp @@ -40,6 +40,7 @@ #include "tracks/track.hpp" #include "tracks/track_object.hpp" #include "tracks/track_object_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/states_screens/kart_selection.cpp b/src/states_screens/kart_selection.cpp index 14eda9312..2d184ce4d 100644 --- a/src/states_screens/kart_selection.cpp +++ b/src/states_screens/kart_selection.cpp @@ -40,8 +40,9 @@ #include "network/network_config.hpp" #include "states_screens/race_setup_screen.hpp" #include "utils/log.hpp" -#include "utils/translation.hpp" #include "utils/random_generator.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include #include diff --git a/src/states_screens/online/create_server_screen.cpp b/src/states_screens/online/create_server_screen.cpp index 61e64f408..f5331c5a4 100644 --- a/src/states_screens/online/create_server_screen.cpp +++ b/src/states_screens/online/create_server_screen.cpp @@ -24,9 +24,11 @@ #include "network/server.hpp" #include "network/server_config.hpp" #include "network/stk_host.hpp" +#include "online/online_profile.hpp" #include "states_screens/state_manager.hpp" #include "states_screens/online/networking_lobby.hpp" #include "utils/separate_process.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include @@ -95,7 +97,7 @@ void CreateServerScreen::init() m_name_widget->setText(_("%s's server", NetworkConfig::get()->isLAN() ? PlayerManager::getCurrentPlayer()->getName() - : PlayerManager::getCurrentOnlineUserName() + : PlayerManager::getCurrentOnlineProfile()->getUserName() ) ); diff --git a/src/states_screens/online/create_server_screen.hpp b/src/states_screens/online/create_server_screen.hpp index 585527948..fbc86ca8c 100644 --- a/src/states_screens/online/create_server_screen.hpp +++ b/src/states_screens/online/create_server_screen.hpp @@ -20,7 +20,6 @@ #include "guiengine/screen.hpp" #include "guiengine/widgets.hpp" -#include "online/xml_request.hpp" namespace GUIEngine { class Widget; class ListWidget; } diff --git a/src/states_screens/online/network_kart_selection.cpp b/src/states_screens/online/network_kart_selection.cpp index d30809159..7085647a3 100644 --- a/src/states_screens/online/network_kart_selection.cpp +++ b/src/states_screens/online/network_kart_selection.cpp @@ -25,6 +25,8 @@ #include "network/stk_host.hpp" #include "states_screens/state_manager.hpp" #include "states_screens/online/tracks_screen.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" using namespace GUIEngine; diff --git a/src/states_screens/online/online_profile_base.cpp b/src/states_screens/online/online_profile_base.cpp index 1fa5f5240..8b2d3fda7 100644 --- a/src/states_screens/online/online_profile_base.cpp +++ b/src/states_screens/online/online_profile_base.cpp @@ -29,6 +29,8 @@ #include "states_screens/online/online_profile_achievements.hpp" #include "states_screens/online/online_profile_servers.hpp" #include "states_screens/online/online_profile_settings.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include #include diff --git a/src/states_screens/online/online_profile_friends.cpp b/src/states_screens/online/online_profile_friends.cpp index bf3ec7eaa..d3f12b403 100644 --- a/src/states_screens/online/online_profile_friends.cpp +++ b/src/states_screens/online/online_profile_friends.cpp @@ -24,6 +24,7 @@ #include "states_screens/dialogs/user_info_dialog.hpp" #include "states_screens/online/online_user_search.hpp" #include "states_screens/state_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/states_screens/online/online_profile_servers.cpp b/src/states_screens/online/online_profile_servers.cpp index 44844f660..a39a2ecf3 100644 --- a/src/states_screens/online/online_profile_servers.cpp +++ b/src/states_screens/online/online_profile_servers.cpp @@ -30,7 +30,6 @@ #include "states_screens/online/create_server_screen.hpp" #include "states_screens/online/networking_lobby.hpp" #include "states_screens/online/server_selection.hpp" -#include "utils/translation.hpp" #include diff --git a/src/states_screens/online/online_user_search.cpp b/src/states_screens/online/online_user_search.cpp index 259dc9120..f1b15a099 100644 --- a/src/states_screens/online/online_user_search.cpp +++ b/src/states_screens/online/online_user_search.cpp @@ -21,6 +21,7 @@ #include "config/player_manager.hpp" #include "guiengine/modaldialog.hpp" #include "online/profile_manager.hpp" +#include "online/xml_request.hpp" #include "states_screens/dialogs/user_info_dialog.hpp" #include "states_screens/dialogs/message_dialog.hpp" #include "states_screens/state_manager.hpp" diff --git a/src/states_screens/online/online_user_search.hpp b/src/states_screens/online/online_user_search.hpp index 6dd1c3d44..34002cab8 100644 --- a/src/states_screens/online/online_user_search.hpp +++ b/src/states_screens/online/online_user_search.hpp @@ -21,11 +21,12 @@ #include "guiengine/screen.hpp" #include "guiengine/widgets.hpp" #include "online/online_profile.hpp" -#include "online/request.hpp" #include "utils/ptr_vector.hpp" namespace GUIEngine { class Widget; } +namespace Online { class XMLRequest; } + /** * \brief * \ingroup diff --git a/src/states_screens/online/register_screen.cpp b/src/states_screens/online/register_screen.cpp index 5afde6c1a..71fb4fbd6 100644 --- a/src/states_screens/online/register_screen.cpp +++ b/src/states_screens/online/register_screen.cpp @@ -26,6 +26,7 @@ #include "guiengine/widgets/ribbon_widget.hpp" #include "guiengine/widgets/text_box_widget.hpp" #include "online/link_helper.hpp" +#include "online/request_manager.hpp" #include "online/xml_request.hpp" #include "states_screens/dialogs/registration_dialog.hpp" #include "states_screens/dialogs/message_dialog.hpp" @@ -84,7 +85,7 @@ void RegisterScreen::init() stringw username = ""; if(m_existing_player) { - username = m_existing_player->getName(true/*ignoreRTL*/); + username = m_existing_player->getName(); } else if (PlayerManager::get()->getNumPlayers() == 0) { diff --git a/src/states_screens/online/tracks_screen.cpp b/src/states_screens/online/tracks_screen.cpp index 0391a88ab..4ce96d4dc 100644 --- a/src/states_screens/online/tracks_screen.cpp +++ b/src/states_screens/online/tracks_screen.cpp @@ -43,6 +43,7 @@ #include "states_screens/track_info_screen.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/states_screens/options/options_screen_device.cpp b/src/states_screens/options/options_screen_device.cpp index ce6f7cc13..05034b7cc 100644 --- a/src/states_screens/options/options_screen_device.cpp +++ b/src/states_screens/options/options_screen_device.cpp @@ -39,6 +39,7 @@ #include "states_screens/options/options_screen_ui.hpp" #include "states_screens/state_manager.hpp" #include "states_screens/options/user_screen.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/states_screens/options/options_screen_video.cpp b/src/states_screens/options/options_screen_video.cpp index 44c0f35e5..a3880059f 100644 --- a/src/states_screens/options/options_screen_video.cpp +++ b/src/states_screens/options/options_screen_video.cpp @@ -456,22 +456,22 @@ void OptionsScreenVideo::updateTooltip() //I18N: in the graphical options tooltip; // indicates a graphical feature is enabled - const core::stringw enabled = _LTR("Enabled"); + const core::stringw enabled = _("Enabled"); //I18N: in the graphical options tooltip; // indicates a graphical feature is disabled - const core::stringw disabled = _LTR("Disabled"); + const core::stringw disabled = _("Disabled"); //I18N: if only important particles effects is enabled - const core::stringw important_only = _LTR("Important only"); + const core::stringw important_only = _("Important only"); //I18N: in the graphical options tooltip; // indicates the rendered image quality is very low - const core::stringw very_low = _LTR("Very Low"); + const core::stringw very_low = _("Very Low"); //I18N: in the graphical options tooltip; // indicates the rendered image quality is low - const core::stringw low = _LTR("Low"); + const core::stringw low = _("Low"); //I18N: in the graphical options tooltip; // indicates the rendered image quality is high - const core::stringw high = _LTR("High"); + const core::stringw high = _("High"); //I18N: in graphical options tooltip = _("Particles Effects: %s", diff --git a/src/states_screens/options/user_screen.cpp b/src/states_screens/options/user_screen.cpp index 85aa64291..fa5ae1a1c 100644 --- a/src/states_screens/options/user_screen.cpp +++ b/src/states_screens/options/user_screen.cpp @@ -43,7 +43,8 @@ #include "states_screens/options/options_screen_video.hpp" #include "states_screens/online/register_screen.hpp" #include "states_screens/state_manager.hpp" - +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" using namespace GUIEngine; @@ -238,7 +239,7 @@ void BaseUserScreen::selectUser(int index) focus_it); if (!m_new_registered_data) - m_username_tb->setText(profile->getLastOnlineName(true/*ignoreRTL*/)); + m_username_tb->setText(profile->getLastOnlineName()); if (!m_new_registered_data) { @@ -497,9 +498,9 @@ void BaseUserScreen::login() // a different online account, log out the current player. if(current && current->isLoggedIn() && (player!=current || - current->getLastOnlineName(true/*ignoreRTL*/)!=new_username) ) + current->getLastOnlineName()!=new_username) ) { - m_sign_out_name = current->getLastOnlineName(true/*ignoreRTL*/); + m_sign_out_name = current->getLastOnlineName(); current->requestSignOut(); m_state = (UserScreenState)(m_state | STATE_LOGOUT); @@ -507,7 +508,7 @@ void BaseUserScreen::login() // for this user (otherwise later the saved session will be // resumed, not logging the user with the new account). if(player==current && - current->getLastOnlineName(true/*ignoreRTL*/)!=new_username) + current->getLastOnlineName()!=new_username) current->clearSession(); } PlayerManager::get()->setCurrentPlayer(player); @@ -519,7 +520,7 @@ void BaseUserScreen::login() { if(player->isLoggedIn()) { - m_sign_out_name =player->getLastOnlineName(true/*ignoreRTL*/); + m_sign_out_name =player->getLastOnlineName(); player->requestSignOut(); m_state =(UserScreenState)(m_state| STATE_LOGOUT); } @@ -546,7 +547,7 @@ void BaseUserScreen::login() // can decide what to do about them. if (player->hasSavedSession()) { - m_sign_in_name = player->getLastOnlineName(true/*ignoreRTL*/); + m_sign_in_name = player->getLastOnlineName(); // Online login with saved token player->requestSavedSession(); } @@ -666,7 +667,7 @@ void BaseUserScreen::deletePlayer() PlayerProfile *player = getSelectedPlayer(); irr::core::stringw message = //I18N: In the player info dialog (when deleting) - _("Do you really want to delete player '%s'?", player->getName(true/*ignoreRTL*/)); + _("Do you really want to delete player '%s'?", player->getName()); class ConfirmServer : public MessageDialog::IConfirmDialogListener { diff --git a/src/states_screens/race_gui_base.cpp b/src/states_screens/race_gui_base.cpp index 7d9a05eee..49b91c695 100644 --- a/src/states_screens/race_gui_base.cpp +++ b/src/states_screens/race_gui_base.cpp @@ -48,6 +48,8 @@ #include "states_screens/race_gui_multitouch.hpp" #include "tracks/track.hpp" #include "utils/constants.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" #include diff --git a/src/states_screens/race_setup_screen.cpp b/src/states_screens/race_setup_screen.cpp index 5fdcd3bf3..093fe07bd 100644 --- a/src/states_screens/race_setup_screen.cpp +++ b/src/states_screens/race_setup_screen.cpp @@ -32,6 +32,7 @@ #include "states_screens/soccer_setup_screen.hpp" #include "states_screens/state_manager.hpp" #include "states_screens/tracks_and_gp_screen.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" const int CONFIG_CODE_NORMAL = 0; diff --git a/src/states_screens/tracks_and_gp_screen.cpp b/src/states_screens/tracks_and_gp_screen.cpp index 55f003806..29fdfc870 100644 --- a/src/states_screens/tracks_and_gp_screen.cpp +++ b/src/states_screens/tracks_and_gp_screen.cpp @@ -32,6 +32,7 @@ #include "states_screens/gp_info_screen.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" +#include "utils/string_utils.hpp" #include "utils/translation.hpp" #include diff --git a/src/tracks/drive_graph.cpp b/src/tracks/drive_graph.cpp index e46e768e2..76763d789 100644 --- a/src/tracks/drive_graph.cpp +++ b/src/tracks/drive_graph.cpp @@ -29,6 +29,7 @@ #include "tracks/check_manager.hpp" #include "tracks/drive_node.hpp" #include "tracks/track.hpp" +#include "utils/string_utils.hpp" // ---------------------------------------------------------------------------- /** Constructor, loads the graph information for a given set of quads diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index adc98dac6..fe1cbbf8b 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -209,11 +209,10 @@ bool Track::operator<(const Track &other) const } // operator< //----------------------------------------------------------------------------- -/** Returns the name of the track, which is e.g. displayed on the screen. - \note this is the LTR name, invoke fribidi as needed. */ +/** Returns the name of the track, which is e.g. displayed on the screen. */ core::stringw Track::getName() const { - core::stringw translated = _LTR(m_name.c_str()); + core::stringw translated = _(m_name.c_str()); int index = translated.find("|"); if(index>-1) { diff --git a/src/tracks/track.hpp b/src/tracks/track.hpp index 4739402c3..f5c5cafb8 100644 --- a/src/tracks/track.hpp +++ b/src/tracks/track.hpp @@ -432,7 +432,9 @@ public: void reset(); void itemCommand(const XMLNode *node); Vec3 flagCommand(const XMLNode *node); - core::stringw getName() const; + //----------------------------------------------------------------------------- + core::stringw getName() const; + //----------------------------------------------------------------------------- core::stringw getSortName() const; bool isInGroup(const std::string &group_name); const core::vector3df& getSunRotation(); diff --git a/src/tracks/track_object.cpp b/src/tracks/track_object.cpp index 651147592..d85cddcf7 100644 --- a/src/tracks/track_object.cpp +++ b/src/tracks/track_object.cpp @@ -37,6 +37,7 @@ #include "scriptengine/script_engine.hpp" #include "tracks/track.hpp" #include "tracks/model_definition_loader.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/tracks/track_object_presentation.cpp b/src/tracks/track_object_presentation.cpp index 865f5eb83..c8587255f 100644 --- a/src/tracks/track_object_presentation.cpp +++ b/src/tracks/track_object_presentation.cpp @@ -49,6 +49,7 @@ #include "tracks/track.hpp" #include "tracks/track_manager.hpp" #include "tracks/track_object_manager.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/utils/debug.cpp b/src/utils/debug.cpp index 476e2af5c..1d8de8f3a 100644 --- a/src/utils/debug.cpp +++ b/src/utils/debug.cpp @@ -57,6 +57,7 @@ #include "utils/constants.hpp" #include "utils/log.hpp" #include "utils/profiler.hpp" +#include "utils/string_utils.hpp" #include #include diff --git a/src/utils/translation.cpp b/src/utils/translation.cpp index 1f8b87b16..e948cfdd1 100644 --- a/src/utils/translation.cpp +++ b/src/utils/translation.cpp @@ -45,6 +45,7 @@ #include "io/file_manager.hpp" #include "utils/constants.hpp" #include "utils/log.hpp" +#include "utils/string_utils.hpp" #ifdef ANDROID #include "main_android.hpp" diff --git a/src/utils/translation.hpp b/src/utils/translation.hpp index 59623653f..0ed36f754 100644 --- a/src/utils/translation.hpp +++ b/src/utils/translation.hpp @@ -27,7 +27,6 @@ #include #include -#include "utils/string_utils.hpp" #ifndef SERVER_ONLY #include "tinygettext/tinygettext.hpp" #endif