mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Stabilization
This commit is contained in:
parent
8346d71c98
commit
b42f073f0c
@ -526,15 +526,6 @@ void CGameState::randomizeMapObjects()
|
||||
|
||||
object->pickRandomObject(getRandomGenerator());
|
||||
|
||||
auto * hero = dynamic_cast<CGHeroInstance *>(object);
|
||||
auto * town = dynamic_cast<CGTownInstance *>(object);
|
||||
|
||||
if (hero && hero->ID != Obj::PRISON)
|
||||
map->heroesOnMap.emplace_back(hero);
|
||||
|
||||
if (town)
|
||||
map->towns.emplace_back(town);
|
||||
|
||||
//handle Favouring Winds - mark tiles under it
|
||||
if(object->ID == Obj::FAVORABLE_WINDS)
|
||||
{
|
||||
@ -1825,10 +1816,10 @@ void CGameState::buildBonusSystemTree()
|
||||
buildGlobalTeamPlayerTree();
|
||||
attachArmedObjects();
|
||||
|
||||
// for(CGTownInstance *t : map->towns)
|
||||
// {
|
||||
// t->deserializationFix();
|
||||
// }
|
||||
for(CGTownInstance *t : map->towns)
|
||||
{
|
||||
t->deserializationFix();
|
||||
}
|
||||
// CStackInstance <-> CCreature, CStackInstance <-> CArmedInstance, CArtifactInstance <-> CArtifact
|
||||
// are provided on initializing / deserializing
|
||||
|
||||
|
@ -128,7 +128,7 @@ void CGDwelling::pickRandomObject(CRandomGenerator & rand)
|
||||
FactionID faction = randomizeFaction(rand);
|
||||
int level = randomizeLevel(rand);
|
||||
assert(faction != FactionID::NONE && faction != FactionID::NEUTRAL);
|
||||
assert(level >= 1 && level <= 7);
|
||||
assert(level >= 0 && level <= 6);
|
||||
randomizationInfo.reset();
|
||||
|
||||
CreatureID cid = (*VLC->townh)[faction]->town->creatures[level][0];
|
||||
@ -163,6 +163,8 @@ void CGDwelling::pickRandomObject(CRandomGenerator & rand)
|
||||
ID = Obj::CREATURE_GENERATOR4;
|
||||
subID = *RandomGeneratorUtil::nextItem(VLC->objtypeh->knownSubObjects(Obj::CREATURE_GENERATOR1), rand);
|
||||
}
|
||||
|
||||
setType(ID, subID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1547,14 +1547,14 @@ void CGHeroInstance::afterAddToMap(CMap * map)
|
||||
}
|
||||
}
|
||||
|
||||
if(ID == Obj::HERO)
|
||||
if(ID != Obj::PRISON)
|
||||
{
|
||||
map->heroesOnMap.emplace_back(this);
|
||||
}
|
||||
}
|
||||
void CGHeroInstance::afterRemoveFromMap(CMap* map)
|
||||
{
|
||||
if (ID == Obj::HERO)
|
||||
if (ID == Obj::PRISON)
|
||||
vstd::erase_if_present(map->heroesOnMap, this);
|
||||
}
|
||||
|
||||
|
@ -1100,14 +1100,12 @@ void CGTownInstance::onTownCaptured(const PlayerColor & winner) const
|
||||
|
||||
void CGTownInstance::afterAddToMap(CMap * map)
|
||||
{
|
||||
if(ID == Obj::TOWN)
|
||||
map->towns.emplace_back(this);
|
||||
map->towns.emplace_back(this);
|
||||
}
|
||||
|
||||
void CGTownInstance::afterRemoveFromMap(CMap * map)
|
||||
{
|
||||
if (ID == Obj::TOWN)
|
||||
vstd::erase_if_present(map->towns, this);
|
||||
vstd::erase_if_present(map->towns, this);
|
||||
}
|
||||
|
||||
void CGTownInstance::reset()
|
||||
|
@ -1326,14 +1326,14 @@ CGObjectInstance * CMapLoaderH3M::readDwellingRandom(const int3 & mapPosition, s
|
||||
|
||||
object->randomizationInfo = CGDwellingRandomizationInfo();
|
||||
|
||||
bool hasFactionInfo = objectTemplate->id == Obj::RANDOM_DWELLING || objectTemplate->id == Obj::RANDOM_DWELLING_FACTION;
|
||||
bool hasLevelInfo = objectTemplate->id == Obj::RANDOM_DWELLING || objectTemplate->id == Obj::RANDOM_DWELLING_LVL;
|
||||
bool hasFactionInfo = objectTemplate->id == Obj::RANDOM_DWELLING || objectTemplate->id == Obj::RANDOM_DWELLING_LVL;
|
||||
bool hasLevelInfo = objectTemplate->id == Obj::RANDOM_DWELLING || objectTemplate->id == Obj::RANDOM_DWELLING_FACTION;
|
||||
|
||||
if (hasFactionInfo)
|
||||
{
|
||||
object->randomizationInfo->identifier = reader->readUInt32();
|
||||
|
||||
if(object->randomizationInfo->identifier != 0)
|
||||
if(object->randomizationInfo->identifier == 0)
|
||||
reader->readBitmaskFactions(object->randomizationInfo->allowedFactions, false);
|
||||
}
|
||||
else
|
||||
|
@ -235,8 +235,11 @@ void Inspector::updateProperties(CGDwelling * o)
|
||||
|
||||
addProperty("Owner", o->tempOwner, false);
|
||||
|
||||
auto * delegate = new PickObjectDelegate(controller, PickObjectDelegate::typedFilter<CGTownInstance>);
|
||||
addProperty("Same as town", PropertyEditorPlaceholder(), delegate, false);
|
||||
if (o->ID == Obj::RANDOM_DWELLING || o->ID == Obj::RANDOM_DWELLING_LVL)
|
||||
{
|
||||
auto * delegate = new PickObjectDelegate(controller, PickObjectDelegate::typedFilter<CGTownInstance>);
|
||||
addProperty("Same as town", PropertyEditorPlaceholder(), delegate, false);
|
||||
}
|
||||
}
|
||||
|
||||
void Inspector::updateProperties(CGLighthouse * o)
|
||||
|
Loading…
Reference in New Issue
Block a user