road_cmd.c
changeset 1035 0a170deb6e33
parent 1005 8c6a9bf44bf1
child 1041 be151b7bc909
equal deleted inserted replaced
1034:ff54f189424b 1035:0a170deb6e33
    23 bool HasTileRoadAt(uint tile, int i)
    23 bool HasTileRoadAt(uint tile, int i)
    24 {
    24 {
    25 	int mask;
    25 	int mask;
    26 	byte b;
    26 	byte b;
    27 
    27 
    28 	switch(GET_TILETYPE(tile)) {
    28 	switch (TileType(tile)) {
    29 	case MP_STREET:
    29 	case MP_STREET:
    30 		b = _map5[tile];
    30 		b = _map5[tile];
    31 
    31 
    32 		if ((b & 0xF0) == 0) {
    32 		if ((b & 0xF0) == 0) {
    33 		} else if ((b & 0xF0) == 0x10) {
    33 		} else if ((b & 0xF0) == 0x10) {
    74 	// Only do the special processing for actual players.
    74 	// Only do the special processing for actual players.
    75 	if (_current_player >= MAX_PLAYERS)
    75 	if (_current_player >= MAX_PLAYERS)
    76 		return true;
    76 		return true;
    77 
    77 
    78 	// A railway crossing has the road owner in the map3_lo byte.
    78 	// A railway crossing has the road owner in the map3_lo byte.
    79 	if (IS_TILETYPE(tile, MP_STREET) && (_map5[tile] & 0xF0) == 0x10) {
    79 	if (IsTileType(tile, MP_STREET) && (_map5[tile] & 0xF0) == 0x10) {
    80 		owner = _map3_lo[tile];
    80 		owner = _map3_lo[tile];
    81 	} else {
    81 	} else {
    82 		owner = _map_owner[tile];
    82 		owner = _map_owner[tile];
    83 	}
    83 	}
    84 	// Only do the special processing if the road is owned
    84 	// Only do the special processing if the road is owned
   115 	return true;
   115 	return true;
   116 }
   116 }
   117 
   117 
   118 bool IsRoadDepotTile(TileIndex tile)
   118 bool IsRoadDepotTile(TileIndex tile)
   119 {
   119 {
   120 	return IS_TILETYPE(tile, MP_STREET) &&
   120 	return IsTileType(tile, MP_STREET) &&
   121 					(_map5[tile] & 0xF0) == 0x20;
   121 					(_map5[tile] & 0xF0) == 0x20;
   122 }
   122 }
   123 
   123 
   124 uint GetRoadBitsByTile(TileIndex tile)
   124 uint GetRoadBitsByTile(TileIndex tile)
   125 {
   125 {
   162 		if (!b)
   162 		if (!b)
   163 			return CMD_ERROR;
   163 			return CMD_ERROR;
   164 	}
   164 	}
   165 
   165 
   166 	if (ti.type == MP_TUNNELBRIDGE) {
   166 	if (ti.type == MP_TUNNELBRIDGE) {
   167 		if (!EnsureNoVehicleZ(tile, GET_TILEHEIGHT(tile)))
   167 		if (!EnsureNoVehicleZ(tile, TileHeight(tile)))
   168 			return CMD_ERROR;
   168 			return CMD_ERROR;
   169 
   169 
   170 		if ((ti.map5 & 0xE9) == 0xE8) {
   170 		if ((ti.map5 & 0xE9) == 0xE8) {
   171 			if (p1 & 10) goto return_error;
   171 			if (p1 & 10) goto return_error;
   172 		} else if ((ti.map5 & 0xE9) == 0xE9) {
   172 		} else if ((ti.map5 & 0xE9) == 0xE9) {