@@ -29,12 +29,13 @@
#include "object_base.h"
#include "newgrf_config.h"
#include "newgrf_object.h"
#include "date_func.h"
#include "newgrf_debug.h"
#include "vehicle_func.h"
#include "station_func.h"
#include "table/strings.h"
#include "table/object_land.h"
#include "safeguards.h"
@@ -118,13 +119,15 @@ void BuildObject(ObjectType type, TileIn
WaterClass wc = (IsWaterTile(t) ? GetWaterClass(t) : WATER_CLASS_INVALID);
/* Update company infrastructure counts for objects build on canals owned by nobody. */
if (wc == WATER_CLASS_CANAL && owner != OWNER_NONE && (IsTileOwner(tile, OWNER_NONE) || IsTileOwner(tile, OWNER_WATER))) {
Company::Get(owner)->infrastructure.water++;
DirtyCompanyInfrastructureWindows(owner);
}
bool remove = IsDockingTile(t);
MakeObject(t, owner, o->index, wc, Random());
if (remove) RemoveDockingTile(t);
MarkTileDirtyByTile(t);
Object::IncTypeCount(type);
if (spec->flags & OBJECT_FLAG_ANIMATION) TriggerObjectAnimation(o, OAT_BUILT, spec);