From fe0363291a456801df36d5f62eb89eb3cc5ce834 Mon Sep 17 00:00:00 2001 From: Luc Verhaegen Date: Thu, 26 Mar 2026 11:54:26 +0100 Subject: [PATCH] change planer algorithms to match the original S2 planes the area to match the altitude of the flag, not the altitude of the building tile. This means both a difference in what altitude is being planed to, and also changes the calculation for deciding to plane or not. S2 changes the height of the building tile to match the flag when the planer has done his round and returns to the central building tile. Signed-off-by: Luc Verhaegen --- libs/s25main/buildings/noBuildingSite.cpp | 7 ++++++- libs/s25main/figures/nofPlaner.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/s25main/buildings/noBuildingSite.cpp b/libs/s25main/buildings/noBuildingSite.cpp index 621a630008..c084801a56 100644 --- a/libs/s25main/buildings/noBuildingSite.cpp +++ b/libs/s25main/buildings/noBuildingSite.cpp @@ -29,7 +29,10 @@ noBuildingSite::noBuildingSite(const BuildingType type, const MapPoint pos, cons || GetSize() == BuildingQuality::Harbor) { // Höhe auf dem Punkt, wo die Baustelle steht - int altitude = world->GetNode(pos).altitude; + int altitude = world->GetNode(this->GetFlagPos()).altitude; + + if(altitude - world->GetNode(pos).altitude != 0) + state = BuildingSiteState::Planing; for(const auto dir : helpers::EnumRange{}) { @@ -377,6 +380,8 @@ void noBuildingSite::PlaningFinished() state = BuildingSiteState::Building; planer = nullptr; + world->ChangeAltitude(pos, world->GetNode(this->GetFlagPos()).altitude); + // Wir hätten gerne einen Bauarbeiter... world->GetPlayer(player).AddJobWanted(Job::Builder, this); diff --git a/libs/s25main/figures/nofPlaner.cpp b/libs/s25main/figures/nofPlaner.cpp index 2b047b7edb..1ecf735d79 100644 --- a/libs/s25main/figures/nofPlaner.cpp +++ b/libs/s25main/figures/nofPlaner.cpp @@ -158,7 +158,7 @@ void nofPlaner::HandleDerivedEvent(const unsigned id) { // Planieren (falls Baustelle noch existiert) if(building_site) - world->ChangeAltitude(pos, world->GetNode(building_site->GetPos()).altitude); + world->ChangeAltitude(pos, world->GetNode(building_site->GetFlagPos()).altitude); /// Sounds abmelden world->GetSoundMgr().stopSounds(*this);