[Freeciv-Dev] How about using corruption to determine incite cost ?
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
Freeciv Development <freeciv-dev@xxxxxxxxxxx> |
Subject: |
[Freeciv-Dev] How about using corruption to determine incite cost ? |
From: |
Peter Schaefer <schaefer@xxxxxx> |
Date: |
Fri, 28 May 1999 17:23:53 +0200 |
Large portions of code in these functions seems to be duplicated.
The following patch would use corruption to work out incite cost.
I must admit I haven't tested alot, just thought it through for
corruption=0 and corruption=all.
Code after patch reads:
void city_incite_cost(struct city *pcity)
{
int dist;
int corruption;
if (city_got_building(pcity, B_PALACE))
pcity->incite_revolt_cost=1000000;
else {
pcity->incite_revolt_cost=city_owner(pcity)->economic.gold +1000;
corruption= city_corruption(pcity, 36);
dist= 36- 36/(corruption+1) ;
pcity->incite_revolt_cost/=(dist + 3);
pcity->incite_revolt_cost*=pcity->size;
if (city_unhappy(pcity))
pcity->incite_revolt_cost/=2;
if (unit_list_size(&map_get_tile(pcity->x,pcity->y)->units)==0)
pcity->incite_revolt_cost/=2;
}
}
--
Peter Schaefer - schaefer@xxxxxx, schaefer@xxxxxx
"FermaT, by Software Migrations Ltd, is an industrial strength program
transformation system used to migrate IBM 370 Assembler modules into
equivalent readable and maintainable COBOL programs, and to help solve
the year 2000 challenge for IBM 370 Assembler code." --- server/cityturn.c Sun Feb 28 02:02:46 1999
+++ server/cityturn.cnew Fri May 28 17:15:06 1999
@@ -1207,24 +1207,22 @@
void city_incite_cost(struct city *pcity)
{
- struct city *capital;
int dist;
-
+ int corruption;
+
if (city_got_building(pcity, B_PALACE))
pcity->incite_revolt_cost=1000000;
else {
pcity->incite_revolt_cost=city_owner(pcity)->economic.gold +1000;
- capital=find_palace(city_owner(pcity));
- if (capital)
- dist=min(32, map_distance(capital->x, capital->y, pcity->x, pcity->y));
- else
- dist=32;
- if (city_got_building(pcity, B_COURTHOUSE))
- dist/=2;
- if (get_government(city_owner(pcity)->player_no)==G_COMMUNISM)
- dist = min(10, dist);
+
+ corruption= city_corruption(pcity, 36);
+
+ dist= 36- 36/(corruption+1) ;
+
pcity->incite_revolt_cost/=(dist + 3);
+
pcity->incite_revolt_cost*=pcity->size;
+
if (city_unhappy(pcity))
pcity->incite_revolt_cost/=2;
if (unit_list_size(&map_get_tile(pcity->x,pcity->y)->units)==0)
- [Freeciv-Dev] How about using corruption to determine incite cost ?,
Peter Schaefer <=
|
|