src/oldloader.cpp
changeset 7127 8d8bb32f17f8
parent 7057 61e90db7d804
child 7132 08abbae3073e
equal deleted inserted replaced
7126:1e7994aa1767 7127:8d8bb32f17f8
   327 	Vehicle* v;
   327 	Vehicle* v;
   328 
   328 
   329 	FOR_ALL_VEHICLES(v) {
   329 	FOR_ALL_VEHICLES(v) {
   330 		Vehicle *u;
   330 		Vehicle *u;
   331 
   331 
       
   332 		/* We haven't used this bit for stations for ages */
       
   333 		if (v->type == VEH_ROAD) CLRBIT(v->u.road.state, RVS_IS_STOPPING);
       
   334 
   332 		FOR_ALL_VEHICLES_FROM(u, v->index + 1) {
   335 		FOR_ALL_VEHICLES_FROM(u, v->index + 1) {
   333 			/* If a vehicle has the same orders, add the link to eachother
   336 			/* If a vehicle has the same orders, add the link to eachother
   334 			 * in both vehicles */
   337 			 * in both vehicles */
   335 			if (v->orders == u->orders) {
   338 			if (v->orders == u->orders) {
   336 				v->next_shared = u;
   339 				v->next_shared = u;
   619 
   622 
   620 	OCL_END()
   623 	OCL_END()
   621 };
   624 };
   622 static bool LoadOldStation(LoadgameState *ls, int num)
   625 static bool LoadOldStation(LoadgameState *ls, int num)
   623 {
   626 {
   624 	Station *st;
   627 	Station *st = new (num) Station();
   625 
       
   626 	if (!AddBlockIfNeeded(&_Station_pool, num))
       
   627 		error("Stations: failed loading savegame: too many stations");
       
   628 
       
   629 	st = GetStation(num);
       
   630 	_current_station_id = num;
   628 	_current_station_id = num;
   631 
   629 
   632 	if (!LoadChunk(ls, st, station_chunk))
   630 	if (!LoadChunk(ls, st, station_chunk))
   633 		return false;
   631 		return false;
   634 
   632 
  1552 		_m[i].m4 = _old_map3[i * 2 + 1];
  1550 		_m[i].m4 = _old_map3[i * 2 + 1];
  1553 	}
  1551 	}
  1554 
  1552 
  1555 	for (i = 0; i < OLD_MAP_SIZE; i ++) {
  1553 	for (i = 0; i < OLD_MAP_SIZE; i ++) {
  1556 		switch (GetTileType(i)) {
  1554 		switch (GetTileType(i)) {
       
  1555 			case MP_STATION:
       
  1556 				_m[i].m4 = 0; // We do not understand this TTDP station mapping (yet)
       
  1557 				switch (_m[i].m5) {
       
  1558 					/* We have drive through stops at a totally different place */
       
  1559 					case 0x53: case 0x54: _m[i].m5 += GFX_BUS_BASE_EXT   - 0x53; break;
       
  1560 					case 0x57: case 0x58: _m[i].m5 += GFX_TRUCK_BASE_EXT - 0x57; break;
       
  1561 					case 0x55: case 0x56: // Bus tram stop
       
  1562 					case 0x59: case 0x5A: // Truck tram stop
       
  1563 						DEBUG(oldloader, 0, "Loading failed - we don't support trams (yet)");
       
  1564 						return false;
       
  1565 				}
       
  1566 				break;
       
  1567 
  1557 			case MP_RAILWAY:
  1568 			case MP_RAILWAY:
  1558 				/* We save presignals different from TTDPatch, convert them */
  1569 				/* We save presignals different from TTDPatch, convert them */
  1559 				if (GetRailTileType(i) == RAIL_TILE_SIGNALS) {
  1570 				if (GetRailTileType(i) == RAIL_TILE_SIGNALS) {
  1560 					/* This byte is always zero in TTD for this type of tile */
  1571 					/* This byte is always zero in TTD for this type of tile */
  1561 					if (_m[i].m4) /* Convert the presignals to our own format */
  1572 					if (_m[i].m4) /* Convert the presignals to our own format */