mirror of https://github.com/OpenTTD/OpenTTD
(svn r3030) More work for GB/SB, this time concerning the waiting_acceptance attribute of stations
parent
6fb7381efa
commit
9fea263c77
|
@ -1244,7 +1244,7 @@ static void MaybeCrashAirplane(Vehicle *v)
|
|||
// Crash the airplane. Remove all goods stored at the station.
|
||||
for(i=0; i!=NUM_CARGO; i++) {
|
||||
st->goods[i].rating = 1;
|
||||
st->goods[i].waiting_acceptance &= ~0xFFF;
|
||||
SB(st->goods[i].waiting_acceptance, 0, 12, 0);
|
||||
}
|
||||
|
||||
CrashAirplane(v);
|
||||
|
|
|
@ -1364,7 +1364,8 @@ int LoadUnloadVehicle(Vehicle *v)
|
|||
|
||||
|
||||
unloading_time += v->cargo_count;
|
||||
if ((t=ge->waiting_acceptance & 0xFFF) == 0) {
|
||||
t = GB(ge->waiting_acceptance, 0, 12);
|
||||
if (t == 0) {
|
||||
// No goods waiting at station
|
||||
ge->enroute_time = v->cargo_days;
|
||||
ge->enroute_from = v->cargo_source;
|
||||
|
@ -1376,7 +1377,7 @@ int LoadUnloadVehicle(Vehicle *v)
|
|||
ge->enroute_from = v->cargo_source;
|
||||
}
|
||||
// Update amount of waiting cargo
|
||||
ge->waiting_acceptance = (ge->waiting_acceptance &~0xFFF) | min(v->cargo_count + t, 0xFFF);
|
||||
SB(ge->waiting_acceptance, 0, 12, min(v->cargo_count + t, 0xFFF));
|
||||
ge->feeder_profit += v_profit;
|
||||
u->profit_this_year += v_profit;
|
||||
result |= 2;
|
||||
|
@ -1402,7 +1403,8 @@ int LoadUnloadVehicle(Vehicle *v)
|
|||
|
||||
// If there's goods waiting at the station, and the vehicle
|
||||
// has capacity for it, load it on the vehicle.
|
||||
if ((count=ge->waiting_acceptance & 0xFFF) != 0 &&
|
||||
count = GB(ge->waiting_acceptance, 0, 12);
|
||||
if (count != 0 &&
|
||||
(cap = v->cargo_cap - v->cargo_count) != 0) {
|
||||
int cargoshare;
|
||||
int feeder_profit_share;
|
||||
|
|
|
@ -711,7 +711,7 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
|
|||
(i == CT_PASSENGERS && !(st->facilities & (byte)~FACIL_TRUCK_STOP)))
|
||||
amt = 0;
|
||||
|
||||
st->goods[i].waiting_acceptance = (st->goods[i].waiting_acceptance & ~0xF000) + (amt << 12);
|
||||
SB(st->goods[i].waiting_acceptance, 12, 4, amt);
|
||||
}
|
||||
|
||||
// Only show a message in case the acceptance was actually changed.
|
||||
|
@ -2590,7 +2590,7 @@ static void UpdateStationRating(Station *st)
|
|||
}
|
||||
|
||||
{
|
||||
waiting = ge->waiting_acceptance & 0xFFF;
|
||||
waiting = GB(ge->waiting_acceptance, 0, 12);
|
||||
(rating -= 90, waiting > 1500) ||
|
||||
(rating += 55, waiting > 1000) ||
|
||||
(rating += 35, waiting > 600) ||
|
||||
|
@ -2622,8 +2622,7 @@ static void UpdateStationRating(Station *st)
|
|||
}
|
||||
}
|
||||
|
||||
if (waiting_changed)
|
||||
ge->waiting_acceptance = (ge->waiting_acceptance & ~0xFFF) + waiting;
|
||||
if (waiting_changed) SB(ge->waiting_acceptance, 0, 12, waiting);
|
||||
}
|
||||
}
|
||||
} while (++ge != endof(st->goods));
|
||||
|
@ -2701,9 +2700,9 @@ void ModifyStationRatingAround(TileIndex tile, PlayerID owner, int amount, uint
|
|||
|
||||
static void UpdateStationWaiting(Station *st, int type, uint amount)
|
||||
{
|
||||
st->goods[type].waiting_acceptance =
|
||||
(st->goods[type].waiting_acceptance & ~0xFFF) +
|
||||
min(0xFFF, (st->goods[type].waiting_acceptance & 0xFFF) + amount);
|
||||
SB(st->goods[type].waiting_acceptance, 0, 12,
|
||||
min(0xFFF, GB(st->goods[type].waiting_acceptance, 0, 12) + amount)
|
||||
);
|
||||
|
||||
st->goods[type].enroute_time = 0;
|
||||
st->goods[type].enroute_from = st->index;
|
||||
|
|
|
@ -188,7 +188,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
|
|||
|
||||
// show cargo waiting and station ratings
|
||||
for(j=0; j!=NUM_CARGO; j++) {
|
||||
int acc = (st->goods[j].waiting_acceptance & 0xFFF);
|
||||
int acc = GB(st->goods[j].waiting_acceptance, 0, 12);
|
||||
if (acc != 0) {
|
||||
StationsWndShowStationRating(x, y, j, acc, st->goods[j].rating);
|
||||
x += 10;
|
||||
|
@ -324,7 +324,7 @@ static void DrawStationViewWindow(Window *w)
|
|||
|
||||
num = 1;
|
||||
for(i=0; i!=NUM_CARGO; i++) {
|
||||
if ((st->goods[i].waiting_acceptance & 0xFFF) != 0) {
|
||||
if (GB(st->goods[i].waiting_acceptance, 0, 12) != 0) {
|
||||
num++;
|
||||
if (st->goods[i].enroute_from != station_id)
|
||||
num++;
|
||||
|
@ -351,8 +351,7 @@ static void DrawStationViewWindow(Window *w)
|
|||
if (--pos < 0) {
|
||||
str = STR_00D0_NOTHING;
|
||||
for(i=0; i!=NUM_CARGO; i++)
|
||||
if (st->goods[i].waiting_acceptance & 0xFFF)
|
||||
str = STR_EMPTY;
|
||||
if (GB(st->goods[i].waiting_acceptance, 0, 12) != 0) str = STR_EMPTY;
|
||||
SetDParam(0, str);
|
||||
DrawString(x, y, STR_0008_WAITING, 0);
|
||||
y += 10;
|
||||
|
@ -360,7 +359,7 @@ static void DrawStationViewWindow(Window *w)
|
|||
|
||||
i = 0;
|
||||
do {
|
||||
uint waiting = (st->goods[i].waiting_acceptance & 0xFFF);
|
||||
uint waiting = GB(st->goods[i].waiting_acceptance, 0, 12);
|
||||
if (waiting == 0)
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Reference in New Issue