(svn r1504) enummed town ratings (Jango)

This commit is contained in:
celestar 2005-01-14 09:20:12 +00:00
parent 9e10458209
commit febac23b25
7 changed files with 53 additions and 18 deletions

View File

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

View File

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

36
town.h
View File

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

View File

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

View File

@ -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!

View File

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

View File

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