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/irr_driver.hpp"
#include "graphics/material.hpp" #include "graphics/material.hpp"
#include "graphics/mesh_tools.hpp" #include "graphics/mesh_tools.hpp"
#include "graphics/stars.hpp" #include "guiengine/engine.hpp"
#include "io/xml_node.hpp" #include "io/xml_node.hpp"
#include "items/projectile_manager.hpp" #include "items/projectile_manager.hpp"
#include "karts/abstract_kart.hpp" #include "karts/abstract_kart.hpp"
@ -91,12 +91,16 @@ Flyable::Flyable(AbstractKart *kart, PowerupManager::PowerupType type,
// Add the graphical model // Add the graphical model
#ifndef SERVER_ONLY #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 #ifdef DEBUG
std::string debug_name("flyable: "); std::string debug_name("flyable: ");
debug_name += type; debug_name += type;
getNode()->setName(debug_name.c_str()); getNode()->setName(debug_name.c_str());
#endif #endif
}
#endif #endif
// Smooth network body for flyable doesn't seem to be needed, most of the // Smooth network body for flyable doesn't seem to be needed, most of the
// time it rewinds almost the same // time it rewinds almost the same

View File

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

View File

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