diff options
author | tron <tron@openttd.org> | 2005-03-09 19:09:04 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-03-09 19:09:04 +0000 |
commit | e6e3e69da446dc00c0b9de25467638fa1081ad64 (patch) | |
tree | f2c654684c8e8ee724d40b54c8aa56c87ca8c5b6 /station_cmd.c | |
parent | 750a26553194f6967e09098caf532e0ac7731d0a (diff) | |
download | openttd-e6e3e69da446dc00c0b9de25467638fa1081ad64.tar.xz |
(svn r1976) Cleanups - mostly indentation and fiddling with loops
Diffstat (limited to 'station_cmd.c')
-rw-r--r-- | station_cmd.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/station_cmd.c b/station_cmd.c index 823cc13c5..806d7f1f3 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -343,10 +343,10 @@ static bool GenerateStationName(Station *st, uint tile, int flag) /* check mine? */ if (HASBIT(free_names, M(STR_SV_STNAME_MINES))) { if (CountMapSquareAround(tile, MP_INDUSTRY, 0, 6) >= 2 || - CountMapSquareAround(tile, MP_INDUSTRY, 0x64, 0x73) >= 2 || - CountMapSquareAround(tile, MP_INDUSTRY, 0x2F, 0x33) >= 2 || - CountMapSquareAround(tile, MP_INDUSTRY, 0x48, 0x58) >= 2 || - CountMapSquareAround(tile, MP_INDUSTRY, 0x5B, 0x63) >= 2) { + CountMapSquareAround(tile, MP_INDUSTRY, 0x64, 0x73) >= 2 || + CountMapSquareAround(tile, MP_INDUSTRY, 0x2F, 0x33) >= 2 || + CountMapSquareAround(tile, MP_INDUSTRY, 0x48, 0x58) >= 2 || + CountMapSquareAround(tile, MP_INDUSTRY, 0x5B, 0x63) >= 2) { found = M(STR_SV_STNAME_MINES); goto done; } @@ -362,18 +362,20 @@ static bool GenerateStationName(Station *st, uint tile, int flag) } /* Check lakeside */ - if (HASBIT(free_names, M(STR_SV_STNAME_LAKESIDE)) - && DistanceFromEdge(tile) < 20 - && CountMapSquareAround(tile, MP_WATER, 0, 0) >= 5) { + if (HASBIT(free_names, M(STR_SV_STNAME_LAKESIDE)) && + DistanceFromEdge(tile) < 20 && + CountMapSquareAround(tile, MP_WATER, 0, 0) >= 5) { found = M(STR_SV_STNAME_LAKESIDE); goto done; } /* Check woods */ - if (HASBIT(free_names, M(STR_SV_STNAME_WOODS)) && - (CountMapSquareAround(tile, MP_TREES, 0, 255) >= 8 || - CountMapSquareAround(tile, MP_INDUSTRY, 0x10, 0x11) >= 2)) { - found = (_opt.landscape==LT_DESERT) ? M(STR_SV_STNAME_FOREST) : M(STR_SV_STNAME_WOODS); + if (HASBIT(free_names, M(STR_SV_STNAME_WOODS)) && ( + CountMapSquareAround(tile, MP_TREES, 0, 255) >= 8 || + CountMapSquareAround(tile, MP_INDUSTRY, 0x10, 0x11) >= 2) + ) { + found = _opt.landscape == LT_DESERT ? + M(STR_SV_STNAME_FOREST) : M(STR_SV_STNAME_WOODS); goto done; } @@ -889,11 +891,12 @@ static inline byte *CreateMulti(byte *layout, int n, byte b) // stolen from TTDPatch static void GetStationLayout(byte *layout, int numtracks, int plat_len, struct StationSpec *spec) { - if (spec != NULL && spec->lengths >= plat_len && spec->platforms[plat_len - 1] >= numtracks - && spec->layouts[plat_len - 1][numtracks - 1]) { + if (spec != NULL && spec->lengths >= plat_len && + spec->platforms[plat_len - 1] >= numtracks && + spec->layouts[plat_len - 1][numtracks - 1]) { /* Custom layout defined, follow it. */ memcpy(layout, spec->layouts[plat_len - 1][numtracks - 1], - plat_len * numtracks); + plat_len * numtracks); return; } @@ -1181,8 +1184,8 @@ void SetCustomStation(byte local_stid, struct StationSpec *spec) int i; for (i = 0; i <= _statspec_highest_id[sclass]; i++) { - if (_station_spec[sclass][i].grfid == spec->grfid - && _station_spec[sclass][i].localidx == local_stid + 1) { + if (_station_spec[sclass][i].grfid == spec->grfid && + _station_spec[sclass][i].localidx == local_stid + 1) { stid = i; /* FIXME: Release original SpriteGroup to * prevent leaks. But first we need to @@ -1251,8 +1254,7 @@ ResolveStationSpriteGroup(struct SpriteGroup *spritegroup, struct Station *stat) /* TODO: Town structure. */ } else /* VSG_SELF */ { - if (dsg->variable == 0x40 - || dsg->variable == 0x41) { + if (dsg->variable == 0x40 || dsg->variable == 0x41) { /* FIXME: This is ad hoc only * for waypoints. */ value = 0x01010000; @@ -1313,7 +1315,7 @@ uint32 GetCustomStationRelocation(struct StationSpec *spec, struct Station *stat } error("Custom station 0x%08x::0x%02x has no sprites associated.", - spec->grfid, spec->localidx); + spec->grfid, spec->localidx); /* This is what gets subscribed of dtss->image in newgrf.c, * so it's probably kinda "default offset". Try to use it as * emergency measure. */ @@ -3104,8 +3106,7 @@ static void Load_STNS(void) } } - /* This is to ensure all pointers are within the limits of - _stations_size */ + /* This is to ensure all pointers are within the limits of _stations_size */ if (_station_tick_ctr > GetStationPoolSize()) _station_tick_ctr = 0; } |