(svn r11795) -Fix [FS#1616]: take town rating into account when testing if a command can be executed.

This commit is contained in:
glx
2008-01-09 17:47:05 +00:00
parent d133edd026
commit 785572ea32
6 changed files with 58 additions and 31 deletions

View File

@@ -328,16 +328,15 @@ CommandCost CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
default: break;
}
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);
}
if (flags & DC_EXEC) {
TreeType treetype;
uint growth;
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);
}
treetype = (TreeType)p1;
if (treetype == TREE_INVALID) {
treetype = GetRandomTreeType(tile, GB(Random(), 24, 8));
@@ -486,10 +485,9 @@ static CommandCost ClearTile_Trees(TileIndex tile, byte flags)
{
uint num;
if ((flags & DC_EXEC) && IsValidPlayer(_current_player)) {
if (IsValidPlayer(_current_player)) {
Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority);
if (t != NULL)
ChangeTownRating(t, RATING_TREE_DOWN_STEP, RATING_TREE_MINIMUM);
if (t != NULL) ChangeTownRating(t, RATING_TREE_DOWN_STEP, RATING_TREE_MINIMUM);
}
num = GetTreeCount(tile) + 1;