(svn r17807) -Codechange: move all 'updates' just after the 'load' constructor of CargoPackets to the constructor call itself

This commit is contained in:
rubidium
2009-10-18 17:52:44 +00:00
parent 4ad30fecde
commit f11cebfe9b
5 changed files with 19 additions and 28 deletions

View File

@@ -698,9 +698,7 @@ static bool LoadOldGood(LoadgameState *ls, int num)
SB(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
SB(ge->acceptance_pickup, GoodsEntry::PICKUP, 1, _cargo_source != 0xFF);
if (GB(_waiting_acceptance, 0, 12) != 0) {
CargoPacket *cp = new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days);
cp->source = (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
ge->cargo.Append(cp);
ge->cargo.Append(new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days, (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, 0, 0));
}
return true;
@@ -1330,13 +1328,9 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
v->next = (Vehicle *)(size_t)_old_next_ptr;
if (_cargo_count != 0) {
CargoPacket *cp = new CargoPacket(_cargo_count, _cargo_days);
cp->source = (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
cp->source_xy = (cp->source != INVALID_STATION) ? Station::Get(cp->source)->xy : 0;
cp->loaded_at_xy = cp->source_xy;
cp->source_type = ST_INDUSTRY;
cp->source_id = INVALID_SOURCE;
v->cargo.Append(cp);
StationID source = (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
TileIndex source_xy = (source != INVALID_STATION) ? Station::Get(source)->xy : 0;
v->cargo.Append(new CargoPacket(_cargo_count, _cargo_days, source, source_xy, source_xy));
}
}