src/oldloader.cpp
changeset 6585 7da94b26498a
parent 6574 e1d1a12faaf7
child 6589 addf4b6946d0
equal deleted inserted replaced
6584:85b9e0da5754 6585:7da94b26498a
  1066 
  1066 
  1067 	/* We changed the offset of the vehicle types, so fix it
  1067 	/* We changed the offset of the vehicle types, so fix it
  1068 	 * Basically v->type -= 0x10; would suffice, but play safely */
  1068 	 * Basically v->type -= 0x10; would suffice, but play safely */
  1069 	switch (v->type) {
  1069 	switch (v->type) {
  1070 		default: NOT_REACHED();
  1070 		default: NOT_REACHED();
  1071 		case 0x00 /*VEH_Invalid */: v->type = VEH_Invalid;  res = LoadChunk(ls, NULL,           vehicle_empty_chunk);    break;
  1071 		case 0x00 /*VEH_INVALID */: v->type = VEH_INVALID;  res = LoadChunk(ls, NULL,           vehicle_empty_chunk);    break;
  1072 		case 0x10 /*VEH_Train   */: v->type = VEH_Train;    res = LoadChunk(ls, &v->u.rail,     vehicle_train_chunk);    break;
  1072 		case 0x10 /*VEH_TRAIN   */: v->type = VEH_TRAIN;    res = LoadChunk(ls, &v->u.rail,     vehicle_train_chunk);    break;
  1073 		case 0x11 /*VEH_Road    */: v->type = VEH_Road;     res = LoadChunk(ls, &v->u.road,     vehicle_road_chunk);     break;
  1073 		case 0x11 /*VEH_ROAD    */: v->type = VEH_ROAD;     res = LoadChunk(ls, &v->u.road,     vehicle_road_chunk);     break;
  1074 		case 0x12 /*VEH_Ship    */: v->type = VEH_Ship;     res = LoadChunk(ls, &v->u.ship,     vehicle_ship_chunk);     break;
  1074 		case 0x12 /*VEH_SHIP    */: v->type = VEH_SHIP;     res = LoadChunk(ls, &v->u.ship,     vehicle_ship_chunk);     break;
  1075 		case 0x13 /*VEH_Aircraft*/: v->type = VEH_Aircraft; res = LoadChunk(ls, &v->u.air,      vehicle_air_chunk);      break;
  1075 		case 0x13 /*VEH_AIRCRAFT*/: v->type = VEH_AIRCRAFT; res = LoadChunk(ls, &v->u.air,      vehicle_air_chunk);      break;
  1076 		case 0x14 /*VEH_Special */: v->type = VEH_Special;  res = LoadChunk(ls, &v->u.special,  vehicle_special_chunk);  break;
  1076 		case 0x14 /*VEH_SPECIAL */: v->type = VEH_SPECIAL;  res = LoadChunk(ls, &v->u.special,  vehicle_special_chunk);  break;
  1077 		case 0x15 /*VEH_Disaster*/: v->type = VEH_Disaster; res = LoadChunk(ls, &v->u.disaster, vehicle_disaster_chunk); break;
  1077 		case 0x15 /*VEH_DISASTER*/: v->type = VEH_DISASTER; res = LoadChunk(ls, &v->u.disaster, vehicle_disaster_chunk); break;
  1078 	}
  1078 	}
  1079 
  1079 
  1080 	/* This chunk size should always be 10 bytes */
  1080 	/* This chunk size should always be 10 bytes */
  1081 	if (ls->total_read - temp != 10) {
  1081 	if (ls->total_read - temp != 10) {
  1082 		DEBUG(oldloader, 0, "Assert failed in VehicleUnion: invalid chunk size");
  1082 		DEBUG(oldloader, 0, "Assert failed in VehicleUnion: invalid chunk size");
  1207 		if (_old_next_ptr != 0xFFFF) v->next = GetVehicle(_old_next_ptr);
  1207 		if (_old_next_ptr != 0xFFFF) v->next = GetVehicle(_old_next_ptr);
  1208 
  1208 
  1209 		v->string_id = RemapOldStringID(_old_string_id);
  1209 		v->string_id = RemapOldStringID(_old_string_id);
  1210 
  1210 
  1211 		/* Vehicle-subtype is different in TTD(Patch) */
  1211 		/* Vehicle-subtype is different in TTD(Patch) */
  1212 		if (v->type == VEH_Special) v->subtype = v->subtype >> 1;
  1212 		if (v->type == VEH_SPECIAL) v->subtype = v->subtype >> 1;
  1213 	}
  1213 	}
  1214 
  1214 
  1215 	return true;
  1215 	return true;
  1216 }
  1216 }
  1217 
  1217