Fix addon karts display of online games

This commit is contained in:
Benau 2021-03-18 10:58:06 +08:00
parent 7763d851be
commit b59c65e989
3 changed files with 10 additions and 1 deletions

View File

@ -10,6 +10,7 @@
#include "tracks/track_manager.hpp"
#include "tracks/track.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_model.hpp"
#include "karts/kart_properties.hpp"
#include "utils/translation.hpp"
#include "network/protocols/client_lobby.hpp"
@ -468,7 +469,7 @@ void RichPresence::update(bool force)
AbstractKart *abstractKart = world->getLocalPlayerKart(0);
if (abstractKart)
{
const KartProperties* kart = abstractKart->getKartProperties();
const KartProperties* kart = abstractKart->getKartModel()->getKartProperties();
assets.add("small_image", protocol && protocol->isSpectator() ?
"spectate" : kart->isAddon() ?
"addons" : "kart_" + abstractKart->getIdent());

View File

@ -132,6 +132,7 @@ KartModel::KartModel(bool is_master)
m_animation_speed = 25;
m_current_animation = AF_DEFAULT;
m_support_colorization = false;
m_kart_properties = NULL;
} // KartModel
// ----------------------------------------------------------------------------
@ -324,6 +325,7 @@ KartModel* KartModel::makeCopy(std::shared_ptr<RenderInfo> ri)
assert(m_is_master);
assert(!m_render_info);
assert(!m_animated_node);
assert(m_kart_properties);
KartModel *km = new KartModel(/*is master*/ false);
km->m_kart_width = m_kart_width;
km->m_kart_length = m_kart_length;
@ -384,6 +386,7 @@ KartModel* KartModel::makeCopy(std::shared_ptr<RenderInfo> ri)
for(unsigned int i=AF_BEGIN; i<=AF_END; i++)
km->m_animation_frame[i] = m_animation_frame[i];
km->m_kart_properties = m_kart_properties;
return km;
} // makeCopy
@ -563,6 +566,7 @@ void HeadlightObject::setLight(scene::ISceneNode* parent,
bool KartModel::loadModels(const KartProperties &kart_properties)
{
assert(m_is_master);
m_kart_properties = &kart_properties;
std::string full_path = kart_properties.getKartDir()+m_model_filename;
// For b3d loader only
if (m_animation_frame[AF_STRAIGHT] > -1)

View File

@ -323,6 +323,7 @@ private:
/** Exhaust particle file (xml) for the kart, empty if disabled. */
std::string m_exhaust_xml;
const KartProperties* m_kart_properties;
// ------------------------------------------------------------------------
void initInverseBoneMatrices();
// ------------------------------------------------------------------------
@ -451,5 +452,8 @@ public:
const std::string& getExhaustXML() const { return m_exhaust_xml; }
// ------------------------------------------------------------------------
bool hasWheel() const { return !m_wheel_filename[0].empty(); }
// ------------------------------------------------------------------------
const KartProperties* getKartProperties() const
{ return m_kart_properties; }
}; // KartModel
#endif