mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Improvements to type safety of Identifier class
- Constructor of Identifier from integer is now explicit - Lobby hero/town selection now uses Identifiers instead of int's - Removed serialization workaround for hero portraits - Added dummy objects for custom heroes portraits for ID resolver to use - HeroInstance now stores portrait ID only in case of custom portrait - Fixed loading of campaign heroes portraits on RoE maps
This commit is contained in:
@@ -27,7 +27,7 @@ struct DLL_LINKAGE SHeroName
|
||||
{
|
||||
SHeroName();
|
||||
|
||||
int heroId;
|
||||
HeroTypeID heroId;
|
||||
std::string heroName;
|
||||
|
||||
template <typename Handler>
|
||||
@@ -45,9 +45,9 @@ struct DLL_LINKAGE PlayerInfo
|
||||
PlayerInfo();
|
||||
|
||||
/// Gets the default faction id or -1 for a random faction.
|
||||
si8 defaultCastle() const;
|
||||
FactionID defaultCastle() const;
|
||||
/// Gets the default hero id or -1 for a random hero.
|
||||
si8 defaultHero() const;
|
||||
HeroTypeID defaultHero() const;
|
||||
bool canAnyonePlay() const;
|
||||
bool hasCustomMainHero() const;
|
||||
|
||||
@@ -63,10 +63,10 @@ struct DLL_LINKAGE PlayerInfo
|
||||
/// Player has a random main hero
|
||||
bool hasRandomHero;
|
||||
/// The default value is -1.
|
||||
si32 mainCustomHeroPortrait;
|
||||
HeroTypeID mainCustomHeroPortrait;
|
||||
std::string mainCustomHeroNameTextId;
|
||||
/// ID of custom hero (only if portrait and hero name are set, otherwise unpredicted value), -1 if none (not always -1)
|
||||
si32 mainCustomHeroId;
|
||||
HeroTypeID mainCustomHeroId;
|
||||
|
||||
std::vector<SHeroName> heroesNames; /// list of placed heroes on the map
|
||||
bool hasMainTown; /// The default value is false.
|
||||
|
||||
Reference in New Issue
Block a user