oldloader.c
changeset 1313 bba6afb8a995
parent 1284 06a52178bf46
child 1314 d6a253cf92c3
equal deleted inserted replaced
1312:8defbb525d09 1313:bba6afb8a995
     9 #include "economy.h"
     9 #include "economy.h"
    10 #include "player.h"
    10 #include "player.h"
    11 #include "engine.h"
    11 #include "engine.h"
    12 #include "vehicle.h"
    12 #include "vehicle.h"
    13 #include "signs.h"
    13 #include "signs.h"
       
    14 #include "depot.h"
    14 
    15 
    15 extern byte _name_array[512][32];
    16 extern byte _name_array[512][32];
    16 extern TileIndex _animated_tile_list[256];
    17 extern TileIndex _animated_tile_list[256];
    17 extern uint16 _custom_sprites_base;
    18 extern uint16 _custom_sprites_base;
    18 
    19 
   775 		s->airport_flags = o->airport_flags;
   776 		s->airport_flags = o->airport_flags;
   776 		s->last_vehicle = o->last_vehicle;
   777 		s->last_vehicle = o->last_vehicle;
   777 	} while (i++,o++,--num);
   778 	} while (i++,o++,--num);
   778 }
   779 }
   779 
   780 
   780 static void FixDepot(Depot *n, OldDepot *o, int num)
   781 static void FixDepot(OldDepot *o, int num)
   781 {
   782 {
       
   783 	Depot *depot;
       
   784 	uint i = 0;
       
   785 
   782 	do {
   786 	do {
   783 		if (o->xy == 0)
   787 		if (o->xy == 0)
   784 			continue;
   788 			continue;
   785 
   789 
   786 		n->town_index = REMAP_TOWN_IDX(o->town);
   790 		if (!AddBlockIfNeeded(&_depot_pool, i))
   787 		n->xy = o->xy;
   791 			error("Depots: failed loading savegame: too many depots");
   788 	} while (n++,o++,--num);
   792 
       
   793 		depot = GetDepot(i);
       
   794 
       
   795 		depot->town_index = REMAP_TOWN_IDX(o->town);
       
   796 		depot->xy = o->xy;
       
   797 	} while (i++,o++,--num);
   789 }
   798 }
   790 
   799 
   791 static void FixOrder(uint16 *o, int num)
   800 static void FixOrder(uint16 *o, int num)
   792 {
   801 {
   793 	Order *order;
   802 	Order *order;
  1531 
  1540 
  1532 	FixTown(m->town_list, lengthof(m->town_list), m->town_name_type);
  1541 	FixTown(m->town_list, lengthof(m->town_list), m->town_name_type);
  1533 	FixIndustry(m->industries, lengthof(m->industries));
  1542 	FixIndustry(m->industries, lengthof(m->industries));
  1534 	FixStation(m->stations, lengthof(m->stations));
  1543 	FixStation(m->stations, lengthof(m->stations));
  1535 
  1544 
  1536 	FixDepot(_depots, m->depots, lengthof(m->depots));
  1545 	FixDepot(m->depots, lengthof(m->depots));
  1537 	FixOrder(m->order_list, lengthof(m->order_list));
  1546 	FixOrder(m->order_list, lengthof(m->order_list));
  1538 	FixVehicle(m->vehicles, lengthof(m->vehicles));
  1547 	FixVehicle(m->vehicles, lengthof(m->vehicles));
  1539 	FixSubsidy(_subsidies, m->subsidies, lengthof(m->subsidies));
  1548 	FixSubsidy(_subsidies, m->subsidies, lengthof(m->subsidies));
  1540 
  1549 
  1541 	FixPlayer(_players, m->players, lengthof(m->players), m->town_name_type);
  1550 	FixPlayer(_players, m->players, lengthof(m->players), m->town_name_type);