waypoint.c
changeset 3491 35d747bb5e82
parent 3448 bc96e486627d
child 3503 44f50afb0a75
equal deleted inserted replaced
3490:d53bc3e794bd 3491:35d747bb5e82
   161 	}
   161 	}
   162 }
   162 }
   163 
   163 
   164 /** Convert existing rail to waypoint. Eg build a waypoint station over
   164 /** Convert existing rail to waypoint. Eg build a waypoint station over
   165  * piece of rail
   165  * piece of rail
   166  * @param x,y coordinates where waypoint will be built
   166  * @param tile tile where waypoint will be built
   167  * @param p1 graphics for waypoint type, 0 indicates standard graphics
   167  * @param p1 graphics for waypoint type, 0 indicates standard graphics
   168  * @param p2 unused
   168  * @param p2 unused
   169  *
   169  *
   170  * @todo When checking for the tile slope,
   170  * @todo When checking for the tile slope,
   171  * distingush between "Flat land required" and "land sloped in wrong direction"
   171  * distingush between "Flat land required" and "land sloped in wrong direction"
   172  */
   172  */
   173 int32 CmdBuildTrainWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
   173 int32 CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   174 {
   174 {
   175 	TileIndex tile = TileVirtXY(x, y);
       
   176 	Waypoint *wp;
   175 	Waypoint *wp;
   177 	uint tileh;
   176 	uint tileh;
   178 	Axis axis;
   177 	Axis axis;
   179 
   178 
   180 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
   179 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
   309 
   308 
   310 	return _price.remove_train_depot;
   309 	return _price.remove_train_depot;
   311 }
   310 }
   312 
   311 
   313 /** Delete a waypoint
   312 /** Delete a waypoint
   314  * @param x,y coordinates where waypoint is to be deleted
   313  * @param tile tile where waypoint is to be deleted
   315  * @param p1 unused
   314  * @param p1 unused
   316  * @param p2 unused
   315  * @param p2 unused
   317  */
   316  */
   318 int32 CmdRemoveTrainWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
   317 int32 CmdRemoveTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   319 {
   318 {
   320 	TileIndex tile = TileVirtXY(x, y);
       
   321 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
   319 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
   322 	return RemoveTrainWaypoint(tile, flags, true);
   320 	return RemoveTrainWaypoint(tile, flags, true);
   323 }
   321 }
   324 
   322 
   325 /** Rename a waypoint.
   323 /** Rename a waypoint.
   326  * @param x,y unused
   324  * @param tile unused
   327  * @param p1 id of waypoint
   325  * @param p1 id of waypoint
   328  * @param p2 unused
   326  * @param p2 unused
   329  */
   327  */
   330 int32 CmdRenameWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
   328 int32 CmdRenameWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   331 {
   329 {
   332 	Waypoint *wp;
   330 	Waypoint *wp;
   333 	StringID str;
   331 	StringID str;
   334 
   332 
   335 	if (!IsWaypointIndex(p1)) return CMD_ERROR;
   333 	if (!IsWaypointIndex(p1)) return CMD_ERROR;