1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-18 17:40:48 +02:00

Fix RMG bug with incorrect town placement (#779)

* Fix RMG bug with incorrect town placement
* Readability tweak
This commit is contained in:
Nordsoft91 2022-08-22 15:32:54 +04:00 committed by Andrii Danylchenko
parent f3f1fb8033
commit f668c65eb2
2 changed files with 2 additions and 1 deletions

View File

@ -142,11 +142,11 @@ void registerTypesMapObjectTypes(Serializer &s)
s.template registerType<IUpdater, GrowsWithLevelUpdater>();
s.template registerType<IUpdater, TimesHeroLevelUpdater>();
s.template registerType<IUpdater, TimesStackLevelUpdater>();
s.template registerType<IUpdater, OwnerUpdater>();
s.template registerType<ILimiter, AnyOfLimiter>();
s.template registerType<ILimiter, NoneOfLimiter>();
s.template registerType<ILimiter, OppositeSideLimiter>();
s.template registerType<IUpdater, OwnerUpdater>();
//new types (other than netpacks) must register here
//order of type registration is critical for loading old savegames
}

View File

@ -138,6 +138,7 @@ int3 TownPlacer::placeMainTown(ObjectManager & manager, CGTownInstance & town)
{
//towns are big objects and should be centered around visitable position
rmg::Object rmgObject(town);
rmgObject.setTemplate(zone.getTerrainType());
auto position = manager.findPlaceForObject(zone.areaPossible(), rmgObject, [this](const int3 & t)
{
float distance = zone.getPos().dist2dSQ(t);