mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r24718) -Codechange: Rename GoodsEntry::days_since_pickup to GoodsEntry::time_since_pickup.
This commit is contained in:
parent
ce87b8fc63
commit
883f9bec9b
|
@ -1472,7 +1472,7 @@ static void LoadUnloadVehicle(Vehicle *front, int *cargo_left)
|
|||
/* if last speed is 0, we treat that as if no vehicle has ever visited the station. */
|
||||
ge->last_speed = min(t, 255);
|
||||
ge->last_age = min(_cur_year - front->build_year, 255);
|
||||
ge->days_since_pickup = 0;
|
||||
ge->time_since_pickup = 0;
|
||||
|
||||
/* If there's goods waiting at the station, and the vehicle
|
||||
* has capacity for it, load it on the vehicle. */
|
||||
|
|
|
@ -422,7 +422,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject *object, byte variable, b
|
|||
|
||||
switch (variable) {
|
||||
case 0x60: return min(ge->cargo.Count(), 4095);
|
||||
case 0x61: return ge->HasVehicleEverTriedLoading() ? ge->days_since_pickup : 0;
|
||||
case 0x61: return ge->HasVehicleEverTriedLoading() ? ge->time_since_pickup : 0;
|
||||
case 0x62: return HasBit(ge->acceptance_pickup, GoodsEntry::GES_PICKUP) ? ge->rating : 0xFFFFFFFF;
|
||||
case 0x63: return ge->cargo.DaysInTransit();
|
||||
case 0x64: return ge->HasVehicleEverTriedLoading() ? ge->last_speed | (ge->last_age << 8) : 0xFF00;
|
||||
|
@ -442,7 +442,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject *object, byte variable, b
|
|||
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::GES_ACCEPTANCE, 1) << 7);
|
||||
case 2: return g->days_since_pickup;
|
||||
case 2: return g->time_since_pickup;
|
||||
case 3: return g->rating;
|
||||
case 4: return g->cargo.Source();
|
||||
case 5: return g->cargo.DaysInTransit();
|
||||
|
|
|
@ -687,7 +687,7 @@ static uint8 _cargo_days;
|
|||
|
||||
static const OldChunks goods_chunk[] = {
|
||||
OCL_VAR ( OC_UINT16, 1, &_waiting_acceptance ),
|
||||
OCL_SVAR( OC_UINT8, GoodsEntry, days_since_pickup ),
|
||||
OCL_SVAR( OC_UINT8, GoodsEntry, time_since_pickup ),
|
||||
OCL_SVAR( OC_UINT8, GoodsEntry, rating ),
|
||||
OCL_VAR ( OC_UINT8, 1, &_cargo_source ),
|
||||
OCL_VAR ( OC_UINT8, 1, &_cargo_days ),
|
||||
|
|
|
@ -247,7 +247,7 @@ const SaveLoad *GetGoodsDesc()
|
|||
SLEG_CONDVAR( _waiting_acceptance, SLE_UINT16, 0, 67),
|
||||
SLE_CONDVAR(GoodsEntry, acceptance_pickup, SLE_UINT8, 68, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, 51, 67),
|
||||
SLE_VAR(GoodsEntry, days_since_pickup, SLE_UINT8),
|
||||
SLE_VAR(GoodsEntry, time_since_pickup, SLE_UINT8),
|
||||
SLE_VAR(GoodsEntry, rating, SLE_UINT8),
|
||||
SLEG_CONDVAR( _cargo_source, SLE_FILE_U8 | SLE_VAR_U16, 0, 6),
|
||||
SLEG_CONDVAR( _cargo_source, SLE_UINT16, 7, 67),
|
||||
|
|
|
@ -71,7 +71,7 @@ struct GoodsEntry {
|
|||
|
||||
GoodsEntry() :
|
||||
acceptance_pickup(0),
|
||||
days_since_pickup(255),
|
||||
time_since_pickup(255),
|
||||
rating(INITIAL_STATION_RATING),
|
||||
last_speed(0),
|
||||
last_age(255)
|
||||
|
@ -84,7 +84,7 @@ struct GoodsEntry {
|
|||
* The unit used is STATION_RATING_TICKS.
|
||||
* This does not imply there was any cargo to load.
|
||||
*/
|
||||
byte days_since_pickup;
|
||||
byte time_since_pickup;
|
||||
|
||||
byte rating; ///< %Station rating for this cargo.
|
||||
|
||||
|
|
|
@ -3187,7 +3187,7 @@ static void UpdateStationRating(Station *st)
|
|||
|
||||
/* Only change the rating if we are moving this cargo */
|
||||
if (HasBit(ge->acceptance_pickup, GoodsEntry::GES_PICKUP)) {
|
||||
byte_inc_sat(&ge->days_since_pickup);
|
||||
byte_inc_sat(&ge->time_since_pickup);
|
||||
|
||||
bool skip = false;
|
||||
int rating = 0;
|
||||
|
@ -3200,7 +3200,7 @@ static void UpdateStationRating(Station *st)
|
|||
/* NewGRFs expect last speed to be 0xFF when no vehicle has arrived yet. */
|
||||
uint last_speed = ge->HasVehicleEverTriedLoading() ? ge->last_speed : 0xFF;
|
||||
|
||||
uint32 var18 = min(ge->days_since_pickup, 0xFF) | (min(waiting, 0xFFFF) << 8) | (min(last_speed, 0xFF) << 24);
|
||||
uint32 var18 = min(ge->time_since_pickup, 0xFF) | (min(waiting, 0xFFFF) << 8) | (min(last_speed, 0xFF) << 24);
|
||||
/* Convert to the 'old' vehicle types */
|
||||
uint32 var10 = (st->last_vehicle_type == VEH_INVALID) ? 0x0 : (st->last_vehicle_type + 0x10);
|
||||
uint16 callback = GetCargoCallback(CBID_CARGO_STATION_RATING_CALC, var10, var18, cs);
|
||||
|
@ -3217,12 +3217,12 @@ static void UpdateStationRating(Station *st)
|
|||
int b = ge->last_speed - 85;
|
||||
if (b >= 0) rating += b >> 2;
|
||||
|
||||
byte days = ge->days_since_pickup;
|
||||
if (st->last_vehicle_type == VEH_SHIP) days >>= 2;
|
||||
(days > 21) ||
|
||||
(rating += 25, days > 12) ||
|
||||
(rating += 25, days > 6) ||
|
||||
(rating += 45, days > 3) ||
|
||||
byte waittime = ge->time_since_pickup;
|
||||
if (st->last_vehicle_type == VEH_SHIP) waittime >>= 2;
|
||||
(waittime > 21) ||
|
||||
(rating += 25, waittime > 12) ||
|
||||
(rating += 25, waittime > 6) ||
|
||||
(rating += 45, waittime > 3) ||
|
||||
(rating += 35, true);
|
||||
|
||||
(rating -= 90, waiting > 1500) ||
|
||||
|
|
Loading…
Reference in New Issue