[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#991335: unblock: supertuxkart (pre-approval)



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Dear release team,

this is a request for pre-approval of a supertuxkart upload.

The upstream tarball of supertuxkart 1.2+ds-2 currently includes data
files that are not free (#990368). Additionaly the d/copyright file is
lacking license information for a few additional resources (only data files).

To fix this bug, the two non-free karts will get removed from the upstream
tarball. But as removal of these files would cause a regression in online
multiplayer games, upstream provided two patches (+1 patch that fixes a
memory leak in one of these patches) that keep network compatibility with
other players intact.

Additionaly I'm currently in contact with an upstream contributor who is
investigating the remaining copyright/license issues.
To fix them, the plan is to amend d/copyright where possible
(investigations are currently ongoing), or to replace unknown/non-free files
with free alternatives.

I noticed that supertuxkart is marked for autoremoval on August 3rd
currently, which is probably after the bullseye release.
Does this mean supertuxkart 1.2+ds-2 will be part of bullseye and can
then still be fixed by a stable-proposed-update? Or does the upload
and migration to bullseye have to happen before July 31st?

Below is the full list of files that would get removed from the upstream
tarball:

data/karts/beastie/beastie-icon.png
data/karts/beastie/beastie.spm
data/karts/beastie/beastie_kart_colorizationMask.png
data/karts/beastie/beastie_kart_diffuse.png
data/karts/beastie/beastie_kart_gloss.png
data/karts/beastie/beastie_kart_leftDoor.png
data/karts/beastie/beastie_kart_leftDoor_colorizationMask.png
data/karts/beastie/beastie_kart_leftDoor_gloss.png
data/karts/beastie/beastie_n_kart_wheel_colorizationMask.png
data/karts/beastie/beastie_n_kart_wheel_diffuse.png
data/karts/beastie/beastie_n_kart_wheel_gloss.png
data/karts/beastie/beastie_shadow.png
data/karts/beastie/beastie_texture.png
data/karts/hexley/hexley.spm
data/karts/hexley/hexley_dashboard_diffuse.png
data/karts/hexley/hexley_dashboard_gloss.png
data/karts/hexley/hexley_diffuse.png
data/karts/hexley/hexley_gloss.png
data/karts/hexley/hexley_kart_Normal.png
data/karts/hexley/hexley_kart_colorizationMask.png
data/karts/hexley/hexley_kart_diffuse.png
data/karts/hexley/hexley_kart_frontGlass.png
data/karts/hexley/hexley_kart_gloss.png
data/karts/hexley/hexley_shadow.png
data/karts/hexley/hexley_wheel_Normal.png
data/karts/hexley/hexley_wheel_colorizationMask.png
data/karts/hexley/hexley_wheel_diffuse.png
data/karts/hexley/hexley_wheel_gloss.png
data/karts/hexley/hexley_window.png
data/karts/hexley/hexleyicon.png
data/karts/hexley/hexleyicon32.png

Attached are the mentioned upstream patches.

Kind regards,
  Reiner
From 851290d4c866130abb22ee61114016378af4cb45 Mon Sep 17 00:00:00 2001
From: Benau <Benau@users.noreply.github.com>
Date: Sun, 18 Jul 2021 00:49:49 +0800
Subject: [PATCH] Add code to generate official karts list

---
 data/official_karts.xml      |  21 ++++++
 sources.cmake                |   2 +-
 src/karts/official_karts.cpp | 128 +++++++++++++++++++++++++++++++++++
 src/karts/official_karts.hpp |  20 ++++++
 src/main.cpp                 |   9 +++
 5 files changed, 179 insertions(+), 1 deletion(-)
 create mode 100644 data/official_karts.xml
 create mode 100644 src/karts/official_karts.cpp
 create mode 100644 src/karts/official_karts.hpp

diff --git a/data/official_karts.xml b/data/official_karts.xml
new file mode 100644
index 00000000000..671aadf369e
--- /dev/null
+++ b/data/official_karts.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<karts>
+    <kart name="adiumy" type="medium" width="0.852" height="0.775" length="0.943" gravity-shift="0 0.2829 0"/>
+    <kart name="amanda" type="heavy" width="1.119" height="0.764" length="1.476" gravity-shift="0 0.382 0"/>
+    <kart name="beastie" type="heavy" width="0.837" height="0.847" length="1.49" gravity-shift="0 0.4235 0"/>
+    <kart name="emule" type="medium" width="0.625" height="0.735" length="1.146" gravity-shift="0 0.3438 0"/>
+    <kart name="gavroche" type="medium" width="0.77" height="0.614" length="1.272" gravity-shift="0 0.307 0"/>
+    <kart name="gnu" type="medium" width="0.77" height="0.949" length="1.345" gravity-shift="0 0.4035 0"/>
+    <kart name="hexley" type="light" width="0.611" height="0.858" length="1.608" gravity-shift="0 0.429 0"/>
+    <kart name="kiki" type="light" width="0.866" height="0.974" length="1.227" gravity-shift="0 0.3681 0"/>
+    <kart name="konqi" type="medium" width="0.931" height="0.857" length="1.588" gravity-shift="0 0.4285 0"/>
+    <kart name="nolok" type="medium" width="0.725" height="0.645" length="1.413" gravity-shift="0 0.3225 0"/>
+    <kart name="pidgin" type="heavy" width="0.781" height="0.627" length="1.243" gravity-shift="0 0.3135 0"/>
+    <kart name="puffy" type="heavy" width="1.109" height="0.621" length="1.573" gravity-shift="0 0.3105 0"/>
+    <kart name="sara_the_racer" type="light" width="0.459" height="0.989" length="1.152" gravity-shift="0 0.3456 0"/>
+    <kart name="sara_the_wizard" type="medium" width="0.5" height="0.959" length="1.22" gravity-shift="0 0.366 0"/>
+    <kart name="suzanne" type="medium" width="0.935" height="0.645" length="1.405" gravity-shift="0 0.3225 0"/>
+    <kart name="tux" type="medium" width="0.821" height="0.675" length="1.437" gravity-shift="0 0.3375 0"/>
+    <kart name="wilber" type="light" width="0.837" height="0.871" length="1.715" gravity-shift="0 0.4355 0"/>
+    <kart name="xue" type="medium" width="1.006" height="0.944" length="1.446" gravity-shift="0 0.4338 0"/>
+</karts>
diff --git a/sources.cmake b/sources.cmake
index d4f28ae4de4..ba4868d717e 100644
--- a/sources.cmake
+++ b/sources.cmake
@@ -1,5 +1,5 @@
 # Modify this file to change the last-modified date when you add/remove a file.
-# This will then trigger a new cmake run automatically.
+# This will then trigger a new cmake run automatically. 
 file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
 file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
 file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")
diff --git a/src/karts/official_karts.cpp b/src/karts/official_karts.cpp
new file mode 100644
index 00000000000..c8d7b9f38b7
--- /dev/null
+++ b/src/karts/official_karts.cpp
@@ -0,0 +1,128 @@
+#include "karts/official_karts.hpp"
+
+#include "karts/kart_properties_manager.hpp"
+#include "io/file_manager.hpp"
+#include "io/xml_node.hpp"
+#include "karts/kart_model.hpp"
+#include "karts/kart_properties.hpp"
+#include "utils/file_utils.hpp"
+#include "utils/log.hpp"
+#include "utils/vec3.hpp"
+
+#include <cassert>
+#include <fstream>
+#include <sstream>
+#include <vector>
+
+namespace OfficialKarts
+{
+// ============================================================================
+struct OfficialKart
+{
+std::string name;
+std::string type;
+float width;
+float height;
+float length;
+Vec3 gravity_shift;
+OfficialKart(const std::string& n, const std::string& t, float w, float h,
+             float l, const Vec3& g) : name(n), type(t), width(w), height(h),
+             length(l), gravity_shift(g) {}
+};   // OfficialKart
+std::vector<OfficialKart> g_official_karts;
+
+// ----------------------------------------------------------------------------
+void dumpOfficialKarts()
+{
+    std::stringstream ss;
+    ss << "<?xml version=\"1.0\"?>\n";
+    ss << "<karts>\n";
+    for (unsigned i = 0; i < kart_properties_manager->getNumberOfKarts(); i++)
+    {
+        const KartProperties* kp = kart_properties_manager->getKartById(i);
+        if (kp->isAddon())
+            continue;
+        auto km = kp->getKartModelCopy();
+        ss << "    <kart name=\"" << kp->getIdent() << "\" type=\"" <<
+            kp->getKartType() << "\" width=\"" << km->getWidth() <<
+            "\" height=\"" << km->getHeight() << "\" length=\"" <<
+            km->getLength() << "\" gravity-shift=\"" <<
+            kp->getGravityCenterShift().x() << " " <<
+            kp->getGravityCenterShift().y() << " " <<
+            kp->getGravityCenterShift().z() << "\"/>\n";
+    }
+    ss << "</karts>\n";
+    std::string s = ss.str();
+    std::ofstream xml("official_karts.xml", std::ofstream::out);
+    xml << ss.rdbuf();
+    xml.close();
+}   // getAllData
+
+// ----------------------------------------------------------------------------
+void load()
+{
+    const std::string file_name = file_manager->getAsset("official_karts.xml");
+    if (file_name.empty())
+        Log::fatal("OfficialKarts", "Missing official_karts.xml");
+    const XMLNode *root = file_manager->createXMLTree(file_name);
+    assert(root);
+    for (unsigned int i = 0; i < root->getNumNodes(); i++)
+    {
+        const XMLNode *node = root->getNode(i);
+        std::string name;
+        std::string type;
+        float width = 0.0f;
+        float height = 0.0f;
+        float length = 0.0f;
+        Vec3 gravity_shift;
+        node->get("name", &name);
+        node->get("type", &type);
+        node->get("width", &width);
+        node->get("height", &height);
+        node->get("length", &length);
+        node->get("gravity-shift", &gravity_shift);
+        g_official_karts.emplace_back(name, type, width, height, length,
+            gravity_shift);
+    }
+}   // load
+
+// ----------------------------------------------------------------------------
+std::set<std::string> getOfficialKarts()
+{
+    std::set<std::string> result;
+    for (OfficialKart& ok : g_official_karts)
+        result.insert(ok.name);
+    return result;
+}   // getOfficialKarts
+
+// ----------------------------------------------------------------------------
+const KartProperties* getKartByIdent(const std::string& ident,
+                                     float* width, float* height,
+                                     float* length, Vec3* gravity_shift)
+{
+    for (OfficialKart& ok : g_official_karts)
+    {
+        if (ok.name == ident)
+        {
+            for (unsigned i = 0;
+                i < kart_properties_manager->getNumberOfKarts(); i++)
+            {
+                const KartProperties* kp =
+                    kart_properties_manager->getKartById(i);
+                if (kp->isAddon())
+                    continue;
+                if (kp->getKartType() == ok.type)
+                {
+                    *width = ok.width;
+                    *height = ok.height;
+                    *length = ok.length;
+                    *gravity_shift = ok.gravity_shift;
+                    return kp;
+                }
+            }
+        }
+    }
+    return NULL;
+}   // getKartByIdent
+
+}   // OfficialKarts
diff --git a/src/karts/official_karts.hpp b/src/karts/official_karts.hpp
new file mode 100644
index 00000000000..399b82f83ae
--- /dev/null
+++ b/src/karts/official_karts.hpp
@@ -0,0 +1,20 @@
+#ifndef HEADER_OFFICIAL_KARTS_HPP
+#define HEADER_OFFICIAL_KARTS_HPP
+
+#include <string>
+#include <set>
+
+class KartProperties;
+class Vec3;
+
+namespace OfficialKarts
+{
+void dumpOfficialKarts();
+void load();
+std::set<std::string> getOfficialKarts();
+const KartProperties* getKartByIdent(const std::string& ident,
+                                     float* width, float* height,
+                                     float* length, Vec3* gravity_shift);
+}
+
+#endif
diff --git a/src/main.cpp b/src/main.cpp
index ea709d3bed0..9b8ba266099 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -220,6 +220,7 @@
 #include "karts/kart_model.hpp"
 #include "karts/kart_properties.hpp"
 #include "karts/kart_properties_manager.hpp"
+#include "karts/official_karts.hpp"
 #include "modes/cutscene_world.hpp"
 #include "modes/demo_world.hpp"
 #include "network/protocols/connect_to_server.hpp"
@@ -661,6 +662,7 @@ void cmdLineHelp()
     "                           Takes precedence over trilinear or bilinear\n"
     "                           texture filtering.\n"
     "       --shadows=n         Set resolution of shadows (0 to disable).\n"
+    "       --dump-official-karts Dump official karts for current stk-assets.\n"
     "       --apitrace          This will disable buffer storage and\n"
     "                           writing gpu query strings to opengl, which\n"
     "                           can be seen later in apitrace.\n"
@@ -1660,6 +1662,12 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
     CommandLine::has("-psn");
 #endif
 
+    if (CommandLine::has("--dump-official-karts"))
+    {
+        OfficialKarts::dumpOfficialKarts();
+        return 0;
+    }
+
     CommandLine::reportInvalidParameters();
 
     if (ProfileWorld::isProfileMode() || GUIEngine::isNoGraphics())
@@ -2093,6 +2101,7 @@ int main(int argc, char *argv[])
         GUIEngine::addLoadingIcon( irr_driver->getTexture(FileManager::GUI_ICON,
                                                           "options_video.png"));
         kart_properties_manager -> loadAllKarts    ();
+        OfficialKarts::load();
         handleXmasMode();
         handleEasterEarMode();
 
From cae38e862a1dbc1486283f551ee023e6c2255085 Mon Sep 17 00:00:00 2001
From: Benau <Benau@users.noreply.github.com>
Date: Sun, 18 Jul 2021 00:50:03 +0800
Subject: [PATCH] Avoid network incompatibility if players add or remove
 official karts

---
 src/karts/abstract_kart.cpp            | 28 +++++++++++++++++++++----
 src/karts/kart_properties.cpp          | 10 ++-------
 src/karts/kart_properties.hpp          | 24 ++++++++++++++-------
 src/network/protocols/client_lobby.cpp | 17 ++++++++++++---
 src/network/protocols/server_lobby.cpp | 29 +++++++++++++-------------
 5 files changed, 70 insertions(+), 38 deletions(-)

diff --git a/src/karts/abstract_kart.cpp b/src/karts/abstract_kart.cpp
index bee9c647435..2c7e41e966d 100644
--- a/src/karts/abstract_kart.cpp
+++ b/src/karts/abstract_kart.cpp
@@ -26,9 +26,11 @@
 #include "karts/kart_model.hpp"
 #include "karts/kart_properties.hpp"
 #include "karts/kart_properties_manager.hpp"
+#include "karts/official_karts.hpp"
 #include "network/network_config.hpp"
 #include "physics/physics.hpp"
 #include "utils/log.hpp"
+#include "utils/string_utils.hpp"
 
 /** Creates a kart.
  *  \param ident The identifier of the kart.
@@ -81,6 +83,8 @@ void AbstractKart::loadKartProperties(const std::string& new_ident,
     m_kart_properties.reset(new KartProperties());
     const KartProperties* kp = kart_properties_manager->getKart(new_ident);
     const KartProperties* kp_addon = NULL;
+    const KartProperties* official_kp = NULL;
+    Vec3 gravity_shift;
     if (NetworkConfig::get()->isNetworking() &&
         NetworkConfig::get()->useTuxHitboxAddon() && kp && kp->isAddon())
     {
@@ -92,17 +96,30 @@ void AbstractKart::loadKartProperties(const std::string& new_ident,
     }
     if (kp == NULL)
     {
+        bool official_kart = !StringUtils::startsWith(new_ident, "addon_");
         if (!NetworkConfig::get()->isNetworking() ||
-            !NetworkConfig::get()->useTuxHitboxAddon())
+            (!NetworkConfig::get()->useTuxHitboxAddon() && !official_kart))
         {
             Log::warn("Abstract_Kart", "Unknown kart %s, fallback to tux",
                 new_ident.c_str());
         }
         kp = kart_properties_manager->getKart(std::string("tux"));
+        if (NetworkConfig::get()->isNetworking() && official_kart)
+        {
+            official_kp = OfficialKarts::getKartByIdent(new_ident,
+                &m_kart_width, &m_kart_height, &m_kart_length, &gravity_shift);
+            if (official_kp)
+                kp = official_kp;
+        }
     }
     m_kart_properties->copyForPlayer(kp, handicap);
     if (kp_addon)
         m_kart_properties->adjustForOnlineAddonKart(kp_addon);
+    if (official_kp)
+    {
+        m_kart_properties->updateForOnlineKart(new_ident, gravity_shift,
+            m_kart_length);
+    }
     m_name = m_kart_properties->getName();
     m_handicap = handicap;
     m_kart_animation  = NULL;
@@ -119,9 +136,12 @@ void AbstractKart::loadKartProperties(const std::string& new_ident,
         m_kart_model.reset(kp_addon->getKartModelCopy(ri));
     else
         m_kart_model.reset(m_kart_properties->getKartModelCopy(ri));
-    m_kart_width  = kp->getMasterKartModel().getWidth();
-    m_kart_height = kp->getMasterKartModel().getHeight();
-    m_kart_length = kp->getMasterKartModel().getLength();
+    if (official_kp == NULL)
+    {
+        m_kart_width  = kp->getMasterKartModel().getWidth();
+        m_kart_height = kp->getMasterKartModel().getHeight();
+        m_kart_length = kp->getMasterKartModel().getLength();
+    }
     m_kart_highest_point = m_kart_model->getHighestPoint();
     m_wheel_graphics_position = m_kart_model->getWheelsGraphicsPosition();
 }   // loadKartProperties
diff --git a/src/karts/kart_properties.cpp b/src/karts/kart_properties.cpp
index d81330254da..933c94c789c 100644
--- a/src/karts/kart_properties.cpp
+++ b/src/karts/kart_properties.cpp
@@ -86,7 +86,7 @@ KartProperties::KartProperties(const std::string &filename)
     // if everything is defined properly.
     m_wheel_base = m_friction_slip = m_collision_terrain_impulse =
         m_collision_impulse = m_collision_impulse_time =
-        m_max_lean = m_lean_speed = m_physical_wheel_position = UNDEFINED;
+        m_physical_wheel_position = UNDEFINED;
 
     m_terrain_impulse_type       = IMPULSE_NONE;
     m_gravity_center_shift       = Vec3(UNDEFINED);
@@ -310,13 +310,7 @@ void KartProperties::load(const std::string &filename, const std::string &node)
         m_gravity_center_shift.setZ(0);
     }
 
-    // The longer the kart,the bigger its turn radius if using an identical
-    // wheel base, exactly proportionally to its length.
-    // The wheel base is used to compensate this
-    // We divide by 1.425 to have a default turn radius which conforms
-    // closely (+-0,1%) with the specifications in kart_characteristics.xml
-    m_wheel_base = fabsf(m_kart_model->getLength()/1.425f);
-
+    setWheelBase(m_kart_model->getLength());
     m_shadow_material = material_manager->getMaterialSPM(m_shadow_file, "",
         "alphablend");
 
diff --git a/src/karts/kart_properties.hpp b/src/karts/kart_properties.hpp
index 92778f3ad2f..b97a6e36e61 100644
--- a/src/karts/kart_properties.hpp
+++ b/src/karts/kart_properties.hpp
@@ -159,14 +159,6 @@ class KartProperties
     /** Wheel base of the kart. */
     float       m_wheel_base;
 
-    /** The maximum roll a kart graphics should show when driving in a fast
-     *  curve. This is read in as degrees, but stored in radians. */
-     float      m_max_lean;
-
-     /** The speed with which the roll (when leaning in a curve) changes
-      *  (in radians/second). */
-     float      m_lean_speed;
-
     /** Engine sound effect. */
     std::string m_engine_sfx_type;
 
@@ -206,6 +198,15 @@ class KartProperties
                              const std::string &node);
     void combineCharacteristics(HandicapLevel h);
 
+    void setWheelBase(float kart_length)
+    {
+        // The longer the kart,the bigger its turn radius if using an identical
+        // wheel base, exactly proportionally to its length.
+        // The wheel base is used to compensate this
+        // We divide by 1.425 to have a default turn radius which conforms
+        // closely (+-0,1%) with the specifications in kart_characteristics.xml
+        m_wheel_base = fabsf(kart_length / 1.425f);
+    }
 public:
     /** Returns the string representation of a handicap level. */
     static std::string      getHandicapAsString(HandicapLevel h);
@@ -215,6 +216,13 @@ class KartProperties
     void  copyForPlayer     (const KartProperties *source,
                              HandicapLevel h = HANDICAP_NONE);
     void  adjustForOnlineAddonKart(const KartProperties* source);
+    void  updateForOnlineKart(const std::string& id, const Vec3& gravity_shift,
+                              float kart_length)
+    {
+        m_ident = id;
+        m_gravity_center_shift = gravity_shift;
+        setWheelBase(kart_length);
+    }
     void  copyFrom          (const KartProperties *source);
     void  getAllData        (const XMLNode * root);
     void  checkAllSet       (const std::string &filename);
diff --git a/src/network/protocols/client_lobby.cpp b/src/network/protocols/client_lobby.cpp
index e686dd4f496..42ef94ec847 100644
--- a/src/network/protocols/client_lobby.cpp
+++ b/src/network/protocols/client_lobby.cpp
@@ -36,6 +36,7 @@
 #include "karts/controller/controller.hpp"
 #include "karts/kart_properties.hpp"
 #include "karts/kart_properties_manager.hpp"
+#include "karts/official_karts.hpp"
 #include "modes/linear_world.hpp"
 #include "network/crypto.hpp"
 #include "network/event.hpp"
@@ -1737,10 +1738,20 @@ void ClientLobby::handleClientCommand(const std::string& cmd)
 // ----------------------------------------------------------------------------
 void ClientLobby::getKartsTracksNetworkString(BareNetworkString* ns)
 {
-    auto all_k = kart_properties_manager->getAllAvailableKarts();
+    std::vector<std::string> all_k;
+    for (unsigned i = 0; i < kart_properties_manager->getNumberOfKarts(); i++)
+    {
+        const KartProperties* kp = kart_properties_manager->getKartById(i);
+        if (kp->isAddon())
+            all_k.push_back(kp->getIdent());
+    }
+    std::set<std::string> oks = OfficialKarts::getOfficialKarts();
+    if (all_k.size() >= 65536 - (unsigned)oks.size())
+        all_k.resize(65535 - (unsigned)oks.size());
+    for (const std::string& k : oks)
+        all_k.push_back(k);
+
     auto all_t = track_manager->getAllTrackIdentifiers();
-    if (all_k.size() >= 65536)
-        all_k.resize(65535);
     if (all_t.size() >= 65536)
         all_t.resize(65535);
     ns->addUInt16((uint16_t)all_k.size()).addUInt16((uint16_t)all_t.size());
diff --git a/src/network/protocols/server_lobby.cpp b/src/network/protocols/server_lobby.cpp
index 2d55ce81f25..b81ade8d0a4 100644
--- a/src/network/protocols/server_lobby.cpp
+++ b/src/network/protocols/server_lobby.cpp
@@ -26,6 +26,7 @@
 #include "karts/controller/player_controller.hpp"
 #include "karts/kart_properties.hpp"
 #include "karts/kart_properties_manager.hpp"
+#include "karts/official_karts.hpp"
 #include "modes/capture_the_flag.hpp"
 #include "modes/linear_world.hpp"
 #include "network/crypto.hpp"
@@ -172,8 +173,6 @@ ServerLobby::ServerLobby() : LobbyProtocol()
 {
     m_client_server_host_id.store(0);
     m_lobby_players.store(0);
-    std::vector<int> all_k =
-        kart_properties_manager->getKartsInGroup("standard");
     std::vector<int> all_t =
         track_manager->getTracksInGroup("standard");
     std::vector<int> all_arenas =
@@ -183,16 +182,7 @@ ServerLobby::ServerLobby() : LobbyProtocol()
     all_t.insert(all_t.end(), all_arenas.begin(), all_arenas.end());
     all_t.insert(all_t.end(), all_soccers.begin(), all_soccers.end());
 
-    for (int kart : all_k)
-    {
-        const KartProperties* kp = kart_properties_manager->getKartById(kart);
-        // Some distro put kart itself, ignore it online for the rest of stk
-        // user
-        if (kp->getIdent() == "geeko")
-            continue;
-        if (!kp->isAddon())
-            m_official_kts.first.insert(kp->getIdent());
-    }
+    m_official_kts.first = OfficialKarts::getOfficialKarts();
     for (int track : all_t)
     {
         Track* t = track_manager->getTrack(track);
@@ -579,9 +569,18 @@ void ServerLobby::updateAddons()
             m_addon_kts.second.insert(t->getIdent());
     }
 
-    auto all_k = kart_properties_manager->getAllAvailableKarts();
-    if (all_k.size() >= 65536)
-        all_k.resize(65535);
+    std::vector<std::string> all_k;
+    for (unsigned i = 0; i < kart_properties_manager->getNumberOfKarts(); i++)
+    {
+        const KartProperties* kp = kart_properties_manager->getKartById(i);
+        if (kp->isAddon())
+            all_k.push_back(kp->getIdent());
+    }
+    std::set<std::string> oks = OfficialKarts::getOfficialKarts();
+    if (all_k.size() >= 65536 - (unsigned)oks.size())
+        all_k.resize(65535 - (unsigned)oks.size());
+    for (const std::string& k : oks)
+        all_k.push_back(k);
     if (ServerConfig::m_live_players)
         m_available_kts.first = m_official_kts.first;
     else
From 339e07bb836d48c932b8516362a764480f57c8e8 Mon Sep 17 00:00:00 2001
From: Benau <Benau@users.noreply.github.com>
Date: Mon, 19 Jul 2021 12:29:54 +0800
Subject: [PATCH] Fix memory leak

---
 src/karts/official_karts.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/karts/official_karts.cpp b/src/karts/official_karts.cpp
index c8d7b9f38b..c9f7a4e75f 100644
--- a/src/karts/official_karts.cpp
+++ b/src/karts/official_karts.cpp
@@ -84,6 +84,7 @@ void load()
         g_official_karts.emplace_back(name, type, width, height, length,
             gravity_shift);
     }
+    delete root;
 }   // load
 
 // ----------------------------------------------------------------------------

Attachment: signature.asc
Description: PGP signature


Reply to: