(svn r6776) -Codechange: Use IsValidPlayer() function to determine of a PlayerID is an
actual playable player (< MAX_PLAYERS) or not.
This commit is contained in:
@@ -265,7 +265,7 @@ int32 CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
TreeType treetype;
|
||||
uint growth;
|
||||
|
||||
if (_game_mode != GM_EDITOR && _current_player < MAX_PLAYERS) {
|
||||
if (_game_mode != GM_EDITOR && IsValidPlayer(_current_player)) {
|
||||
Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority);
|
||||
if (t != NULL)
|
||||
ChangeTownRating(t, RATING_TREE_UP_STEP, RATING_TREE_MAXIMUM);
|
||||
@@ -415,7 +415,7 @@ static int32 ClearTile_Trees(TileIndex tile, byte flags)
|
||||
{
|
||||
uint num;
|
||||
|
||||
if (flags & DC_EXEC && _current_player < MAX_PLAYERS) {
|
||||
if ((flags & DC_EXEC) && IsValidPlayer(_current_player)) {
|
||||
Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority);
|
||||
if (t != NULL)
|
||||
ChangeTownRating(t, RATING_TREE_DOWN_STEP, RATING_TREE_MINIMUM);
|
||||
|
Reference in New Issue
Block a user