mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-18 18:02:37 +01:00
Codechange: Add functions to test if a station/roadstop class is a waypoint.
This is now checked by class label instead of by index.
This commit is contained in:
committed by
Peter Nelson
parent
9f8c9724be
commit
d2c8b476b5
@@ -177,8 +177,10 @@ CommandCost CmdBuildRailWaypoint(DoCommandFlag flags, TileIndex start_tile, Axis
|
||||
{
|
||||
if (!IsValidAxis(axis)) return CMD_ERROR;
|
||||
/* Check if the given station class is valid */
|
||||
if (spec_class != STAT_CLASS_WAYP) return CMD_ERROR;
|
||||
if (spec_index >= StationClass::Get(spec_class)->GetSpecCount()) return CMD_ERROR;
|
||||
if (static_cast<uint>(spec_class) >= StationClass::GetClassCount()) return CMD_ERROR;
|
||||
const StationClass *cls = StationClass::Get(spec_class);
|
||||
if (!IsWaypointClass(*cls)) return CMD_ERROR;
|
||||
if (spec_index >= cls->GetSpecCount()) return CMD_ERROR;
|
||||
|
||||
/* The number of parts to build */
|
||||
uint8_t count = axis == AXIS_X ? height : width;
|
||||
|
||||
Reference in New Issue
Block a user