road_cmd.c
changeset 4850 93095755db8c
parent 4849 1c6f21eb97f2
child 5009 0ae33f104d4f
equal deleted inserted replaced
4849:1c6f21eb97f2 4850:93095755db8c
    43 	*edge_road = true;
    43 	*edge_road = true;
    44 
    44 
    45 	if (_game_mode == GM_EDITOR) return true;
    45 	if (_game_mode == GM_EDITOR) return true;
    46 
    46 
    47 	// Only do the special processing for actual players.
    47 	// Only do the special processing for actual players.
    48 	if (_current_player >= MAX_PLAYERS) return true;
    48 	if (!IsValidPlayer(_current_player)) return true;
    49 
    49 
    50 	owner = IsLevelCrossingTile(tile) ? GetCrossingRoadOwner(tile) : GetTileOwner(tile);
    50 	owner = IsLevelCrossingTile(tile) ? GetCrossingRoadOwner(tile) : GetTileOwner(tile);
    51 
    51 
    52 	// Only do the special processing if the road is owned
    52 	// Only do the special processing if the road is owned
    53 	// by a town
    53 	// by a town
   287 
   287 
   288 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
   288 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
   289 
   289 
   290 	/* Road pieces are max 4 bitset values (NE, NW, SE, SW) and town can only be non-zero
   290 	/* Road pieces are max 4 bitset values (NE, NW, SE, SW) and town can only be non-zero
   291 	 * if a non-player is building the road */
   291 	 * if a non-player is building the road */
   292 	if ((p1 >> 4) || (_current_player < MAX_PLAYERS && p2 != 0) || !IsValidTownID(p2)) return CMD_ERROR;
   292 	if ((p1 >> 4) || (IsValidPlayer(_current_player) && p2 != 0) || !IsValidTownID(p2)) return CMD_ERROR;
   293 	pieces = p1;
   293 	pieces = p1;
   294 
   294 
   295 	tileh = GetTileSlope(tile, NULL);
   295 	tileh = GetTileSlope(tile, NULL);
   296 
   296 
   297 	switch (GetTileType(tile)) {
   297 	switch (GetTileType(tile)) {