From 883f9bec9b762f3615524726cd8e17c2df19dbe1 Mon Sep 17 00:00:00 2001 From: frosch Date: Mon, 12 Nov 2012 21:59:02 +0000 Subject: [PATCH] (svn r24718) -Codechange: Rename GoodsEntry::days_since_pickup to GoodsEntry::time_since_pickup. --- src/economy.cpp | 2 +- src/newgrf_station.cpp | 4 ++-- src/saveload/oldloader_sl.cpp | 2 +- src/saveload/station_sl.cpp | 2 +- src/station_base.h | 4 ++-- src/station_cmd.cpp | 16 ++++++++-------- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/economy.cpp b/src/economy.cpp index 42d010759f..92f9a0cd57 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -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. */ diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 52631ad876..8092a953fe 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -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(); diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index a78acfd489..bbc9cbb94c 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -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 ), diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp index f8b650a2d9..579e9458a2 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -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), diff --git a/src/station_base.h b/src/station_base.h index 5f179eb322..07d1d2294c 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -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. diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 39a84b9998..36e359b05e 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -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) ||