20#ifndef HEADER_KART_PROPERTIES_MANAGER_HPP
21#define HEADER_KART_PROPERTIES_MANAGER_HPP
23#include "utils/ptr_vector.hpp"
29#include "utils/no_copy.hpp"
31#define ALL_KART_GROUPS_ID "all"
68 std::unique_ptr<AbstractCharacteristic> m_base_characteristic;
69 std::map<std::string, std::unique_ptr<AbstractCharacteristic> > m_difficulty_characteristics;
70 std::map<std::string, std::unique_ptr<AbstractCharacteristic> > m_kart_type_characteristics;
71 std::map<std::string, std::unique_ptr<AbstractCharacteristic> > m_player_characteristics;
82 static void removeKartSearchDirs();
86 const int getKartId(
const std::string &ident)
const;
91 bool loadKart (
const std::string &dir);
100 bool testAndSetKart(
int kartid);
102 RemoteKartInfoList* existing_karts,
103 std::vector<std::string> *ai_list);
115 const std::string& getDefaultKartType()
const {
return m_kart_types[0]; }
117 bool hasKartTypeCharacteristic(
const std::string& type)
const
119 return m_kart_type_characteristics.find(type) !=
120 m_kart_type_characteristics.end();
150 void onDemandLoadKartTextures(
const std::set<std::string>& kart_list,
151 bool unload_unused =
true);
Characteristics are the properties of a kart that influence gameplay mechanics.
Definition: abstract_characteristic.hpp:43
Definition: kart_properties_manager.hpp:41
void selectKart(int kartid)
Sets a kartid to be selected (used in networking only).
Definition: kart_properties_manager.hpp:139
KartPropertiesVector m_karts_properties
All available kart configurations.
Definition: kart_properties_manager.hpp:77
void loadAllKarts(bool loading_icon=true)
Loads all kart properties and models.
Definition: kart_properties_manager.cpp:161
const AbstractCharacteristic * getDifficultyCharacteristic(const std::string &type) const
Get a characteristic that holds the values for a certain difficulty.
Definition: kart_properties_manager.cpp:310
const int getKartId(const std::string &ident) const
Returns index of the kart properties with the given ident.
Definition: kart_properties_manager.cpp:357
bool loadKart(const std::string &dir)
Loads a single kart and (if not disabled) the corresponding 3d model.
Definition: kart_properties_manager.cpp:252
void removeKart(const std::string &id)
Remove a kart from the kart manager.
Definition: kart_properties_manager.cpp:99
const AbstractCharacteristic * getBaseCharacteristic() const
Get the characteristic that holds the base values.
Definition: kart_properties_manager.hpp:107
void getRandomKartList(int count, RemoteKartInfoList *existing_karts, std::vector< std::string > *ai_list)
Returns a list of randomly selected karts.
Definition: kart_properties_manager.cpp:524
const AbstractCharacteristic * getPlayerCharacteristic(const std::string &type) const
Get a characteristic that holds the values for a player difficulty.
Definition: kart_properties_manager.cpp:344
void clearAllSelectedKarts()
Clears all selected karts (used in networking only).
Definition: kart_properties_manager.hpp:130
const std::vector< std::string > & getAllGroups() const
Returns a list of all groups.
Definition: kart_properties_manager.hpp:127
const std::vector< std::string > * getAllKartDirs() const
Returns all directories from which karts were loaded.
Definition: kart_properties_manager.hpp:142
void unloadAllKarts()
Removes all karts from the KartPropertiesManager, so that they can be reloade.
Definition: kart_properties_manager.cpp:86
const unsigned int getNumberOfKarts() const
Returns the number of karts.
Definition: kart_properties_manager.hpp:146
KartPropertiesManager()
Constructor, only clears internal data structures.
Definition: kart_properties_manager.cpp:53
static std::vector< std::string > m_kart_search_path
The list of all directories in which to search for karts.
Definition: kart_properties_manager.hpp:44
std::vector< std::string > m_kart_types
List of all kart types.
Definition: kart_properties_manager.hpp:54
const AbstractCharacteristic * getKartTypeCharacteristic(const std::string &type, const std::string &name) const
Get a characteristic that holds the values for a kart type.
Definition: kart_properties_manager.cpp:320
void setUnavailableKarts(std::vector< std::string >)
Marks all karts except the ones listed in the string vector to be unavailable.
Definition: kart_properties_manager.cpp:411
void selectKartName(const std::string &kart_name)
Sets a kart to be selected by specifying the identifier (name) of the kart.
Definition: kart_properties_manager.cpp:481
void loadCharacteristics(const XMLNode *root)
Loads the characteristics from the characteristics config file.
Definition: kart_properties_manager.cpp:195
static void addKartSearchDir(const std::string &s)
Adds a directory from which karts are loaded.
Definition: kart_properties_manager.cpp:77
std::vector< bool > m_kart_available
Contains a flag for each kart indicating whether it is available on all clients or not.
Definition: kart_properties_manager.hpp:66
~KartPropertiesManager()
Destructor.
Definition: kart_properties_manager.cpp:61
const std::vector< int > getKartsInGroup(const std::string &g)
Returns a vector with the indices of all karts in the specified group.
Definition: kart_properties_manager.cpp:493
std::vector< std::string > getAllAvailableKarts() const
Returns a list of all available kart identifiers.
Definition: kart_properties_manager.cpp:394
std::vector< std::string > m_all_groups
List of all kart groups.
Definition: kart_properties_manager.hpp:51
bool kartAvailable(int kartid)
Returns true if a kart is available to be selected.
Definition: kart_properties_manager.cpp:462
std::map< std::string, std::vector< int > > m_groups_2_indices
Mapping of group names to list of kart indices in each group.
Definition: kart_properties_manager.hpp:57
int getKartByGroup(const std::string &group, int i) const
Returns the (global) index of the n-th kart of a given group.
Definition: kart_properties_manager.cpp:434
std::vector< int > m_selected_karts
Vector containing kart numbers that have been selected in multiplayer games.
Definition: kart_properties_manager.hpp:62
void setHatMeshName(const std::string &hat_name)
Sets the name of a mesh to use as a hat for all karts.
Definition: kart_properties_manager.cpp:301
std::vector< std::string > m_all_kart_dirs
All directories from which karts were loaded.
Definition: kart_properties_manager.hpp:48
void removeLastSelectedKart()
Removed the last selected kart (used in networking only).
Definition: kart_properties_manager.hpp:133
int getNumSelectedKarts() const
Returns the number of selected karts (used in networking only).
Definition: kart_properties_manager.hpp:136
This class stores the properties of a kart.
Definition: kart_properties.hpp:60
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
Definition: ptr_vector.hpp:44
utility class used to parse XML files
Definition: xml_node.hpp:48