Remove irrlicht node for flyable in no graphics STK

This commit is contained in:
Benau 2020-02-20 09:46:34 +08:00
parent 13df4ee83a
commit 3bbca7849d
3 changed files with 12 additions and 7 deletions

View File

@ -32,7 +32,7 @@
#include "graphics/irr_driver.hpp"
#include "graphics/material.hpp"
#include "graphics/mesh_tools.hpp"
#include "graphics/stars.hpp"
#include "guiengine/engine.hpp"
#include "io/xml_node.hpp"
#include "items/projectile_manager.hpp"
#include "karts/abstract_kart.hpp"
@ -91,12 +91,16 @@ Flyable::Flyable(AbstractKart *kart, PowerupManager::PowerupType type,
// Add the graphical model
#ifndef SERVER_ONLY
setNode(irr_driver->addMesh(m_st_model[type], StringUtils::insertValues("flyable_%i", (int)type)));
if (!GUIEngine::isNoGraphics())
{
setNode(irr_driver->addMesh(m_st_model[type],
StringUtils::insertValues("flyable_%i", (int)type)));
#ifdef DEBUG
std::string debug_name("flyable: ");
debug_name += type;
getNode()->setName(debug_name.c_str());
std::string debug_name("flyable: ");
debug_name += type;
getNode()->setName(debug_name.c_str());
#endif
}
#endif
// Smooth network body for flyable doesn't seem to be needed, most of the
// time it rewinds almost the same

View File

@ -474,7 +474,7 @@ bool RubberBall::updateAndDelete(int ticks)
scale = height / m_extend.getY();
#ifndef SERVER_ONLY
if (!RewindManager::get()->isRewinding())
if (m_node && !RewindManager::get()->isRewinding())
m_node->setScale(core::vector3df(1.0f, scale, 1.0f));
#endif

View File

@ -149,7 +149,8 @@ void KartRewinder::computeError()
reset();
// Final ticks come from server
m_live_join_util = std::numeric_limits<int>::max();
getNode()->setVisible(false);
if (getNode())
getNode()->setVisible(false);
}
}
} // computeError