(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:
Darkvater
2006-10-14 22:31:18 +00:00
parent 9732c129c1
commit 6b6d908308
15 changed files with 50 additions and 49 deletions

View File

@@ -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);