Add assert checks to road type infra total changes

This commit is contained in:
Jonathan G Rennison
2021-12-07 02:30:08 +00:00
parent 0b45103eed
commit 5349003ec4
2 changed files with 4 additions and 0 deletions

View File

@@ -821,10 +821,12 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
Company::Get(_current_company)->infrastructure.rail[railtype] += LEVELCROSSING_TRACKBIT_FACTOR;
DirtyCompanyInfrastructureWindows(_current_company);
if (num_new_road_pieces > 0 && Company::IsValidID(road_owner)) {
assert(roadtype_road != INVALID_ROADTYPE);
Company::Get(road_owner)->infrastructure.road[roadtype_road] += num_new_road_pieces;
DirtyCompanyInfrastructureWindows(road_owner);
}
if (num_new_tram_pieces > 0 && Company::IsValidID(tram_owner)) {
assert(roadtype_tram != INVALID_ROADTYPE);
Company::Get(tram_owner)->infrastructure.road[roadtype_tram] += num_new_tram_pieces;
DirtyCompanyInfrastructureWindows(tram_owner);
}