Made KArtProperties member of STKConfig a pointer,

which removes the dependency of kart_properties.hpp
from stk_config.hpp, hopefully reducing the compile
time when kart_properties.hpp is changed. Had to
add many missing includes all over the place as a
result :)


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10683 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2012-01-16 05:59:51 +00:00
parent 9f69dad8a3
commit 351f766ca4
17 changed files with 54 additions and 15 deletions

View File

@ -41,6 +41,7 @@
#include "states_screens/main_menu_screen.hpp"
#include "utils/string_utils.hpp"
#include "utils/time.hpp"
#include "utils/translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
// Use Sleep, which takes time in msecs. It must be defined after the

View File

@ -23,6 +23,7 @@
#include "states_screens/main_menu_screen.hpp"
#include "utils/string_utils.hpp"
#include "utils/time.hpp"
#include "utils/translation.hpp"
#include <iostream>

View File

@ -22,20 +22,31 @@
#include <stdio.h>
#include <sstream>
#include "audio/music_information.hpp"
#include "io/file_manager.hpp"
#include "io/xml_node.hpp"
#include "items/item.hpp"
#include "items/item_manager.hpp"
#include "audio/music_information.hpp"
#include "karts/kart_properties.hpp"
STKConfig* stk_config=0;
float STKConfig::UNDEFINED = -99.9f;
//-----------------------------------------------------------------------------
/** Constructor, which only initialises the object. The actual work is done
* by calling load().
*/
STKConfig::STKConfig()
{
m_has_been_loaded = false;
m_default_kart_properties = new KartProperties();
} // STKConfig
//-----------------------------------------------------------------------------
STKConfig::~STKConfig()
{
if(m_title_music)
delete m_title_music;
delete m_default_kart_properties;
} // ~STKConfig
//-----------------------------------------------------------------------------
@ -128,7 +139,7 @@ void STKConfig::load(const std::string &filename)
CHECK_NEG(m_penalty_time, "penalty-time" );
CHECK_NEG(m_max_display_news, "max-display-news" );
m_kart_properties.checkAllSet(filename);
m_default_kart_properties->checkAllSet(filename);
} // load
// -----------------------------------------------------------------------------
@ -343,7 +354,7 @@ void STKConfig::getAllData(const XMLNode * root)
msg << "Couldn't load general-kart-defaults: no node.";
throw std::runtime_error(msg.str());
}
m_kart_properties.getAllData(node);
m_default_kart_properties->getAllData(node);
} // getAllData

View File

@ -26,11 +26,13 @@
* configuration file.
*/
#include "karts/kart_properties.hpp"
#include "utils/no_copy.hpp"
class XMLNode;
#include <vector>
class KartProperties;
class MusicInformation;
class XMLNode;
/**
* \brief Global STK configuration information.
@ -42,7 +44,9 @@ class MusicInformation;
class STKConfig : public NoCopy
{
protected:
KartProperties m_kart_properties; /**< Default kart properties. */
/** Default kart properties. */
KartProperties *m_default_kart_properties;
public:
/** What to do if a kart already has a powerup when it hits a bonus box:
* - NEW: give it a random new bonx box.
@ -124,18 +128,18 @@ private:
bool m_has_been_loaded;
public:
/** Empty constructor. The actual work is done in load. */
STKConfig() {m_has_been_loaded= false;};
STKConfig();
~STKConfig();
void init_defaults ();
void getAllData (const XMLNode * root);
void load (const std::string &filename);
/** Returns the default kart properties for each kart. */
const KartProperties &
getDefaultKartProperties() const {return m_kart_properties; }
const std::string &getMainMenuPicture(int n);
const std::string &getBackgroundPicture(int n);
void getAllScores(std::vector<int> *all_scores, int num_karts);
// ------------------------------------------------------------------------
/** Returns the default kart properties for each kart. */
const KartProperties &
getDefaultKartProperties() const {return *m_default_kart_properties; }
}
; // STKConfig

View File

@ -24,6 +24,8 @@
#include <typeinfo>
#include <irrString.h>
#include <IXMLReader.h>
namespace irr
{
namespace gui { class IGUIElement; }
@ -34,7 +36,6 @@ using namespace irr;
#include "guiengine/abstract_top_level_container.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/event_handler.hpp"
//#include "guiengine/layout_manager.hpp"
#include "guiengine/widget.hpp"
#include "input/input.hpp"
#include "utils/ptr_vector.hpp"

View File

@ -24,6 +24,8 @@
#include "utils/no_copy.hpp"
#include "utils/ptr_vector.hpp"
#include <irrArray.h>
enum PlayerAssignMode
{
NO_ASSIGN, //!< react to all devices

View File

@ -24,6 +24,9 @@
#include "utils/no_copy.hpp"
#include "utils/random_generator.hpp"
#include <IAnimatedMeshSceneNode.h>
using namespace irr;
class Kart;
class Item;
class SFXBase;

View File

@ -24,6 +24,7 @@ namespace irr
namespace scene { class IAnimatedMesh; }
}
#include "graphics/material.hpp"
#include "items/attachment.hpp"
#include "utils/no_copy.hpp"

View File

@ -19,6 +19,9 @@
#include "items/powerup_manager.hpp"
#include <stdexcept>
#include <irrlicht.h>
#include "graphics/irr_driver.hpp"
#include "graphics/material.hpp"
#include "graphics/material_manager.hpp"

View File

@ -19,14 +19,15 @@
#ifndef HEADER_SWATTER_HPP
#define HEADER_SWATTER_HPP
#include <vector3d.h>
#include "config/stk_config.hpp"
#include "items/attachment_plugin.hpp"
#include "karts/moveable.hpp"
#include "utils/no_copy.hpp"
#include "utils/random_generator.hpp"
#include <vector3d.h>
#include <IAnimatedMeshSceneNode.h>
class Kart;
class Item;
class SFXBase;

View File

@ -30,6 +30,7 @@
#include "states_screens/dialogs/addons_loading.hpp"
#include "states_screens/dialogs/message_dialog.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include "utils/ptr_vector.hpp"
DEFINE_SCREEN_SINGLETON( AddonsScreen );

View File

@ -31,6 +31,7 @@ using irr::core::stringc;
#include "io/file_manager.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/string_utils.hpp"
#include "utils/translation.hpp"
DEFINE_SCREEN_SINGLETON( CreditsScreen );

View File

@ -22,6 +22,7 @@
#include "guiengine/widgets/button_widget.hpp"
#include "guiengine/widgets/label_widget.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
using namespace GUIEngine;

View File

@ -20,6 +20,7 @@
#include <IGUIStaticText.h>
#include <IGUIEnvironment.h>
#include "audio/sfx_manager.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player.hpp"
#include "guiengine/engine.hpp"

View File

@ -23,7 +23,11 @@
#include "guiengine/screen.hpp"
#include "utils/ptr_vector.hpp"
namespace irr { namespace scene { class ISceneNode; class ICameraSceneNode; class ILightSceneNode; } }
namespace irr {
namespace scene { class ISceneNode; class ICameraSceneNode;
class ILightSceneNode; }
}
class KartModel;
class KartProperties;
class ChallengeData;

View File

@ -32,6 +32,7 @@
#include "states_screens/options_screen_ui.hpp"
#include "states_screens/options_screen_video.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include <iostream>
#include <sstream>

View File

@ -35,6 +35,8 @@ namespace irr
}
}
class SFXBase;
/**
* \brief Displays the results (while the end animation is shown).
* \ingroup states_screens