diff options
author | alberth <alberth@openttd.org> | 2010-08-02 20:19:10 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-08-02 20:19:10 +0000 |
commit | 73f45d16d1a5c6174a25ee4a03f4460ee74ab91e (patch) | |
tree | 7ce88ecc886b0063a58d0ec2c91801f44c39a0c2 /src/company_cmd.cpp | |
parent | 00dcb16760d7794df9d9cbada6416d65ea51911b (diff) | |
download | openttd-73f45d16d1a5c6174a25ee4a03f4460ee74ab91e.tar.xz |
(svn r20317) -Codechange: Move variable declaration to their first use.
Diffstat (limited to 'src/company_cmd.cpp')
-rw-r--r-- | src/company_cmd.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 671c6406e..25f5959b1 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -317,28 +317,24 @@ CommandCost CheckTileOwnership(TileIndex tile) */ static void GenerateCompanyName(Company *c) { - TileIndex tile; - Town *t; - StringID str; - Company *cc; - uint32 strp; /* Reserve space for extra unicode character. We need to do this to be able * to detect too long company name. */ char buffer[MAX_LENGTH_COMPANY_NAME_BYTES + MAX_CHAR_LENGTH]; if (c->name_1 != STR_SV_UNNAMED) return; + if (c->last_build_coordinate == 0) return; - tile = c->last_build_coordinate; - if (tile == 0) return; - - t = ClosestTownFromTile(tile, UINT_MAX); + Town *t = ClosestTownFromTile(c->last_build_coordinate, UINT_MAX); + StringID str; + uint32 strp; if (t->name == NULL && IsInsideMM(t->townnametype, SPECSTR_TOWNNAME_START, SPECSTR_TOWNNAME_LAST + 1)) { str = t->townnametype - SPECSTR_TOWNNAME_START + SPECSTR_PLAYERNAME_START; strp = t->townnameparts; verify_name:; /* No companies must have this name already */ + Company *cc; FOR_ALL_COMPANIES(cc) { if (cc->name_1 == str && cc->name_2 == strp) goto bad_town_name; } |