Always send (empty if applicable) kart data to ensure forward compatibility

This commit is contained in:
Benau 2022-09-11 00:41:21 +08:00
parent ebd380c0bc
commit f1fdc98779
2 changed files with 9 additions and 7 deletions

View File

@ -275,7 +275,7 @@ namespace ServerConfig
SERVER_CFG_PREFIX BoolServerConfigParam m_real_addon_karts SERVER_CFG_PREFIX BoolServerConfigParam m_real_addon_karts
SERVER_CFG_DEFAULT(BoolServerConfigParam(true, "real-addon-karts", SERVER_CFG_DEFAULT(BoolServerConfigParam(true, "real-addon-karts",
"If true, server will send its addon karts real phyics (kart size, " "If true, server will send its addon karts real physics (kart size, "
"length, type, etc) to client. If false or client chooses an addon " "length, type, etc) to client. If false or client chooses an addon "
"kart which server is missing, tux's kart physics and kart type of " "kart which server is missing, tux's kart physics and kart type of "
"the original addon is sent.")); "the original addon is sent."));

View File

@ -141,17 +141,19 @@ void NetworkKartSelectionScreen::allPlayersDone()
} }
NetworkConfig* nc = NetworkConfig::get(); NetworkConfig* nc = NetworkConfig::get();
if (nc->useTuxHitboxAddon() && if (nc->getServerCapabilities().find(
nc->getServerCapabilities().find(
"real_addon_karts") != nc->getServerCapabilities().end()) "real_addon_karts") != nc->getServerCapabilities().end())
{ {
for (unsigned n = 0; n < kart_count; n++) for (unsigned n = 0; n < kart_count; n++)
{ {
KartData kart_data; KartData kart_data;
if (nc->useTuxHitboxAddon())
{
const KartProperties* kp = kart_properties_manager const KartProperties* kp = kart_properties_manager
->getKart(m_kart_widgets[n].m_kart_internal_name); ->getKart(m_kart_widgets[n].m_kart_internal_name);
if (kp && kp->isAddon()) if (kp && kp->isAddon())
kart_data = KartData(kp); kart_data = KartData(kp);
}
kart_data.encode(&kart); kart_data.encode(&kart);
} }
} }