summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-08-02 20:19:10 +0000
committeralberth <alberth@openttd.org>2010-08-02 20:19:10 +0000
commit73f45d16d1a5c6174a25ee4a03f4460ee74ab91e (patch)
tree7ce88ecc886b0063a58d0ec2c91801f44c39a0c2 /src/engine.cpp
parent00dcb16760d7794df9d9cbada6416d65ea51911b (diff)
downloadopenttd-73f45d16d1a5c6174a25ee4a03f4460ee74ab91e.tar.xz
(svn r20317) -Codechange: Move variable declaration to their first use.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index e3f801061..91d53e786 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -524,7 +524,6 @@ void SetYearEngineAgingStops()
void StartupOneEngine(Engine *e, Date aging_date)
{
const EngineInfo *ei = &e->info;
- uint32 r;
e->age = 0;
e->flags = 0;
@@ -533,7 +532,7 @@ void StartupOneEngine(Engine *e, Date aging_date)
/* Don't randomise the start-date in the first two years after gamestart to ensure availability
* of engines in early starting games.
* Note: TTDP uses fixed 1922 */
- r = Random();
+ uint32 r = Random();
e->intro_date = ei->base_intro <= ConvertYMDToDate(_settings_game.game_creation.starting_year + 2, 0, 1) ? ei->base_intro : (Date)GB(r, 0, 9) + ei->base_intro;
if (e->intro_date <= _date) {
e->age = (aging_date - e->intro_date) >> 5;
@@ -601,14 +600,14 @@ static void AcceptEnginePreview(EngineID eid, CompanyID company)
static CompanyID GetBestCompany(uint8 pp)
{
- const Company *c;
- int32 best_hist;
CompanyID best_company;
CompanyMask mask = 0;
do {
- best_hist = -1;
+ int32 best_hist = -1;
best_company = INVALID_COMPANY;
+
+ const Company *c;
FOR_ALL_COMPANIES(c) {
if (c->block_preview == 0 && !HasBit(mask, c->index) &&
c->old_economy[0].performance_history > best_hist) {