From 3bbca7849d82c9dc406e6da6883392f96d263ea4 Mon Sep 17 00:00:00 2001 From: Benau Date: Thu, 20 Feb 2020 09:46:34 +0800 Subject: [PATCH] Remove irrlicht node for flyable in no graphics STK --- src/items/flyable.cpp | 14 +++++++++----- src/items/rubber_ball.cpp | 2 +- src/karts/kart_rewinder.cpp | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/items/flyable.cpp b/src/items/flyable.cpp index aeee03927..d6498f0cf 100644 --- a/src/items/flyable.cpp +++ b/src/items/flyable.cpp @@ -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 diff --git a/src/items/rubber_ball.cpp b/src/items/rubber_ball.cpp index f53f7530a..ed15dcfff 100644 --- a/src/items/rubber_ball.cpp +++ b/src/items/rubber_ball.cpp @@ -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 diff --git a/src/karts/kart_rewinder.cpp b/src/karts/kart_rewinder.cpp index 2f9012082..9b237f253 100644 --- a/src/karts/kart_rewinder.cpp +++ b/src/karts/kart_rewinder.cpp @@ -149,7 +149,8 @@ void KartRewinder::computeError() reset(); // Final ticks come from server m_live_join_util = std::numeric_limits::max(); - getNode()->setVisible(false); + if (getNode()) + getNode()->setVisible(false); } } } // computeError