diff options
author | celestar <celestar@openttd.org> | 2005-01-14 09:20:12 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2005-01-14 09:20:12 +0000 |
commit | febac23b25e468dbdc7491477d51458fff9e16ca (patch) | |
tree | ffb100e443120f881e94596910bf6feb7421f6ca | |
parent | 9e10458209fb9eaabb9192383614d950b572083c (diff) | |
download | openttd-febac23b25e468dbdc7491477d51458fff9e16ca.tar.xz |
(svn r1504) enummed town ratings (Jango)
-rw-r--r-- | industry_cmd.c | 2 | ||||
-rw-r--r-- | road_cmd.c | 2 | ||||
-rw-r--r-- | town.h | 36 | ||||
-rw-r--r-- | town_cmd.c | 7 | ||||
-rw-r--r-- | town_gui.c | 14 | ||||
-rw-r--r-- | tree_cmd.c | 4 | ||||
-rw-r--r-- | tunnelbridge_cmd.c | 6 |
7 files changed, 53 insertions, 18 deletions
diff --git a/industry_cmd.c b/industry_cmd.c index e8b00a8b7..dc7b9db00 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -408,7 +408,7 @@ int32 CmdDestroyIndustry(int x, int y, uint32 flags, uint32 p1, uint32 p2) if (flags & DC_EXEC) { DeleteIndustry(i); CreateEffectVehicleAbove(x + 8,y + 8, 2, EV_DEMOLISH); - ChangeTownRating(t, -1500, -1000); // penalty is 1500 + ChangeTownRating(t, RATING_INDUSTRY_DOWN_STEP, RATING_INDUSTRY_MINIMUM); } return (_price.build_industry >> 5) * _industry_type_costs[i->type]*2; diff --git a/road_cmd.c b/road_cmd.c index 2c6c56d4b..f46f3a0f5 100644 --- a/road_cmd.c +++ b/road_cmd.c @@ -212,7 +212,7 @@ int32 CmdRemoveRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2) // checks if the owner is town than decrease town rating by 50 until you have // a "Poor" town rating if(_map_owner[tile] == OWNER_TOWN && _game_mode != GM_EDITOR) - ChangeTownRating(t, -_road_remove_cost[(byte)edge_road], -100); + ChangeTownRating(t, -_road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM); _map5[tile] ^= c; if ((_map5[tile]&0xF) == 0) @@ -89,6 +89,42 @@ enum { INDUSTRY_REMOVE = 2 }; +enum { + // These refer to the maximums, so Appalling is -1000 to -400 + // MAXIMUM RATINGS BOUNDARIES + RATING_MINIMUM = -1000, + RATING_APPALLING = -400, + RATING_VERYPOOR = -200, + RATING_POOR = 0, + RATING_MEDIOCRE = 200, + RATING_GOOD = 400, + RATING_VERYGOOD = 600, + RATING_EXCELLENT = 800, + RATING_OUTSTANDING= 1000, // OUTSTANDING + + RATING_MAXIMUM = RATING_OUTSTANDING, + + // RATINGS AFFECTING NUMBERS + RATING_TREE_DOWN_STEP = -35, + RATING_TREE_MINIMUM = RATING_MINIMUM, + RATING_TREE_UP_STEP = 7, + RATING_TREE_MAXIMUM = 220, + + RATING_TUNNEL_BRIDGE_DOWN_STEP = -250, + RATING_TUNNEL_BRIDGE_MINIMUM = 0, + + RATING_INDUSTRY_DOWN_STEP = -1500, + RATING_INDUSTRY_MINIMUM = RATING_MINIMUM, + + RATING_ROAD_DOWN_STEP = -50, + RATING_ROAD_MINIMUM = -100, + RATING_HOUSE_MINIMUM = RATING_MINIMUM, + + RATING_BRIBE_UP_STEP = 200, + RATING_BRIBE_MAXIMUM = 800, + RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER? +}; + bool CheckforTownRating(uint tile, uint32 flags, Town *t, byte type); VARDEF Town _towns[70]; diff --git a/town_cmd.c b/town_cmd.c index eb3f11a68..d978b299a 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -322,7 +322,7 @@ static int32 ClearTile_Town(uint tile, byte flags) } if (flags & DC_EXEC) { - ChangeTownRating(t, -rating, -1000); + ChangeTownRating(t, -rating, RATING_HOUSE_MINIMUM); ClearTownHouse(t, tile); } @@ -1570,13 +1570,12 @@ static void TownActionBribe(Town *t, int action) /* decrease by a lot! * ChangeTownRating is only for stuff in demolishing. Bribe failure should * be independent of any cheat settings - * ChangeTownRating(c, -1000, -50); */ rating = t->ratings[_current_player]; if (rating > -50) - t->ratings[_current_player] = -50; + t->ratings[_current_player] = RATING_BRIBE_DOWN_TO; } else { - ChangeTownRating(t, 200, 800); + ChangeTownRating(t, RATING_BRIBE_UP_STEP, RATING_BRIBE_MAXIMUM); } } diff --git a/town_gui.c b/town_gui.c index 171294732..b4da4c432 100644 --- a/town_gui.c +++ b/town_gui.c @@ -119,13 +119,13 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e) SetDParam(2, GetPlayerNameString(p->index, 3)); r = t->ratings[p->index]; - (str = STR_3035_APPALLING, r <= -400) || // Apalling - (str++, r <= -200) || // Very Poor - (str++, r <= 0) || // Poor - (str++, r <= 200) || // Mediocore - (str++, r <= 400) || // Good - (str++, r <= 600) || // Very Good - (str++, r <= 800) || // Excellent + (str = STR_3035_APPALLING, r <= RATING_APPALLING) || // Apalling + (str++, r <= RATING_VERYPOOR) || // Very Poor + (str++, r <= RATING_POOR) || // Poor + (str++, r <= RATING_MEDIOCRE) || // Mediocore + (str++, r <= RATING_GOOD) || // Good + (str++, r <= RATING_VERYGOOD) || // Very Good + (str++, r <= RATING_EXCELLENT) || // Excellent (str++, true); // Outstanding /* WARNING ugly hack! diff --git a/tree_cmd.c b/tree_cmd.c index fca9f1ef6..47f9792db 100644 --- a/tree_cmd.c +++ b/tree_cmd.c @@ -197,7 +197,7 @@ int32 CmdPlantTree(int ex, int ey, uint32 flags, uint32 p1, uint32 p2) if (_game_mode != GM_EDITOR && _current_player < MAX_PLAYERS) { Town *t = ClosestTownFromTile(ti.tile, _patches.dist_local_authority); if (t != NULL) - ChangeTownRating(t, 7, 220); + ChangeTownRating(t, RATING_TREE_UP_STEP, RATING_TREE_MAXIMUM); } m2 = 0; if ( (ti.map5 & 0x1C) == 4 ) { @@ -350,7 +350,7 @@ static int32 ClearTile_Trees(uint tile, byte flags) { if (flags & DC_EXEC && _current_player < MAX_PLAYERS) { Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority); if (t != NULL) - ChangeTownRating(t, -35, -1000); + ChangeTownRating(t, RATING_TREE_DOWN_STEP, RATING_TREE_MINIMUM); } num = (_map5[tile] >> 6) + 1; diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index 135f7fd47..c4fe124ad 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -643,7 +643,7 @@ static int32 DoClearTunnel(uint tile, uint32 flags) UpdateSignalsOnSegment(tile, _updsignals_tunnel_dir[tile_dir]); UpdateSignalsOnSegment(endtile, _updsignals_tunnel_dir[endtile_dir]); if (_map_owner[tile] == OWNER_TOWN && _game_mode != GM_EDITOR) - ChangeTownRating(t, -250, 0); + ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM); } return _price.clear_tunnel * (length + 1); } @@ -758,10 +758,10 @@ static int32 DoClearBridge(uint tile, uint32 flags) uint c = tile; uint16 new_data; - //checks if the owner is town then decrease town rating by 250 until + //checks if the owner is town then decrease town rating by RATING_TUNNEL_BRIDGE_DOWN_STEP until // you have a "Poor" (0) town rating if (_map_owner[tile] == OWNER_TOWN && _game_mode != GM_EDITOR) - ChangeTownRating(t, -250, 0); + ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM); do { m5 = _map5[c]; |