Add assert checks to road type infra total changes
This commit is contained in:
@@ -821,10 +821,12 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
|||||||
Company::Get(_current_company)->infrastructure.rail[railtype] += LEVELCROSSING_TRACKBIT_FACTOR;
|
Company::Get(_current_company)->infrastructure.rail[railtype] += LEVELCROSSING_TRACKBIT_FACTOR;
|
||||||
DirtyCompanyInfrastructureWindows(_current_company);
|
DirtyCompanyInfrastructureWindows(_current_company);
|
||||||
if (num_new_road_pieces > 0 && Company::IsValidID(road_owner)) {
|
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;
|
Company::Get(road_owner)->infrastructure.road[roadtype_road] += num_new_road_pieces;
|
||||||
DirtyCompanyInfrastructureWindows(road_owner);
|
DirtyCompanyInfrastructureWindows(road_owner);
|
||||||
}
|
}
|
||||||
if (num_new_tram_pieces > 0 && Company::IsValidID(tram_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;
|
Company::Get(tram_owner)->infrastructure.road[roadtype_tram] += num_new_tram_pieces;
|
||||||
DirtyCompanyInfrastructureWindows(tram_owner);
|
DirtyCompanyInfrastructureWindows(tram_owner);
|
||||||
}
|
}
|
||||||
|
@@ -2915,6 +2915,8 @@ static void ConvertRoadTypeOwner(TileIndex tile, uint num_pieces, Owner owner, R
|
|||||||
// We can't get a company from invalid owners but we can get ownership of roads without an owner
|
// We can't get a company from invalid owners but we can get ownership of roads without an owner
|
||||||
if (owner >= MAX_COMPANIES && owner != OWNER_NONE) return;
|
if (owner >= MAX_COMPANIES && owner != OWNER_NONE) return;
|
||||||
|
|
||||||
|
assert(from_type != INVALID_ROADTYPE && to_type != INVALID_ROADTYPE);
|
||||||
|
|
||||||
Company *c;
|
Company *c;
|
||||||
|
|
||||||
switch (owner) {
|
switch (owner) {
|
||||||
|
Reference in New Issue
Block a user