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