Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2000:
[Freeciv-Dev] Settlers going for 50% discount
Home

[Freeciv-Dev] Settlers going for 50% discount

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Settlers going for 50% discount
From: "T.J.T van Kooten" <thomas@xxxxxxxxxxxxxx>
Date: Sat, 20 May 2000 23:51:18 +0200

I've started to browse through the source code for FreeCiv and came across
something curious concerning bribing (code line 258-260 see below).
According to comment in the code settlers are 50% cheaper to bribe than
other units. What's the reason for this? Is it game specific (AI)?
Gamebalance? Something that was forgotten to take out (Civ1/2 certainly do
not have this 50% discount)? Or just a programmers personal quirk (it says
"fixme")?

I'm looking for enlightment, can anyone tell me the reason?

Thanks,

CapTVK

Here's part of the code

/**************************************************************************
232  calculate how expensive it is to bribe the unit
233  depends on distance to the capital, and government form
234  settlers are half price
235
236  Plus, the damage to the unit reduces the price.
237
238
**************************************************************************/
239 int unit_bribe_cost(struct unit *punit)
240

241   struct government *g = get_gov_iplayer(punit->owner);
242   int cost;
243   struct city *capital;
244   int dist;
245   int default_hp = get_unit_type(punit->type)->hp;
246
247   cost = (&game.players[punit->owner])->economic.gold+750;
248   capital=find_palace(&game.players[punit->owner]);
249   if (capital) {
250     int tmp = map_distance(capital->x, capital->y, punit->x, punit->y);
251     dist=MIN(32, tmp);
252   }
253   else
254     dist=32;
255   if (g->fixed_corruption_distance)
256     dist = MIN(g->fixed_corruption_distance, dist);
257   cost=(cost/(dist+2))*(get_unit_type(punit->type)->build_cost/10);
258   /* FIXME: This is a weird one - should be replaced */
259   if (unit_flag(punit->type, F_CITIES))
260     cost/=2;
261
262   /* Cost now contains the basic bribe cost.  We now reduce it by:
263
264      cost = basecost/2 + basecost/2 * damage/hp
265
266    */
267
268   cost = (int)((float)cost/(float)2 +
((float)punit->hp/(float)default_hp) * ((float)cost/(float)2));
269
270   return cost;
271 }
272




[Prev in Thread] Current Thread [Next in Thread]