src/oldloader.cpp
changeset 9331 f67d4fd5ed5d
parent 9289 92f1249c304e
child 9332 2e120d0bd632
equal deleted inserted replaced
9330:828cc0ca9654 9331:f67d4fd5ed5d
   502 
   502 
   503 static bool LoadOldOrder(LoadgameState *ls, int num)
   503 static bool LoadOldOrder(LoadgameState *ls, int num)
   504 {
   504 {
   505 	if (!LoadChunk(ls, NULL, order_chunk)) return false;
   505 	if (!LoadChunk(ls, NULL, order_chunk)) return false;
   506 
   506 
   507 	AssignOrder(new (num) Order(), UnpackOldOrder(_old_order));
   507 	(new (num) Order())->AssignOrder(UnpackOldOrder(_old_order));
   508 
   508 
   509 	/* Relink the orders to eachother (in TTD(Patch) the orders for one
   509 	/* Relink the orders to eachother (in TTD(Patch) the orders for one
   510 	vehicle are behind eachother, with an invalid order (OT_NOTHING) as indication that
   510 	vehicle are behind eachother, with an invalid order (OT_NOTHING) as indication that
   511 	it is the last order */
   511 	it is the last order */
   512 	if (num > 0 && GetOrder(num)->IsValid())
   512 	if (num > 0 && GetOrder(num)->IsValid())
  1246 			 * we go over that limit something is very wrong. In that case
  1246 			 * we go over that limit something is very wrong. In that case
  1247 			 * we just assume there are no orders for the vehicle.
  1247 			 * we just assume there are no orders for the vehicle.
  1248 			 */
  1248 			 */
  1249 			if (old_id < 5000) v->orders = GetOrder(old_id);
  1249 			if (old_id < 5000) v->orders = GetOrder(old_id);
  1250 		}
  1250 		}
  1251 		AssignOrder(&v->current_order, UnpackOldOrder(_old_order));
  1251 		v->current_order.AssignOrder(UnpackOldOrder(_old_order));
  1252 
  1252 
  1253 		/* For some reason we need to correct for this */
  1253 		/* For some reason we need to correct for this */
  1254 		switch (v->spritenum) {
  1254 		switch (v->spritenum) {
  1255 			case 0xfd: break;
  1255 			case 0xfd: break;
  1256 			case 0xff: v->spritenum = 0xfe; break;
  1256 			case 0xff: v->spritenum = 0xfe; break;