20 #ifndef HEADER_KART_PROPERTIES_MANAGER_HPP
21 #define HEADER_KART_PROPERTIES_MANAGER_HPP
23 #include "utils/ptr_vector.hpp"
28 #include "config/favorite_status.hpp"
30 #include "utils/no_copy.hpp"
32 #define ALL_KART_GROUPS_ID "all"
75 std::unique_ptr<AbstractCharacteristic> m_base_characteristic;
76 std::map<std::string, std::unique_ptr<AbstractCharacteristic> > m_difficulty_characteristics;
77 std::map<std::string, std::unique_ptr<AbstractCharacteristic> > m_kart_type_characteristics;
78 std::map<std::string, std::unique_ptr<AbstractCharacteristic> > m_player_characteristics;
89 static void removeKartSearchDirs();
93 const int getKartId(
const std::string &ident)
const;
98 bool loadKart (
const std::string &dir);
111 bool testAndSetKart(
int kartid);
113 RemoteKartInfoList* existing_karts,
114 std::vector<std::string> *ai_list);
126 const std::vector<std::string>& getAllKartTypes()
const {
return m_kart_types; }
128 const std::string& getDefaultKartType()
const {
return m_kart_types[0]; }
130 bool hasKartTypeCharacteristic(
const std::string& type)
const
132 return m_kart_type_characteristics.find(type) !=
133 m_kart_type_characteristics.end();
163 void onDemandLoadKartTextures(
const std::set<std::string>& kart_list,
164 bool unload_unused =
true);
Characteristics are the properties of a kart that influence gameplay mechanics.
Definition: abstract_characteristic.hpp:43
Class for storing the current favorites/custom groups of karts and tracks.
Definition: favorite_status.hpp:43
Definition: kart_properties_manager.hpp:42
const AbstractCharacteristic * getBaseCharacteristic() const
Get the characteristic that holds the base values.
Definition: kart_properties_manager.hpp:118
void selectKart(int kartid)
Sets a kartid to be selected (used in networking only).
Definition: kart_properties_manager.hpp:152
std::map< std::string, std::vector< int > > m_groups_2_indices_no_custom
Mapping of group names to list of kart indices in each group without customized ones.
Definition: kart_properties_manager.hpp:64
KartPropertiesVector m_karts_properties
All available kart configurations.
Definition: kart_properties_manager.hpp:84
void loadAllKarts(bool loading_icon=true)
Loads all kart properties and models.
Definition: kart_properties_manager.cpp:198
const AbstractCharacteristic * getDifficultyCharacteristic(const std::string &type) const
Get a characteristic that holds the values for a certain difficulty.
Definition: kart_properties_manager.cpp:351
const int getKartId(const std::string &ident) const
Returns index of the kart properties with the given ident.
Definition: kart_properties_manager.cpp:398
bool loadKart(const std::string &dir)
Loads a single kart and (if not disabled) the corresponding 3d model.
Definition: kart_properties_manager.cpp:290
void removeKart(const std::string &id)
Remove a kart from the kart manager.
Definition: kart_properties_manager.cpp:103
const std::vector< std::string > * getAllKartDirs() const
Returns all directories from which karts were loaded.
Definition: kart_properties_manager.hpp:155
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:608
const AbstractCharacteristic * getPlayerCharacteristic(const std::string &type) const
Get a characteristic that holds the values for a player difficulty.
Definition: kart_properties_manager.cpp:385
void clearAllSelectedKarts()
Clears all selected karts (used in networking only).
Definition: kart_properties_manager.hpp:143
void unloadAllKarts()
Removes all karts from the KartPropertiesManager, so that they can be reloade.
Definition: kart_properties_manager.cpp:89
void setFavoriteKartStatus(FavoriteStatus *status)
Adds a track to the special group of favorite tracks.
Definition: kart_properties_manager.cpp:499
const unsigned int getNumberOfKarts() const
Returns the number of karts.
Definition: kart_properties_manager.hpp:159
KartPropertiesManager()
Constructor, only clears internal data structures.
Definition: kart_properties_manager.cpp:55
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:45
std::vector< std::string > m_kart_types
List of all kart types.
Definition: kart_properties_manager.hpp:58
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:361
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:452
FavoriteStatus * m_current_favorite_status
Current favorite karts.
Definition: kart_properties_manager.hpp:55
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:566
void loadCharacteristics(const XMLNode *root)
Loads the characteristics from the characteristics config file.
Definition: kart_properties_manager.cpp:233
static void addKartSearchDir(const std::string &s)
Adds a directory from which karts are loaded.
Definition: kart_properties_manager.cpp:80
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:73
~KartPropertiesManager()
Destructor.
Definition: kart_properties_manager.cpp:64
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:578
const std::vector< std::string > & getAllGroups() const
Returns a list of all groups.
Definition: kart_properties_manager.hpp:140
std::vector< std::string > getAllAvailableKarts() const
Returns a list of all available kart identifiers.
Definition: kart_properties_manager.cpp:435
std::vector< std::string > m_all_groups
List of all kart groups.
Definition: kart_properties_manager.hpp:52
bool kartAvailable(int kartid)
Returns true if a kart is available to be selected.
Definition: kart_properties_manager.cpp:547
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:61
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:475
std::vector< int > m_selected_karts
Vector containing kart numbers that have been selected in multiplayer games.
Definition: kart_properties_manager.hpp:69
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:342
std::vector< std::string > m_all_kart_dirs
All directories from which karts were loaded.
Definition: kart_properties_manager.hpp:49
void removeLastSelectedKart()
Removed the last selected kart (used in networking only).
Definition: kart_properties_manager.hpp:146
int getNumSelectedKarts() const
Returns the number of selected karts (used in networking only).
Definition: kart_properties_manager.hpp:149
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
utility class used to parse XML files
Definition: xml_node.hpp:48