(svn r22540) -Codechange: Rename AcceptancePickup to GoodsEntryStatus.

pull/155/head
terkhen 13 years ago
parent 69a6e17837
commit 55695277c8

@ -1180,7 +1180,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
payment->SetCargo(v->cargo_type);
if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.GetUnloadType() & OUFB_TRANSFER)) {
if (HasBit(ge->acceptance_pickup, GoodsEntry::GES_ACCEPTANCE) && !(u->current_order.GetUnloadType() & OUFB_TRANSFER)) {
/* The cargo has reached its final destination, the packets may now be destroyed */
remaining = v->cargo.MoveTo<StationCargoList>(NULL, amount_unloaded, VehicleCargoList::MTA_FINAL_DELIVERY, payment, last_visited);
@ -1195,9 +1195,9 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
* accept cargo that was loaded at the same station. */
if ((u->current_order.GetUnloadType() & (OUFB_UNLOAD | OUFB_TRANSFER)) && (!accepted || v->cargo.Count() == cargo_count)) {
remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded, u->current_order.GetUnloadType() & OUFB_TRANSFER ? VehicleCargoList::MTA_TRANSFER : VehicleCargoList::MTA_UNLOAD, payment);
if (!HasBit(ge->acceptance_pickup, GoodsEntry::PICKUP)) {
if (!HasBit(ge->acceptance_pickup, GoodsEntry::GES_PICKUP)) {
InvalidateWindowData(WC_STATION_LIST, last_visited);
SetBit(ge->acceptance_pickup, GoodsEntry::PICKUP);
SetBit(ge->acceptance_pickup, GoodsEntry::GES_PICKUP);
}
dirty_vehicle = dirty_station = true;

@ -381,7 +381,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject *object, byte variable, b
uint32 value = 0;
for (cargo_type = 0; cargo_type < NUM_CARGO; cargo_type++) {
if (HasBit(this->goods[cargo_type].acceptance_pickup, GoodsEntry::PICKUP)) SetBit(value, cargo_type);
if (HasBit(this->goods[cargo_type].acceptance_pickup, GoodsEntry::GES_PICKUP)) SetBit(value, cargo_type);
}
return value;
}
@ -407,7 +407,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject *object, byte variable, b
case 0x62: return ge->rating;
case 0x63: return ge->cargo.DaysInTransit();
case 0x64: return ge->last_speed | (ge->last_age << 8);
case 0x65: return GB(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE, 1) << 3;
case 0x65: return GB(ge->acceptance_pickup, GoodsEntry::GES_ACCEPTANCE, 1) << 3;
}
}
@ -416,7 +416,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject *object, byte variable, b
const GoodsEntry *g = &this->goods[GB(variable - 0x8C, 3, 4)];
switch (GB(variable - 0x8C, 0, 3)) {
case 0: return g->cargo.Count();
case 1: return GB(min(g->cargo.Count(), 4095), 0, 4) | (GB(g->acceptance_pickup, GoodsEntry::ACCEPTANCE, 1) << 7);
case 1: return GB(min(g->cargo.Count(), 4095), 0, 4) | (GB(g->acceptance_pickup, GoodsEntry::GES_ACCEPTANCE, 1) << 7);
case 2: return g->days_since_pickup;
case 3: return g->rating;
case 4: return g->cargo.Source();

@ -1525,7 +1525,7 @@ bool AfterLoadGame()
FOR_ALL_STATIONS(st) {
for (CargoID c = 0; c < NUM_CARGO; c++) {
st->goods[c].last_speed = 0;
if (st->goods[c].cargo.Count() != 0) SetBit(st->goods[c].acceptance_pickup, GoodsEntry::PICKUP);
if (st->goods[c].cargo.Count() != 0) SetBit(st->goods[c].acceptance_pickup, GoodsEntry::GES_PICKUP);
}
}
}

