Loading

Revision differences

Old revision #pqdzxhpelNew revision #pla01hx3i
8   8   
9+            /* While it's true Industry Tiles don't have any owner, the following  9+            /* While it's true Industry Tiles don't have any owner, the following  
10+            DoCommand below is inadvertently setting bit 4 of m1 to 1. To preserve its  10+            DoCommand below is inadvertently setting bit 4 of m1 to 1. To preserve its  
11+            original value, store the original value before executing DoCommand and  11+            original value, store it first before executing DoCommand, then restore it
12+            restore it before MakeIndustry takes action. */  12+            before MakeIndustry takes action. */
13+            Owner old_owner = GetTileOwner(cur_tile);  13+            Owner old_owner = GetTileOwner(cur_tile);  
14             DoCommand(cur_tile, 0, 0, DC_EXEC | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, CMD_LANDSCAPE_CLEAR);  14             DoCommand(cur_tile, 0, 0, DC_EXEC | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, CMD_LANDSCAPE_CLEAR);  
15-  15-  
  
34===================================================================  34===================================================================  
35--- src/saveload/afterload.cpp    (revision 27171)  35--- src/saveload/afterload.cpp    (revision 27171)  
36+++ src/saveload/afterload.cpp    (working copy)  36+++ src/saveload/afterload.cpp    (working copy)  
37@@ -2950,6 +2950,18 @@  37@@ -2985,6 +2985,18 @@
38         }  38     ResetSignalHandlers();
39     }    
40   39   
41+     40     AfterLoadLinkGraphs();
   41+
42+    /* Convert m1 bit 4 value for all industry tiles */  42+    /* Convert m1 bit 4 value for all industry tiles */  
43+    for (TileIndex t = 0; t < map_size; t++) {  43+    if (IsSavegameVersionBefore(195)) {
44+        /* It's not possible to know who was the original owner of a canal tile built under  44+        for (TileIndex t = 0; t < map_size; t++) {
45+        an Oil Rig tile from an old save game. To preserve savegame backward compatibility,  45+            /* It's not possible to know who was the original owner of a canal tile built under
46+        don't do anything about them. Old and new values for a given industry tile can co-exist. */  46+            an Oil Rig tile from an old save game. To preserve savegame backward compatibility,
47+        if (IsTileType(t, MP_INDUSTRY) && (GetWaterClass(t) != WATER_CLASS_CANAL)) {  47+            don't do anything about them. Old and new values for a given industry tile can co-exist. */
48+            SB(_m[t].m1, 4, 1, 1);  48+            if (IsTileType(t, MP_INDUSTRY) && (GetWaterClass(t) != WATER_CLASS_CANAL)) {
   49+                SB(_m[t].m1, 4, 1, 1);
   50+            }
49+        }  51+        }  
50+    }  52+    }  
51+     51     return true;
52+  52 }
53     /*    
54      * Only keep order-backups for network clients.    
55      * If we are a network server or not networking, then we just loaded a previously