src/openttd.cpp
branchNewGRF_ports
changeset 6730 f09255ea0123
parent 6725 23339968083f
child 6743 cabfaa4a0295
equal deleted inserted replaced
6729:76133dcea48b 6730:f09255ea0123
  1356 		DoStartupNewPlayer(false);
  1356 		DoStartupNewPlayer(false);
  1357 
  1357 
  1358 	DoZoomInOutWindow(ZOOM_NONE, w); // update button status
  1358 	DoZoomInOutWindow(ZOOM_NONE, w); // update button status
  1359 	MarkWholeScreenDirty();
  1359 	MarkWholeScreenDirty();
  1360 
  1360 
       
  1361 	if (CheckSavegameVersion(72)) {
       
  1362 		/* Locks/shiplifts in very old savegames had OWNER_WATER as owner */
       
  1363 		for (TileIndex t = 0; t < MapSize(); t++) {
       
  1364 			switch (GetTileType(t)) {
       
  1365 				default: break;
       
  1366 
       
  1367 				case MP_WATER:
       
  1368 					if (GetWaterTileType(t) == WATER_TILE_LOCK && GetTileOwner(t) == OWNER_WATER) SetTileOwner(t, OWNER_NONE);
       
  1369 					break;
       
  1370 
       
  1371 				case MP_STATION: {
       
  1372 					if (HASBIT(_m[t].m6, 3)) SETBIT(_m[t].m6, 2);
       
  1373 					StationGfx gfx = GetStationGfx(t);
       
  1374 					StationType st;
       
  1375 					if (       IS_INT_INSIDE(gfx,   0,   8)) { // Railway station
       
  1376 						st = STATION_RAIL;
       
  1377 						SetStationGfx(t, gfx - 0);
       
  1378 					} else if (IS_INT_INSIDE(gfx,   8,  67)) { // Airport
       
  1379 						st = STATION_AIRPORT;
       
  1380 						SetStationGfx(t, gfx - 8);
       
  1381 					} else if (IS_INT_INSIDE(gfx,  67,  71)) { // Truck
       
  1382 						st = STATION_TRUCK;
       
  1383 						SetStationGfx(t, gfx - 67);
       
  1384 					} else if (IS_INT_INSIDE(gfx,  71,  75)) { // Bus
       
  1385 						st = STATION_BUS;
       
  1386 						SetStationGfx(t, gfx - 71);
       
  1387 					} else if (gfx == 75) {                    // Oil rig
       
  1388 						st = STATION_OILRIG;
       
  1389 						SetStationGfx(t, gfx - 75);
       
  1390 					} else if (IS_INT_INSIDE(gfx,  76,  82)) { // Dock
       
  1391 						st = STATION_DOCK;
       
  1392 						SetStationGfx(t, gfx - 76);
       
  1393 					} else if (gfx == 82) {                    // Buoy
       
  1394 						st = STATION_BUOY;
       
  1395 						SetStationGfx(t, gfx - 82);
       
  1396 					} else if (IS_INT_INSIDE(gfx,  83, 168)) { // Extended airport
       
  1397 						st = STATION_AIRPORT;
       
  1398 						SetStationGfx(t, gfx - 83 + 67 - 8);
       
  1399 					} else if (IS_INT_INSIDE(gfx, 168, 170)) { // Drive through truck
       
  1400 						st = STATION_TRUCK;
       
  1401 						SetStationGfx(t, gfx - 168 + GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET);
       
  1402 					} else if (IS_INT_INSIDE(gfx, 170, 172)) { // Drive through bus
       
  1403 						st = STATION_BUS;
       
  1404 						SetStationGfx(t, gfx - 170 + GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET);
       
  1405 					} else {
       
  1406 						return false;
       
  1407 					}
       
  1408 					SB(_m[t].m6, 3, 3, st);
       
  1409 				} break;
       
  1410 			}
       
  1411 		}
       
  1412 	}
       
  1413 
  1361 	for (TileIndex t = 0; t < map_size; t++) {
  1414 	for (TileIndex t = 0; t < map_size; t++) {
  1362 		switch (GetTileType(t)) {
  1415 		switch (GetTileType(t)) {
  1363 			case MP_STATION: {
  1416 			case MP_STATION: {
  1364 				Station *st = GetStationByTile(t);
  1417 				Station *st = GetStationByTile(t);
  1365 
  1418 
  2084 		/* Added variables to support newindustries */
  2137 		/* Added variables to support newindustries */
  2085 		Industry *i;
  2138 		Industry *i;
  2086 		FOR_ALL_INDUSTRIES(i) i->founder = OWNER_NONE;
  2139 		FOR_ALL_INDUSTRIES(i) i->founder = OWNER_NONE;
  2087 	}
  2140 	}
  2088 
  2141 
  2089 	if (CheckSavegameVersion(72)) {
       
  2090 		/* Locks/shiplifts in very old savegames had OWNER_WATER as owner */
       
  2091 		for (TileIndex t = 0; t < MapSize(); t++) {
       
  2092 			if (IsTileType(t, MP_WATER) && GetWaterTileType(t) == WATER_TILE_LOCK &&
       
  2093 					GetTileOwner(t) == OWNER_WATER) {
       
  2094 				SetTileOwner(t, OWNER_NONE);
       
  2095 			}
       
  2096 		}
       
  2097 	}
       
  2098 
       
  2099 	/* Recalculate */
  2142 	/* Recalculate */
  2100 	Group *g;
  2143 	Group *g;
  2101 	FOR_ALL_GROUPS(g) {
  2144 	FOR_ALL_GROUPS(g) {
  2102 		const Vehicle *v;
  2145 		const Vehicle *v;
  2103 		FOR_ALL_VEHICLES(v) {
  2146 		FOR_ALL_VEHICLES(v) {