From ba3497bb81f69a70a45f8e8f2d09f9913143a00d Mon Sep 17 00:00:00 2001 From: hiker Date: Mon, 25 Jul 2016 17:45:24 +1000 Subject: [PATCH 01/39] Properly set the camera type in the constructor (which previously was always 'CM_TYPE_NORMAL'). Fixes #2576. --- src/graphics/camera.cpp | 8 +++++--- src/graphics/camera.hpp | 4 ++-- src/graphics/camera_debug.cpp | 2 +- src/graphics/camera_end.cpp | 2 +- src/graphics/camera_fps.cpp | 2 +- src/graphics/camera_normal.cpp | 13 +++++++++++-- src/graphics/camera_normal.hpp | 3 ++- 7 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/graphics/camera.cpp b/src/graphics/camera.cpp index 3e6073eb0..e374c282b 100644 --- a/src/graphics/camera.cpp +++ b/src/graphics/camera.cpp @@ -73,7 +73,8 @@ Camera* Camera::createCamera(unsigned int index, CameraType type, Camera *camera = NULL; switch (type) { - case CM_TYPE_NORMAL: camera = new CameraNormal(index, kart); break; + case CM_TYPE_NORMAL: camera = new CameraNormal(CM_TYPE_NORMAL, index, kart); + break; case CM_TYPE_DEBUG: camera = new CameraDebug (index, kart); break; case CM_TYPE_FPS: camera = new CameraFPS (index, kart); break; case CM_TYPE_END: camera = new CameraEnd (index, kart); break; @@ -112,10 +113,11 @@ void Camera::resetAllCameras() } // resetAllCameras // ---------------------------------------------------------------------------- -Camera::Camera(int camera_index, AbstractKart* kart) : m_kart(NULL) +Camera::Camera(CameraType type, int camera_index, AbstractKart* kart) + : m_kart(NULL) { m_mode = CM_NORMAL; - m_type = CameraType::CM_TYPE_NORMAL; + m_type = type; m_index = camera_index; m_original_kart = kart; m_camera = irr_driver->addCameraSceneNode(); diff --git a/src/graphics/camera.hpp b/src/graphics/camera.hpp index 502918ef0..27f117557 100644 --- a/src/graphics/camera.hpp +++ b/src/graphics/camera.hpp @@ -126,9 +126,9 @@ protected: AbstractKart *m_kart; static Camera* createCamera(unsigned int index, CameraType type, - AbstractKart* kart); + AbstractKart* kart); - Camera(int camera_index, AbstractKart* kart); + Camera(CameraType type, int camera_index, AbstractKart* kart); virtual ~Camera(); virtual void reset(); public: diff --git a/src/graphics/camera_debug.cpp b/src/graphics/camera_debug.cpp index ea0009b35..6069a6be7 100644 --- a/src/graphics/camera_debug.cpp +++ b/src/graphics/camera_debug.cpp @@ -32,7 +32,7 @@ CameraDebug::CameraDebugType CameraDebug::m_default_debug_Type = // ============================================================================ CameraDebug::CameraDebug(int camera_index, AbstractKart* kart) - : CameraNormal(camera_index, kart) + : CameraNormal(Camera::CM_TYPE_DEBUG, camera_index, kart) { reset(); } // Camera diff --git a/src/graphics/camera_end.cpp b/src/graphics/camera_end.cpp index d5f868747..971daaa79 100644 --- a/src/graphics/camera_end.cpp +++ b/src/graphics/camera_end.cpp @@ -27,7 +27,7 @@ AlignedArray CameraEnd::m_end_cameras; // ============================================================================ CameraEnd::CameraEnd(int camera_index, AbstractKart* kart) - : CameraNormal(camera_index, kart) + : CameraNormal(Camera::CM_TYPE_END, camera_index, kart) { reset(); if(m_end_cameras.size()>0) diff --git a/src/graphics/camera_fps.cpp b/src/graphics/camera_fps.cpp index 477e17d90..f66278a60 100644 --- a/src/graphics/camera_fps.cpp +++ b/src/graphics/camera_fps.cpp @@ -30,7 +30,7 @@ using namespace irr; // ============================================================================ CameraFPS::CameraFPS(int camera_index, AbstractKart* kart) - : Camera(camera_index, kart) + : Camera(Camera::CM_TYPE_FPS, camera_index, kart) { m_attached = false; diff --git a/src/graphics/camera_normal.cpp b/src/graphics/camera_normal.cpp index cc5231bb2..ea0bf098a 100644 --- a/src/graphics/camera_normal.cpp +++ b/src/graphics/camera_normal.cpp @@ -28,8 +28,17 @@ #include "tracks/track.hpp" // ============================================================================ -CameraNormal::CameraNormal(int camera_index, AbstractKart* kart) - : Camera(camera_index, kart) +/** Constructor for the normal camera. This is the only camera constructor + * except for the base class that takes a camera type as parameter. This is + * because debug and end camera use the normal camera as their base class. + * \param type The type of the camera that is created (can be CM_TYPE_END + * or CM_TYPE_DEBUG). + * \param camera_index Index of this camera. + * \param Kart Pointer to the kart for which this camera is used. + */ +CameraNormal::CameraNormal(Camera::CameraType type, int camera_index, + AbstractKart* kart) + : Camera(type, camera_index, kart) { m_distance = kart ? kart->getKartProperties()->getCameraDistance() : 1000.0f; m_ambient_light = World::getWorld()->getTrack()->getDefaultAmbientColor(); diff --git a/src/graphics/camera_normal.hpp b/src/graphics/camera_normal.hpp index 24edea3bc..742b3aeae 100644 --- a/src/graphics/camera_normal.hpp +++ b/src/graphics/camera_normal.hpp @@ -61,7 +61,8 @@ private: friend class Camera; friend class CameraDebug; friend class CameraEnd; - CameraNormal(int camera_index, AbstractKart* kart); + CameraNormal(Camera::CameraType type, int camera_index, + AbstractKart* kart); virtual ~CameraNormal() {} public: bool isDebug() { return false; } From f69d04edd36e3a7e4b7d04c4adc21f10b8815bef Mon Sep 17 00:00:00 2001 From: hiker Date: Wed, 27 Jul 2016 00:40:44 +1000 Subject: [PATCH 02/39] Fixed STUN protocol (#fixed #2566). --- src/network/protocols/get_public_address.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/network/protocols/get_public_address.cpp b/src/network/protocols/get_public_address.cpp index 213cf60df..955c16589 100644 --- a/src/network/protocols/get_public_address.cpp +++ b/src/network/protocols/get_public_address.cpp @@ -90,7 +90,7 @@ void GetPublicAddress::createStunRequest() m_transaction_host = new Network(1, 1, 0, 0); // Assemble the message for the stun server - BareNetworkString s(21); + BareNetworkString s(20); // bytes 0-1: the type of the message // bytes 2-3: message length added to header (attributes) @@ -105,8 +105,6 @@ void GetPublicAddress::createStunRequest() s.addUInt8(random_byte); m_stun_tansaction_id[i] = random_byte; } - s.addChar(0); - m_transaction_host->sendRawPacket(s, TransportAddress(m_stun_server_ip, @@ -140,7 +138,7 @@ std::string GetPublicAddress::parseStunResponse() return "STUN response contains no data at all"; // Convert to network string. - NetworkString datas((uint8_t*)buffer, len); + BareNetworkString datas(buffer, len); // check that the stun response is a response, contains the magic cookie // and the transaction ID From 0db2a195b67c72783842be47866679fe658282f5 Mon Sep 17 00:00:00 2001 From: hiker Date: Wed, 27 Jul 2016 07:54:54 +1000 Subject: [PATCH 03/39] Fixed compiler warning. --- src/states_screens/race_result_gui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index ccfc81c25..714f2987c 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -1420,7 +1420,7 @@ void RaceResultGUI::backToLobby() if (race_manager->modeHasLaps()) { core::stringw laps = _("Laps: %i", race_manager->getNumLaps()); - current_y += m_distance_between_rows * 0.8f * 2; + current_y += int(m_distance_between_rows * 0.8f * 2); GUIEngine::getFont()->draw(laps, core::recti(x, current_y, 0, 0), white_color, false, false, nullptr, true); } @@ -1428,7 +1428,7 @@ void RaceResultGUI::backToLobby() const core::stringw& difficulty_name = race_manager->getDifficultyName(race_manager->getDifficulty()); core::stringw difficulty_string = _("Difficulty: %s", difficulty_name); - current_y += m_distance_between_rows * 0.8f; + current_y += int(m_distance_between_rows * 0.8f); GUIEngine::getFont()->draw(difficulty_string, core::recti(x, current_y, 0, 0), white_color, false, false, nullptr, true); // show fastest lap @@ -1437,7 +1437,7 @@ void RaceResultGUI::backToLobby() float best_lap_time = static_cast(World::getWorld())->getFastestLap(); core::stringw best_lap_string = _("Best lap time: %s", StringUtils::timeToString(best_lap_time).c_str()); - current_y += m_distance_between_rows * 0.8f; + current_y += int(m_distance_between_rows * 0.8f); GUIEngine::getFont()->draw(best_lap_string, core::recti(x, current_y, 0, 0), white_color, false, false, nullptr, true); From 6d0ad4a4fed9e7259c313acfa997a98db252b67f Mon Sep 17 00:00:00 2001 From: hiker Date: Wed, 27 Jul 2016 08:26:41 +1000 Subject: [PATCH 04/39] Fixed compiler warning. --- src/tinygettext/po_parser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tinygettext/po_parser.cpp b/src/tinygettext/po_parser.cpp index 1920dd934..0831c2417 100644 --- a/src/tinygettext/po_parser.cpp +++ b/src/tinygettext/po_parser.cpp @@ -338,9 +338,9 @@ POParser::parse() // skip UTF-8 intro that some text editors produce // see http://en.wikipedia.org/wiki/Byte-order_mark if (current_line.size() >= 3 && - current_line[0] == static_cast(0xef) && - current_line[1] == static_cast(0xbb) && - current_line[2] == static_cast(0xbf)) + current_line[0] == static_cast(0xef) && + current_line[1] == static_cast(0xbb) && + current_line[2] == static_cast(0xbf)) { current_line = current_line.substr(3); } From bc5e2f3e29e544862091e36478b4bad93ac1cebe Mon Sep 17 00:00:00 2001 From: Benau Date: Wed, 27 Jul 2016 11:48:38 +0800 Subject: [PATCH 05/39] Add unit testing for fonts for translation --- src/font/font_manager.cpp | 55 +++++++++++++++++++++++++++++++++++++++ src/font/font_manager.hpp | 2 ++ src/main.cpp | 3 +++ 3 files changed, 60 insertions(+) diff --git a/src/font/font_manager.cpp b/src/font/font_manager.cpp index df237fb0b..82de84b3c 100644 --- a/src/font/font_manager.cpp +++ b/src/font/font_manager.cpp @@ -23,6 +23,8 @@ #include "font/digit_face.hpp" #include "font/face_ttf.hpp" #include "font/regular_face.hpp" +#include "utils/string_utils.hpp" +#include "utils/translation.hpp" FontManager *font_manager = NULL; // ---------------------------------------------------------------------------- @@ -77,3 +79,56 @@ void FontManager::checkFTError(FT_Error err, const std::string& desc) const Log::error("FontManager", "Something wrong when %s!", desc.c_str()); } } // checkFTError + +// ---------------------------------------------------------------------------- +void FontManager::unitTesting() +{ + std::vector list = *(translations->getLanguageList()); + const int cur_log_level = Log::getLogLevel(); + for (const std::string& lang : list) + { + // Hide gettext warning + Log::setLogLevel(5); + delete translations; +#ifdef WIN32 + std::string s=std::string("LANGUAGE=") + lang.c_str(); + _putenv(s.c_str()); +#else + setenv("LANGUAGE", lang.c_str(), 1); +#endif + translations = new Translations(); + Log::setLogLevel(cur_log_level); + std::set used_chars = translations->getCurrentAllChar(); + for (const wchar_t& c : used_chars) + { + // Skip non-printing characters + if (c < 32) continue; + + unsigned int font_number = 0; + unsigned int glyph_index = 0; + while (font_number < m_normal_ttf->getTotalFaces()) + { + glyph_index = + FT_Get_Char_Index(m_normal_ttf->getFace(font_number), c); + if (glyph_index > 0) break; + font_number++; + } + if (glyph_index > 0) + { + Log::debug("UnitTest", "Character %s in language %s" + " use face %s", + StringUtils::wideToUtf8(core::stringw(&c, 1)).c_str(), + lang.c_str(), + m_normal_ttf->getFace(font_number)->family_name); + } + else + { + Log::warn("UnitTest", "Character %s in language %s" + " is not supported by all fonts!", + StringUtils::wideToUtf8(core::stringw(&c, 1)).c_str(), + lang.c_str()); + } + } + } + +} // unitTesting diff --git a/src/font/font_manager.hpp b/src/font/font_manager.hpp index aae90c0f3..f46249944 100644 --- a/src/font/font_manager.hpp +++ b/src/font/font_manager.hpp @@ -76,6 +76,8 @@ public: // ------------------------------------------------------------------------ void loadFonts(); // ------------------------------------------------------------------------ + void unitTesting(); + // ------------------------------------------------------------------------ FT_Library getFTLibrary() const { return m_ft_library; } }; // FontManager diff --git a/src/main.cpp b/src/main.cpp index 39efb33b1..a3100dc51 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1887,6 +1887,9 @@ void runUnitTests() Log::info("UnitTest", "Battle Graph"); BattleGraph::unitTesting(); + Log::info("UnitTest", "Fonts for translation"); + font_manager->unitTesting(); + Log::info("UnitTest", "====================="); Log::info("UnitTest", "Testing successful "); Log::info("UnitTest", "====================="); From 6ca0eed28f0bbd544d9119e09b8e0e61edb7f406 Mon Sep 17 00:00:00 2001 From: hiker Date: Wed, 27 Jul 2016 17:34:59 +1000 Subject: [PATCH 06/39] Added debug option to trigger a kart explosion in debug mode. --- src/utils/debug.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils/debug.cpp b/src/utils/debug.cpp index 8c3fae93d..7cd03a8c8 100644 --- a/src/utils/debug.cpp +++ b/src/utils/debug.cpp @@ -24,6 +24,7 @@ #include "font/regular_face.hpp" #include "graphics/camera_debug.hpp" #include "graphics/camera_fps.hpp" +#include "karts/explosion_animation.hpp" #include "graphics/irr_driver.hpp" #include "graphics/light.hpp" #include "graphics/shaders.hpp" @@ -99,6 +100,7 @@ enum DebugMenuCommand DEBUG_ATTACHMENT_PARACHUTE, DEBUG_ATTACHMENT_BOMB, DEBUG_ATTACHMENT_ANVIL, + DEBUG_ATTACHMENT_EXPLOSION, DEBUG_GUI_TOGGLE, DEBUG_GUI_HIDE_KARTS, DEBUG_GUI_CAM_FREE, @@ -409,6 +411,13 @@ bool handleContextMenuAction(s32 cmd_id) case DEBUG_ATTACHMENT_PARACHUTE: addAttachment(Attachment::ATTACH_PARACHUTE); break; + case DEBUG_ATTACHMENT_EXPLOSION: + for (unsigned int i = 0; i < race_manager->getNumLocalPlayers(); i++) + { + AbstractKart* kart = world->getLocalPlayerKart(i); + ExplosionAnimation::create(kart, kart->getXYZ(), true); + } + break; case DEBUG_GUI_TOGGLE: { if (!world) return false; @@ -685,6 +694,7 @@ bool onEvent(const SEvent &event) sub->addItem(L"Bomb", DEBUG_ATTACHMENT_BOMB); sub->addItem(L"Anvil", DEBUG_ATTACHMENT_ANVIL); sub->addItem(L"Parachute", DEBUG_ATTACHMENT_PARACHUTE); + sub->addItem(L"Explosion", DEBUG_ATTACHMENT_EXPLOSION); mnu->addItem(L"GUI >",-1,true, true); sub = mnu->getSubMenu(3); From 277a4b9262d354985f54ba73d5e87ae77d21ff60 Mon Sep 17 00:00:00 2001 From: qwertychouskie Date: Wed, 27 Jul 2016 15:31:39 -0700 Subject: [PATCH 07/39] Fix #2542. Also update copyright year. (#2585) * Fix #2542. Also update copyright year. * Update header --- src/config/user_config.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config/user_config.cpp b/src/config/user_config.cpp index 40554f8b8..60df0436e 100644 --- a/src/config/user_config.cpp +++ b/src/config/user_config.cpp @@ -1,7 +1,7 @@ // -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2006-2015 SuperTuxKart-Team -// Modelled after Supertux's configfile.cpp +// SuperTuxKart - A racing game +// Copyright (C) 2006-2016 SuperTuxKart Team +// Modeled after Supertux's configfile.cpp // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -683,8 +683,8 @@ bool UserConfig::loadConfig() XMLNode* root = file_manager->createXMLTree(filename); if(!root || root->getName() != "stkconfig") { - Log::error("UserConfig", - "Could not read user config file '%s'.", filename.c_str()); + Log::info("UserConfig", + "Could not read user config file '%s'. A new file will be created.", filename.c_str()); if(root) delete root; // Create a default config file - just in case that stk crashes later // there is a config file that can be modified (to e.g. disable From 83117fe6492e2a6e2688362780d0f8969c25b969 Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 28 Jul 2016 09:47:56 +1000 Subject: [PATCH 08/39] Fixed wheel position in case of a rescue: if the suspension of a wheel is stretched at the time a rescue or explosion is triggered, the wheel will appear to be very far away from the kart (not connected anymore). --- src/karts/abstract_kart_animation.cpp | 7 +++++++ src/karts/kart_model.cpp | 14 ++++++++++++++ src/karts/kart_model.hpp | 1 + 3 files changed, 22 insertions(+) diff --git a/src/karts/abstract_kart_animation.cpp b/src/karts/abstract_kart_animation.cpp index f51e28f84..5a10b9374 100644 --- a/src/karts/abstract_kart_animation.cpp +++ b/src/karts/abstract_kart_animation.cpp @@ -20,6 +20,7 @@ #include "graphics/slip_stream.hpp" #include "karts/abstract_kart.hpp" +#include "karts/kart_model.hpp" #include "karts/skidding.hpp" #include "modes/world.hpp" #include "physics/physics.hpp" @@ -55,6 +56,12 @@ AbstractKartAnimation::AbstractKartAnimation(AbstractKart *kart, // A time of 0 reset the squashing kart->setSquash(0.0f, 0.0f); } + + // Reset the wheels (and any other animation played for that kart) + // This avoid the effect that some wheels might be way below the kart + // which is very obvious in the rescue animation. + m_kart->getKartModel()->resetVisualWheelPosition(); + } // AbstractKartAnimation // ---------------------------------------------------------------------------- diff --git a/src/karts/kart_model.cpp b/src/karts/kart_model.cpp index a47fe4a27..ab0a04424 100644 --- a/src/karts/kart_model.cpp +++ b/src/karts/kart_model.cpp @@ -982,6 +982,20 @@ void KartModel::update(float dt, float distance, float steer, float speed, m_animated_node->setCurrentFrame(frame); } // update +//----------------------------------------------------------------------------- +/** Called when a kart is rescued to reset all visual wheels to their default + * position to avoid that some wheels look too far away from the kart (which + * is not that visible while a kart is driving). + */ +void KartModel::resetVisualWheelPosition() +{ + for(unsigned int i=0; i<4; i++) + { + m_kart->getVehicle()->getWheelInfo(i).m_raycastInfo.m_suspensionLength = + m_default_physics_suspension[i]; + } // for i < 4 +} // resetVisualSuspension + //----------------------------------------------------------------------------- void KartModel::attachHat() { diff --git a/src/karts/kart_model.hpp b/src/karts/kart_model.hpp index be90d9cc4..2e2b537b5 100644 --- a/src/karts/kart_model.hpp +++ b/src/karts/kart_model.hpp @@ -249,6 +249,7 @@ public: float current_lean_angle, int gt_replay_index = -1); void finishedRace(); + void resetVisualWheelPosition(); scene::ISceneNode* attachModel(bool animatedModels, bool always_animated); // ------------------------------------------------------------------------ From 611e70ac83188a2788e893d5a275f8859fd6b54d Mon Sep 17 00:00:00 2001 From: qwertychouskie Date: Thu, 28 Jul 2016 16:24:42 -0700 Subject: [PATCH 09/39] Show boost at startup (#2586) * Show boost at startup * Fix https://github.com/supertuxkart/stk-code/pull/2586#issuecomment-235765919 --- src/karts/kart.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 802a9e19c..602c1d284 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1,7 +1,7 @@ // -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2004-2015 Steve Baker -// Copyright (C) 2006-2015 SuperTuxKart-Team, Joerg Henrichs, Steve Baker +// SuperTuxKart - A racing game +// Copyright (C) 2004-2016 Steve Baker +// Copyright (C) 2006-2016 SuperTuxKart Team, Joerg Henrichs, Steve Baker // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -2110,6 +2110,7 @@ void Kart::updatePhysics(float dt) { m_has_started = true; float f = getStartupBoost(); + if(f >= 0.0f) m_kart_gfx->setCreationRateAbsolute(KartGFX::KGFX_ZIPPER, 100*f); m_max_speed->instantSpeedIncrease(MaxSpeed::MS_INCREASE_ZIPPER, 0.9f*f, f, /*engine_force*/200.0f, From 8f7d47d3c384b84321746f29727a6ae65554f88e Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 29 Jul 2016 09:53:37 +1000 Subject: [PATCH 10/39] Fix ball-track collision (which should also improve kart-track collision). --- src/physics/triangle_mesh.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/physics/triangle_mesh.cpp b/src/physics/triangle_mesh.cpp index d0d0f4617..2c410dad9 100644 --- a/src/physics/triangle_mesh.cpp +++ b/src/physics/triangle_mesh.cpp @@ -188,6 +188,7 @@ void TriangleMesh::createPhysicalBody(btCollisionObject::CollisionFlags flags, m_motion_state = new btDefaultMotionState(startTransform); btRigidBody::btRigidBodyConstructionInfo info(0.0f, m_motion_state, m_collision_shape); + info.m_restitution = 1.0f; m_body=new btRigidBody(info); World::getWorld()->getPhysics()->addBody(m_body); From 637e468f1807c1bef2bf666a88520b7c5e893a43 Mon Sep 17 00:00:00 2001 From: Benau Date: Fri, 29 Jul 2016 11:50:37 +0800 Subject: [PATCH 11/39] Use uniform copyright header for source --- src/config/user_config.cpp | 4 ++-- src/karts/kart.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config/user_config.cpp b/src/config/user_config.cpp index 60df0436e..95f013d91 100644 --- a/src/config/user_config.cpp +++ b/src/config/user_config.cpp @@ -1,6 +1,6 @@ // -// SuperTuxKart - A racing game -// Copyright (C) 2006-2016 SuperTuxKart Team +// SuperTuxKart - a fun racing game with go-kart +// Copyright (C) 2006-2016 SuperTuxKart-Team // Modeled after Supertux's configfile.cpp // // This program is free software; you can redistribute it and/or diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 602c1d284..c6cdc9feb 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1,7 +1,7 @@ // -// SuperTuxKart - A racing game +// SuperTuxKart - a fun racing game with go-kart // Copyright (C) 2004-2016 Steve Baker -// Copyright (C) 2006-2016 SuperTuxKart Team, Joerg Henrichs, Steve Baker +// Copyright (C) 2006-2016 SuperTuxKart-Team, Joerg Henrichs, Steve Baker // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License From a318e3b2167d6280993aad4143fb1769b06d3913 Mon Sep 17 00:00:00 2001 From: "auria.mg" Date: Sat, 30 Jul 2016 19:43:48 -0400 Subject: [PATCH 12/39] Log out user when deactivating internet connection, fixes #2589 --- src/states_screens/options_screen_ui.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/states_screens/options_screen_ui.cpp b/src/states_screens/options_screen_ui.cpp index 771c62064..b7302f412 100644 --- a/src/states_screens/options_screen_ui.cpp +++ b/src/states_screens/options_screen_ui.cpp @@ -21,6 +21,7 @@ #include "audio/sfx_manager.hpp" #include "audio/sfx_base.hpp" #include "config/hardware_stats.hpp" +#include "config/player_manager.hpp" #include "config/user_config.hpp" #include "font/bold_face.hpp" #include "font/regular_face.hpp" @@ -284,8 +285,10 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con { stats->setVisible(false); stats_label->setVisible(false); + PlayerProfile* profile = PlayerManager::getCurrentPlayer(); + if (profile != NULL && profile->isLoggedIn()) + profile->requestSignOut(); } - } else if (name=="enable-hw-report") { From 347f977ea782fafea14aa62886ed72a1dc8fafbf Mon Sep 17 00:00:00 2001 From: "auria.mg" Date: Sat, 30 Jul 2016 19:44:21 -0400 Subject: [PATCH 13/39] Fix english string, as reported a while ago but couldn't fix then due to string freeze --- src/states_screens/race_setup_screen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/states_screens/race_setup_screen.cpp b/src/states_screens/race_setup_screen.cpp index 50c811446..fe51c8dbc 100644 --- a/src/states_screens/race_setup_screen.cpp +++ b/src/states_screens/race_setup_screen.cpp @@ -116,7 +116,7 @@ void RaceSetupScreen::init() irr::core::stringw name5 = irr::core::stringw( RaceManager::getNameOf(RaceManager::MINOR_MODE_SOCCER)) + L"\n"; - name5 += _("Push the ball to the opposite cage to score goals."); + name5 += _("Push the ball into the opposite cage to score goals."); w2->addItem( name5, IDENT_SOCCER, RaceManager::getIconOf(RaceManager::MINOR_MODE_SOCCER)); #define ENABLE_EASTER_EGG_MODE From b69faff13d939729f0158912e14f227ad2f10198 Mon Sep 17 00:00:00 2001 From: "auria.mg" Date: Sat, 30 Jul 2016 19:46:15 -0400 Subject: [PATCH 14/39] Fix indentation (tabs/spaces) --- src/states_screens/options_screen_ui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/states_screens/options_screen_ui.cpp b/src/states_screens/options_screen_ui.cpp index b7302f412..4332e896d 100644 --- a/src/states_screens/options_screen_ui.cpp +++ b/src/states_screens/options_screen_ui.cpp @@ -285,9 +285,9 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con { stats->setVisible(false); stats_label->setVisible(false); - PlayerProfile* profile = PlayerManager::getCurrentPlayer(); - if (profile != NULL && profile->isLoggedIn()) - profile->requestSignOut(); + PlayerProfile* profile = PlayerManager::getCurrentPlayer(); + if (profile != NULL && profile->isLoggedIn()) + profile->requestSignOut(); } } else if (name=="enable-hw-report") From 788f168c7f65b9ad09f5a62864f569360529ea61 Mon Sep 17 00:00:00 2001 From: Benau Date: Sun, 31 Jul 2016 08:04:16 +0800 Subject: [PATCH 15/39] Fix space before colon --- src/challenges/challenge_data.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/challenges/challenge_data.cpp b/src/challenges/challenge_data.cpp index bc3fa8742..7cfb08eb4 100644 --- a/src/challenges/challenge_data.cpp +++ b/src/challenges/challenge_data.cpp @@ -256,7 +256,7 @@ ChallengeData::ChallengeData(const std::string& filename) if (track_node != NULL && m_minor!=RaceManager::MINOR_MODE_FOLLOW_LEADER) { //I18N: number of laps to race in a challenge - description += _("Laps : %i", m_num_laps); + description += _("Laps: %i", m_num_laps); description += core::stringw(L"\n"); } else if (track_node) From 40ab343922131d57d5fa640365e8c16dc02589fc Mon Sep 17 00:00:00 2001 From: "auria.mg" Date: Sat, 30 Jul 2016 20:52:32 -0400 Subject: [PATCH 16/39] Fix string remaining in wrong language when changing language --- src/challenges/challenge_data.cpp | 37 ++++++++++++++--------- src/challenges/challenge_data.hpp | 7 +---- src/states_screens/race_gui_overworld.cpp | 9 +++++- src/states_screens/race_gui_overworld.hpp | 5 +++ 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/src/challenges/challenge_data.cpp b/src/challenges/challenge_data.cpp index bc3fa8742..f1fdc2f27 100644 --- a/src/challenges/challenge_data.cpp +++ b/src/challenges/challenge_data.cpp @@ -251,23 +251,30 @@ ChallengeData::ChallengeData(const std::string& filename) throw std::runtime_error("Unknown unlock entry"); } } - - core::stringw description; - if (track_node != NULL && m_minor!=RaceManager::MINOR_MODE_FOLLOW_LEADER) - { - //I18N: number of laps to race in a challenge - description += _("Laps : %i", m_num_laps); - description += core::stringw(L"\n"); - } - else if (track_node) - { - // Follow the leader mode: - description = _("Follow the leader"); - } - - m_challenge_description = description; } // ChallengeData +// ---------------------------------------------------------------------------- + +const irr::core::stringw ChallengeData::getChallengeDescription() const +{ + core::stringw description; + if (!m_track_id.empty()) + { + if (m_minor != RaceManager::MINOR_MODE_FOLLOW_LEADER) + { + //I18N: number of laps to race in a challenge + description += _("Laps: %i", m_num_laps); + description += core::stringw(L"\n"); + } + else + { + // Follow the leader mode: + description = _("Follow the leader"); + } + } + return description; +} // getChallengeDescription + // ---------------------------------------------------------------------------- void ChallengeData::error(const char *id) const { diff --git a/src/challenges/challenge_data.hpp b/src/challenges/challenge_data.hpp index f563695fb..0cebc4556 100644 --- a/src/challenges/challenge_data.hpp +++ b/src/challenges/challenge_data.hpp @@ -110,8 +110,6 @@ private: /** Number of trophies required to access this challenge */ int m_num_trophies; - irr::core::stringw m_challenge_description; - public: ChallengeData(const std::string& filename); @@ -195,10 +193,7 @@ public: // ------------------------------------------------------------------------ /** Returns the description of this challenge. */ - const irr::core::stringw& getChallengeDescription() const - { - return m_challenge_description; - } // getChallengeDescription + const irr::core::stringw getChallengeDescription() const; // ------------------------------------------------------------------------ /** Returns the minimum position the player must have in order to win. diff --git a/src/states_screens/race_gui_overworld.cpp b/src/states_screens/race_gui_overworld.cpp index 761836652..abc03fdb1 100644 --- a/src/states_screens/race_gui_overworld.cpp +++ b/src/states_screens/race_gui_overworld.cpp @@ -108,6 +108,7 @@ RaceGUIOverworld::RaceGUIOverworld() m_string_lap = _("Lap"); m_string_rank = _("Rank"); + m_active_challenge = NULL; // Determine maximum length of the rank/lap text, in order to // align those texts properly on the right side of the viewport. @@ -528,7 +529,13 @@ void RaceGUIOverworld::drawGlobalMiniMap() pos.UpperLeftCorner.Y += GUIEngine::getTitleFontHeight(); pos.LowerRightCorner.Y = irr_driver->getActualScreenSize().Height; - GUIEngine::getFont()->draw(challenge->getChallengeDescription().c_str(), + + if (m_active_challenge != challenge) + { + m_active_challenge = challenge; + m_challenge_description = challenge->getChallengeDescription(); + } + GUIEngine::getFont()->draw(m_challenge_description, pos, video::SColor(255,255,255,255), false, false /* vcenter */, NULL); diff --git a/src/states_screens/race_gui_overworld.hpp b/src/states_screens/race_gui_overworld.hpp index 810f2baec..56d72823b 100644 --- a/src/states_screens/race_gui_overworld.hpp +++ b/src/states_screens/race_gui_overworld.hpp @@ -101,6 +101,11 @@ private: int m_trophy_points_width; + /** The latest challenge approached by the kart */ + const ChallengeData* m_active_challenge; + + core::stringw m_challenge_description; + /** The current challenge over which the mouse is hovering. */ const OverworldChallenge *m_current_challenge; From 690440254750a9e98a3f0d56c421689c69c3d3a1 Mon Sep 17 00:00:00 2001 From: Benau Date: Sun, 31 Jul 2016 09:04:10 +0800 Subject: [PATCH 17/39] Fix wrong RTL text in arena screen --- src/states_screens/arenas_screen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/states_screens/arenas_screen.cpp b/src/states_screens/arenas_screen.cpp index 999a3babc..24d90ee93 100644 --- a/src/states_screens/arenas_screen.cpp +++ b/src/states_screens/arenas_screen.cpp @@ -277,7 +277,7 @@ void ArenasScreen::buildTrackList() } else { - w->addItem( curr->getName(), curr->getIdent(), curr->getScreenshotFile(), 0, + w->addItem( translations->fribidize(curr->getName()), curr->getIdent(), curr->getScreenshotFile(), 0, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE ); } } @@ -329,7 +329,7 @@ void ArenasScreen::buildTrackList() } else { - w->addItem( curr->getName(), curr->getIdent(), curr->getScreenshotFile(), 0, + w->addItem( translations->fribidize(curr->getName()), curr->getIdent(), curr->getScreenshotFile(), 0, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE ); } } From ea939459e8769e847222de130a5d31bf1c9bf128 Mon Sep 17 00:00:00 2001 From: "auria.mg" Date: Sat, 30 Jul 2016 21:51:31 -0400 Subject: [PATCH 18/39] Improve string as suggested on transifex --- data/gui/options_players.stkgui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/gui/options_players.stkgui b/data/gui/options_players.stkgui index 286b0971b..5c8de774c 100644 --- a/data/gui/options_players.stkgui +++ b/data/gui/options_players.stkgui @@ -30,7 +30,7 @@