equal
deleted
inserted
replaced
75 #include "rail_map.h" |
75 #include "rail_map.h" |
76 #include "road_map.h" |
76 #include "road_map.h" |
77 #include "water_map.h" |
77 #include "water_map.h" |
78 #include "industry_map.h" |
78 #include "industry_map.h" |
79 #include "unmovable_map.h" |
79 #include "unmovable_map.h" |
|
80 #include "tree_map.h" |
80 |
81 |
81 #include <stdarg.h> |
82 #include <stdarg.h> |
82 |
83 |
83 void CallLandscapeTick(); |
84 void CallLandscapeTick(); |
84 void IncreaseDate(); |
85 void IncreaseDate(); |
1454 case STATION_OILRIG: { |
1455 case STATION_OILRIG: { |
1455 /* Very old savegames sometimes have phantom oil rigs, i.e. |
1456 /* Very old savegames sometimes have phantom oil rigs, i.e. |
1456 * an oil rig which got shut down, but not completly removed from |
1457 * an oil rig which got shut down, but not completly removed from |
1457 * the map |
1458 * the map |
1458 */ |
1459 */ |
1459 TileIndex t1 = TILE_ADDXY(t, 1, 0); |
1460 TileIndex t1 = TILE_ADDXY(t, 0, 1); |
1460 if (IsTileType(t1, MP_INDUSTRY) && |
1461 if (IsTileType(t1, MP_INDUSTRY) && |
1461 GetIndustryGfx(t1) == GFX_OILRIG_3) { |
1462 GetIndustryGfx(t1) == GFX_OILRIG_1) { |
1462 /* The internal encoding of oil rigs was changed twice. |
1463 /* The internal encoding of oil rigs was changed twice. |
1463 * It was 3 (till 2.2) and later 5 (till 5.1). |
1464 * It was 3 (till 2.2) and later 5 (till 5.1). |
1464 * Setting it unconditionally does not hurt. |
1465 * Setting it unconditionally does not hurt. |
1465 */ |
1466 */ |
1466 GetStationByTile(t)->airport_type = AT_OILRIG; |
1467 GetStationByTile(t)->airport_type = AT_OILRIG; |
1632 } |
1633 } |
1633 } else { |
1634 } else { |
1634 if (GB(_m[t].m5, 3, 2) == 0) { |
1635 if (GB(_m[t].m5, 3, 2) == 0) { |
1635 MakeClear(t, CLEAR_GRASS, 3); |
1636 MakeClear(t, CLEAR_GRASS, 3); |
1636 } else { |
1637 } else { |
1637 MakeCanal(t, GetTileOwner(t)); |
1638 MakeCanal(t, (GetTileOwner(t) == OWNER_WATER) ? OWNER_NONE : GetTileOwner(t)); |
1638 } |
1639 } |
1639 } |
1640 } |
1640 SetBridgeMiddle(t, axis); |
1641 SetBridgeMiddle(t, axis); |
1641 } else { // ramp |
1642 } else { // ramp |
1642 Axis axis = (Axis)GB(_m[t].m5, 0, 1); |
1643 Axis axis = (Axis)GB(_m[t].m5, 0, 1); |
2166 /* Added variables to support newindustries */ |
2167 /* Added variables to support newindustries */ |
2167 Industry *i; |
2168 Industry *i; |
2168 FOR_ALL_INDUSTRIES(i) i->founder = OWNER_NONE; |
2169 FOR_ALL_INDUSTRIES(i) i->founder = OWNER_NONE; |
2169 } |
2170 } |
2170 |
2171 |
|
2172 /* From version 82, old style canals (above sealevel (0), WATER owner) are no longer supported. |
|
2173 Replace the owner for those by OWNER_NONE. */ |
|
2174 if (CheckSavegameVersion(82)) { |
|
2175 for (TileIndex t = 0; t < map_size; t++) { |
|
2176 if (IsTileType(t, MP_WATER) && |
|
2177 GetWaterTileType(t) == WATER_TILE_CLEAR && |
|
2178 GetTileOwner(t) == OWNER_WATER && |
|
2179 TileHeight(t) != 0) { |
|
2180 SetTileOwner(t, OWNER_NONE); |
|
2181 } |
|
2182 } |
|
2183 } |
|
2184 |
2171 /* Recalculate */ |
2185 /* Recalculate */ |
2172 Group *g; |
2186 Group *g; |
2173 FOR_ALL_GROUPS(g) { |
2187 FOR_ALL_GROUPS(g) { |
2174 const Vehicle *v; |
2188 const Vehicle *v; |
2175 FOR_ALL_VEHICLES(v) { |
2189 FOR_ALL_VEHICLES(v) { |
2199 for (j = 0; j < lengthof(i->produced_cargo); j++) { |
2213 for (j = 0; j < lengthof(i->produced_cargo); j++) { |
2200 i->produced_cargo[j] = indsp->produced_cargo[j]; |
2214 i->produced_cargo[j] = indsp->produced_cargo[j]; |
2201 } |
2215 } |
2202 for (j = 0; j < lengthof(i->accepts_cargo); j++) { |
2216 for (j = 0; j < lengthof(i->accepts_cargo); j++) { |
2203 i->accepts_cargo[j] = indsp->accepts_cargo[j]; |
2217 i->accepts_cargo[j] = indsp->accepts_cargo[j]; |
|
2218 } |
|
2219 } |
|
2220 } |
|
2221 |
|
2222 /* Before version 81, the density of grass was always stored as zero, and |
|
2223 * grassy trees were always drawn fully grassy. Furthermore, trees on rough |
|
2224 * land used to have zero density, now they have full density. Therefore, |
|
2225 * make all grassy/rough land trees have a density of 3. */ |
|
2226 if (CheckSavegameVersion(81)) { |
|
2227 for (TileIndex t = 0; t < map_size; t++) { |
|
2228 if (GetTileType(t) == MP_TREES) { |
|
2229 TreeGround groundType = GetTreeGround(t); |
|
2230 if (groundType != TREE_GROUND_SNOW_DESERT) SetTreeGroundDensity(t, groundType, 3); |
2204 } |
2231 } |
2205 } |
2232 } |
2206 } |
2233 } |
2207 |
2234 |
2208 return true; |
2235 return true; |