src/openttd.cpp
changeset 10167 b4bef78a1e24
parent 10158 8f570dcb0997
child 10195 bc84fd2b1476
equal deleted inserted replaced
10166:7e1478da76c4 10167:b4bef78a1e24
  1179 static void ConvertTownOwner()
  1179 static void ConvertTownOwner()
  1180 {
  1180 {
  1181 	for (TileIndex tile = 0; tile != MapSize(); tile++) {
  1181 	for (TileIndex tile = 0; tile != MapSize(); tile++) {
  1182 		switch (GetTileType(tile)) {
  1182 		switch (GetTileType(tile)) {
  1183 			case MP_ROAD:
  1183 			case MP_ROAD:
  1184 				if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HasBit(_m[tile].m4, 7)) {
  1184 				if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HasBit(_m[tile].m3, 7)) {
  1185 					_m[tile].m4 = OWNER_TOWN;
  1185 					_m[tile].m3 = OWNER_TOWN;
  1186 				}
  1186 				}
  1187 				/* FALLTHROUGH */
  1187 				/* FALLTHROUGH */
  1188 
  1188 
  1189 			case MP_TUNNELBRIDGE:
  1189 			case MP_TUNNELBRIDGE:
  1190 				if (GetTileOwner(tile) & 0x80) SetTileOwner(tile, OWNER_TOWN);
  1190 				if (GetTileOwner(tile) & 0x80) SetTileOwner(tile, OWNER_TOWN);
  1563 					SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
  1563 					SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
  1564 					break;
  1564 					break;
  1565 
  1565 
  1566 				case MP_ROAD:
  1566 				case MP_ROAD:
  1567 					_m[t].m4 |= (_m[t].m2 << 4);
  1567 					_m[t].m4 |= (_m[t].m2 << 4);
  1568 					if (IsTileOwner(t, OWNER_TOWN)) {
  1568 					if ((GB(_m[t].m5, 4, 2) == ROAD_TILE_CROSSING ? (Owner)_m[t].m3 : GetTileOwner(t)) == OWNER_TOWN) {
  1569 						SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
  1569 						SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
  1570 					} else {
  1570 					} else {
  1571 						SetTownIndex(t, 0);
  1571 						SetTownIndex(t, 0);
  1572 					}
  1572 					}
  1573 					break;
  1573 					break;