summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-02-11 18:50:47 +0000
committerfrosch <frosch@openttd.org>2009-02-11 18:50:47 +0000
commitd5525b8f2d457f6e0ecc0b11d27c9c3601c8d006 (patch)
tree717fc81d934cae1a2abe2a694c4ad55aa012b0af /src/town_cmd.cpp
parent202e5ea78d74610011685270c4418411a9f892e7 (diff)
downloadopenttd-d5525b8f2d457f6e0ecc0b11d27c9c3601c8d006.tar.xz
(svn r15452) -Codechange: Add DC_NO_MODIFY_TOWN_RATING.
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index b16afa08c..d4e23ee99 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -537,7 +537,7 @@ static CommandCost ClearTile_Town(TileIndex tile, DoCommandFlag flags)
}
}
- ChangeTownRating(t, -rating, RATING_HOUSE_MINIMUM);
+ ChangeTownRating(t, -rating, RATING_HOUSE_MINIMUM, flags);
if (flags & DC_EXEC) {
ClearTownHouse(t, tile);
}
@@ -2278,7 +2278,7 @@ static void TownActionBribe(Town *t)
InvalidateWindow(WC_TOWN_AUTHORITY, t->index);
}
} else {
- ChangeTownRating(t, RATING_BRIBE_UP_STEP, RATING_BRIBE_MAXIMUM);
+ ChangeTownRating(t, RATING_BRIBE_UP_STEP, RATING_BRIBE_MAXIMUM, DC_EXEC);
}
}
@@ -2591,10 +2591,17 @@ static int GetRating(const Town *t)
return t->ratings[_current_company];
}
-void ChangeTownRating(Town *t, int add, int max)
+/**
+ * Changes town rating of the current company
+ * @param t Town to affect
+ * @param add Value to add
+ * @param max Minimum (add < 0) resp. maximum (add > 0) rating that should be archievable with this change
+ * @param flags Command flags, especially DC_NO_MODIFY_TOWN_RATING is tested
+ */
+void ChangeTownRating(Town *t, int add, int max, DoCommandFlag flags)
{
/* if magic_bulldozer cheat is active, town doesn't penaltize for removing stuff */
- if (t == NULL ||
+ if (t == NULL || (flags & DC_NO_MODIFY_TOWN_RATING) ||
!IsValidCompanyID(_current_company) ||
(_cheats.magic_bulldozer.value && add < 0)) {
return;