openttd.c
changeset 2670 34970983ef08
parent 2649 7cd504bd4e51
child 2672 ea469d7b34ff
equal deleted inserted replaced
2669:2f69f91002ac 2670:34970983ef08
  1285 				v->u.rail.shortest_platform[1] = 0;
  1285 				v->u.rail.shortest_platform[1] = 0;
  1286 			}
  1286 			}
  1287 		}
  1287 		}
  1288 	}
  1288 	}
  1289 
  1289 
       
  1290 	/* In version 17, ground type is moved from m2 to m4 for depots and
       
  1291 	 * waypoints to make way for storing the index in m2. The custom graphics
       
  1292 	 * id which was stored in m4 is now saved as a grf/id reference in the
       
  1293 	 * waypoint struct. */
       
  1294 	if (version < 0x1100) {
       
  1295 		Waypoint *wp;
       
  1296 
       
  1297 		FOR_ALL_WAYPOINTS(wp) {
       
  1298 			if (wp->xy != 0 && wp->deleted == 0) {
       
  1299 				const StationSpec *spec = NULL;
       
  1300 
       
  1301 				if (HASBIT(_m[wp->xy].m3, 4))
       
  1302 					spec = GetCustomStation(STAT_CLASS_WAYP, _m[wp->xy].m4 + 1);
       
  1303 
       
  1304 				if (spec != NULL) {
       
  1305 					wp->stat_id = _m[wp->xy].m4 + 1;
       
  1306 					wp->grfid = spec->grfid;
       
  1307 					wp->localidx = spec->localidx;
       
  1308 				} else {
       
  1309 					// No custom graphics set, so set to default.
       
  1310 					wp->stat_id = 0;
       
  1311 					wp->grfid = 0;
       
  1312 					wp->localidx = 0;
       
  1313 				}
       
  1314 
       
  1315 				// Move ground type bits from m2 to m4.
       
  1316 				_m[wp->xy].m4 = GB(_m[wp->xy].m2, 0, 4);
       
  1317 				// Store waypoint index in the tile.
       
  1318 				_m[wp->xy].m2 = wp->index;
       
  1319 			}
       
  1320 		}
       
  1321 	} else {
       
  1322 		/* As of version 17, we recalculate the custom graphic ID of waypoints
       
  1323 		 * from the GRF ID / station index. */
       
  1324 		UpdateAllWaypointCustomGraphics();
       
  1325 	}
       
  1326 
  1290 	FOR_ALL_PLAYERS(p) p->avail_railtypes = GetPlayerRailtypes(p->index);
  1327 	FOR_ALL_PLAYERS(p) p->avail_railtypes = GetPlayerRailtypes(p->index);
  1291 
  1328 
  1292 	return true;
  1329 	return true;
  1293 }
  1330 }