@ -708,8 +708,8 @@ static bool LoadOldGood(LoadgameState *ls, int num)
if (!LoadChunk(ls, ge, goods_chunk)) return false;
SB(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
SB(ge->acceptance_pickup, GoodsEntry::PICKUP, 1, _cargo_source != 0xFF);
SB(ge->acceptance_pickup, GoodsEntry::GES_ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
SB(ge->acceptance_pickup, GoodsEntry::GES_PICKUP, 1, _cargo_source != 0xFF);
if (GB(_waiting_acceptance, 0, 12) != 0 && CargoPacket::CanAllocateItem()) {
ge->cargo.Append(new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days, (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, 0, 0));
}

@ -282,7 +282,7 @@ static void Load_STNS()
GoodsEntry *ge = &st->goods[i];
SlObject(ge, GetGoodsDesc());
if (IsSavegameVersionBefore(68)) {
SB(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
SB(ge->acceptance_pickup, GoodsEntry::GES_ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
if (GB(_waiting_acceptance, 0, 12) != 0) {
/* In old versions, enroute_from used 0xFF as INVALID_STATION */
StationID source = (IsSavegameVersionBefore(7) && _cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
@ -293,7 +293,7 @@ static void Load_STNS()
* 16 million entries; it fits by an order of magnitude. */
assert(CargoPacket::CanAllocateItem());
ge->cargo.Append(new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days, source, _cargo_source_xy, _cargo_source_xy, _cargo_feeder_share));
SB(ge->acceptance_pickup, GoodsEntry::PICKUP, 1, 1);
SB(ge->acceptance_pickup, GoodsEntry::GES_PICKUP, 1, 1);
}
}
}

@ -24,9 +24,9 @@ extern StationPool _station_pool;
static const byte INITIAL_STATION_RATING = 175;
struct GoodsEntry {
enum AcceptancePickup {
ACCEPTANCE,
PICKUP
enum GoodsEntryStatus {
GES_ACCEPTANCE,
GES_PICKUP,
};
GoodsEntry() :

@ -446,7 +446,7 @@ static uint GetAcceptanceMask(const Station *st)
uint mask = 0;
for (CargoID i = 0; i < NUM_CARGO; i++) {
if (HasBit(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE)) mask |= 1 << i;
if (HasBit(st->goods[i].acceptance_pickup, GoodsEntry::GES_ACCEPTANCE)) mask |= 1 << i;
}
return mask;
}
@ -588,7 +588,7 @@ void UpdateStationAcceptance(Station *st, bool show_msg)
amt = 0;
}
SB(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE, 1, amt >= 8);
SB(st->goods[i].acceptance_pickup, GoodsEntry::GES_ACCEPTANCE, 1, amt >= 8);
}
/* Only show a message in case the acceptance was actually changed. */
@ -3025,12 +3025,12 @@ static void UpdateStationRating(Station *st)
/* Slowly increase the rating back to his original level in the case we
* didn't deliver cargo yet to this station. This happens when a bribe
* failed while you didn't moved that cargo yet to a station. */
if (!HasBit(ge->acceptance_pickup, GoodsEntry::PICKUP) && ge->rating < INITIAL_STATION_RATING) {
if (!HasBit(ge->acceptance_pickup, GoodsEntry::GES_PICKUP) && ge->rating < INITIAL_STATION_RATING) {
ge->rating++;
}
/* Only change the rating if we are moving this cargo */
if (HasBit(ge->acceptance_pickup, GoodsEntry::PICKUP)) {
if (HasBit(ge->acceptance_pickup, GoodsEntry::GES_PICKUP)) {
byte_inc_sat(&ge->days_since_pickup);
bool skip = false;
@ -3211,9 +3211,9 @@ static uint UpdateStationWaiting(Station *st, CargoID type, uint amount, SourceT
ge.cargo.Append(new CargoPacket(st->index, st->xy, amount, source_type, source_id));
if (!HasBit(ge.acceptance_pickup, GoodsEntry::PICKUP)) {
if (!HasBit(ge.acceptance_pickup, GoodsEntry::GES_PICKUP)) {
InvalidateWindowData(WC_STATION_LIST, st->index);
SetBit(ge.acceptance_pickup, GoodsEntry::PICKUP);
SetBit(ge.acceptance_pickup, GoodsEntry::GES_PICKUP);
}
TriggerStationAnimation(st, st->xy, SAT_NEW_CARGO, type);

@ -238,7 +238,7 @@ protected:
if (this->facilities & st->facilities) { // only stations with selected facilities
int num_waiting_cargo = 0;
for (CargoID j = 0; j < NUM_CARGO; j++) {
if (HasBit(st->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) {
if (HasBit(st->goods[j].acceptance_pickup, GoodsEntry::GES_PICKUP)) {
num_waiting_cargo++; // count number of waiting cargo
if (HasBit(this->cargo_filter, j)) {
*this->stations.Append() = st;
@ -306,8 +306,8 @@ protected:
CargoID j;
FOR_EACH_SET_CARGO_ID(j, cargo_filter) {
if (HasBit((*a)->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr1 = max(maxr1, (*a)->goods[j].rating);
if (HasBit((*b)->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr2 = max(maxr2, (*b)->goods[j].rating);
if (HasBit((*a)->goods[j].acceptance_pickup, GoodsEntry::GES_PICKUP)) maxr1 = max(maxr1, (*a)->goods[j].rating);
if (HasBit((*b)->goods[j].acceptance_pickup, GoodsEntry::GES_PICKUP)) maxr2 = max(maxr2, (*b)->goods[j].rating);
}
return maxr1 - maxr2;
@ -321,8 +321,8 @@ protected:
for (CargoID j = 0; j < NUM_CARGO; j++) {
if (!HasBit(cargo_filter, j)) continue;
if (HasBit((*a)->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) minr1 = min(minr1, (*a)->goods[j].rating);
if (HasBit((*b)->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) minr2 = min(minr2, (*b)->goods[j].rating);
if (HasBit((*a)->goods[j].acceptance_pickup, GoodsEntry::GES_PICKUP)) minr1 = min(minr1, (*a)->goods[j].rating);
if (HasBit((*b)->goods[j].acceptance_pickup, GoodsEntry::GES_PICKUP)) minr2 = min(minr2, (*b)->goods[j].rating);
}
return -(minr1 - minr2);
@ -1112,7 +1112,7 @@ struct StationViewWindow : public Window {
uint32 cargo_mask = 0;
for (CargoID i = 0; i < NUM_CARGO; i++) {
if (HasBit(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE)) SetBit(cargo_mask, i);
if (HasBit(st->goods[i].acceptance_pickup, GoodsEntry::GES_ACCEPTANCE)) SetBit(cargo_mask, i);
}
Rect s = {r.left + WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, r.right - WD_FRAMERECT_RIGHT, INT32_MAX};
int bottom = DrawCargoListText(cargo_mask, s, STR_STATION_VIEW_ACCEPTS_CARGO);
@ -1135,7 +1135,7 @@ struct StationViewWindow : public Window {
const CargoSpec *cs;
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
const GoodsEntry *ge = &st->goods[cs->Index()];
if (!HasBit(ge->acceptance_pickup, GoodsEntry::PICKUP)) continue;
if (!HasBit(ge->acceptance_pickup, GoodsEntry::GES_PICKUP)) continue;
SetDParam(0, cs->name);
SetDParam(2, ToPercent8(ge->rating));

Loading…
Cancel
Save