From 8c05194c0241d88226ba6c727a0c45b00d8495ed Mon Sep 17 00:00:00 2001 From: yexo Date: Fri, 31 Jul 2009 22:30:54 +0000 Subject: (svn r17011) -Change [NoAI]: Add AIBaseStation as a parentclass for AIStation and AIWaypoint, and move GetName, SetName and GetLocation to AIBaseStation Remove (nearly) all references to WaypointID and replace them with StationID --- src/ai/api/ai_station.cpp | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src/ai/api/ai_station.cpp') diff --git a/src/ai/api/ai_station.cpp b/src/ai/api/ai_station.cpp index 244033f58..e2f33400a 100644 --- a/src/ai/api/ai_station.cpp +++ b/src/ai/api/ai_station.cpp @@ -28,34 +28,6 @@ return ::GetStationIndex(tile); } -/* static */ char *AIStation::GetName(StationID station_id) -{ - if (!IsValidStation(station_id)) return NULL; - - static const int len = 64; - char *station_name = MallocT(len); - - ::SetDParam(0, Station::Get(station_id)->index); - ::GetString(station_name, STR_STATION_NAME, &station_name[len - 1]); - return station_name; -} - -/* static */ bool AIStation::SetName(StationID station_id, const char *name) -{ - EnforcePrecondition(false, IsValidStation(station_id)); - EnforcePrecondition(false, !::StrEmpty(name)); - EnforcePreconditionCustomError(false, ::strlen(name) < MAX_LENGTH_STATION_NAME_BYTES, AIError::ERR_PRECONDITION_STRING_TOO_LONG); - - return AIObject::DoCommand(0, station_id, 0, CMD_RENAME_STATION, name); -} - -/* static */ TileIndex AIStation::GetLocation(StationID station_id) -{ - if (!IsValidStation(station_id)) return INVALID_TILE; - - return ::Station::Get(station_id)->xy; -} - /* static */ int32 AIStation::GetCargoWaiting(StationID station_id, CargoID cargo_id) { if (!IsValidStation(station_id)) return -1; -- cgit v1.2.3-54-g00ecf