mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
(svn r5632) Replace a boolean variable in DeallocateSpecFromStation() by a return
Also set the return type to void, because the caller doesn't care about it
This commit is contained in:
parent
fef9818d3c
commit
801bf631b0
@ -582,22 +582,18 @@ int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec)
|
|||||||
* @param specindex Index of the custom station within the Station's spec list.
|
* @param specindex Index of the custom station within the Station's spec list.
|
||||||
* @return Indicates whether the StationSpec was deallocated.
|
* @return Indicates whether the StationSpec was deallocated.
|
||||||
*/
|
*/
|
||||||
bool DeallocateSpecFromStation(Station *st, byte specindex)
|
void DeallocateSpecFromStation(Station* st, byte specindex)
|
||||||
{
|
{
|
||||||
bool freeable = true;
|
|
||||||
|
|
||||||
/* specindex of 0 (default) is never freeable */
|
/* specindex of 0 (default) is never freeable */
|
||||||
if (specindex == 0) return false;
|
if (specindex == 0) return;
|
||||||
|
|
||||||
/* Check all tiles over the station to check if the specindex is still in use */
|
/* Check all tiles over the station to check if the specindex is still in use */
|
||||||
BEGIN_TILE_LOOP(tile, st->trainst_w, st->trainst_h, st->train_tile) {
|
BEGIN_TILE_LOOP(tile, st->trainst_w, st->trainst_h, st->train_tile) {
|
||||||
if (IsTileType(tile, MP_STATION) && GetStationIndex(tile) == st->index && IsRailwayStation(tile) && GetCustomStationSpecIndex(tile) == specindex) {
|
if (IsTileType(tile, MP_STATION) && GetStationIndex(tile) == st->index && IsRailwayStation(tile) && GetCustomStationSpecIndex(tile) == specindex) {
|
||||||
freeable = false;
|
return;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} END_TILE_LOOP(tile, st->trainst_w, st->trainst_h, st->train_tile)
|
} END_TILE_LOOP(tile, st->trainst_w, st->trainst_h, st->train_tile)
|
||||||
|
|
||||||
if (freeable) {
|
|
||||||
/* This specindex is no longer in use, so deallocate it */
|
/* This specindex is no longer in use, so deallocate it */
|
||||||
st->speclist[specindex].spec = NULL;
|
st->speclist[specindex].spec = NULL;
|
||||||
st->speclist[specindex].grfid = 0;
|
st->speclist[specindex].grfid = 0;
|
||||||
@ -615,9 +611,6 @@ bool DeallocateSpecFromStation(Station *st, byte specindex)
|
|||||||
st->speclist = NULL;
|
st->speclist = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return freeable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Draw representation of a station tile for GUI purposes.
|
/** Draw representation of a station tile for GUI purposes.
|
||||||
|
@ -120,7 +120,7 @@ bool IsStationTileElectrifiable(TileIndex tile);
|
|||||||
int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec);
|
int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec);
|
||||||
|
|
||||||
/* Deallocate a StationSpec from a Station. Called when removing a single station tile. */
|
/* Deallocate a StationSpec from a Station. Called when removing a single station tile. */
|
||||||
bool DeallocateSpecFromStation(Station *st, byte specindex);
|
void DeallocateSpecFromStation(Station* st, byte specindex);
|
||||||
|
|
||||||
/* Draw representation of a station tile for GUI purposes. */
|
/* Draw representation of a station tile for GUI purposes. */
|
||||||
bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station);
|
bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station);
|
||||||
|
Loading…
Reference in New Issue
Block a user