mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +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:
@@ -106,20 +106,20 @@ HeroTypeID MapReaderH3M::readHero()
|
||||
return remapIdentifier(result);
|
||||
}
|
||||
|
||||
int32_t MapReaderH3M::readHeroPortrait()
|
||||
HeroTypeID MapReaderH3M::readHeroPortrait()
|
||||
{
|
||||
HeroTypeID result(reader->readUInt8());
|
||||
|
||||
if(result.getNum() == features.heroIdentifierInvalid)
|
||||
return int32_t(-1);
|
||||
return HeroTypeID::NONE;
|
||||
|
||||
if (result.getNum() >= features.heroesPortraitsCount)
|
||||
{
|
||||
logGlobal->warn("Map contains invalid hero portrait ID %d. Will be reset!", result.getNum() );
|
||||
return int32_t(-1);
|
||||
return HeroTypeID::NONE;
|
||||
}
|
||||
|
||||
return remapper.remapPortrrait(result);
|
||||
return remapper.remapPortrait(result);
|
||||
}
|
||||
|
||||
CreatureID MapReaderH3M::readCreature()
|
||||
|
||||
Reference in New Issue
Block a user