Codechange: Make use of Rect Width/Height helpers.

This commit is contained in:
Peter Nelson
2022-09-29 00:10:41 +01:00
committed by PeterN
parent 632464a623
commit f5f035a22b
19 changed files with 40 additions and 40 deletions

View File

@@ -549,8 +549,8 @@ CommandCost StationRect::BeforeAddTile(TileIndex tile, StationRectMode mode)
Rect new_rect = {std::min(x, this->left), std::min(y, this->top), std::max(x, this->right), std::max(y, this->bottom)};
/* check new rect dimensions against preset max */
int w = new_rect.right - new_rect.left + 1;
int h = new_rect.bottom - new_rect.top + 1;
int w = new_rect.Width();
int h = new_rect.Height();
if (mode != ADD_FORCE && (w > _settings_game.station.station_spread || h > _settings_game.station.station_spread)) {
assert(mode != ADD_TRY);
return_cmd_error(STR_ERROR_STATION_TOO_SPREAD_OUT);