Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] Civ 2 Style Waste: A RFC
Home

[Freeciv-Dev] Civ 2 Style Waste: A RFC

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Cc: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Civ 2 Style Waste: A RFC
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Fri, 29 Nov 2002 06:50:46 -0800 (PST)

This is an implementation of Civ 2 style waste. Waste is corruption for
shields. Now cities that are far away from your palace lose not merely trade,
but also shields. This makes ICS more difficult. 

Taken from Ross's Corecleanups, modified by me to include a gui-gtk city
display showing waste.

All Civ 2 purists should check my algorithm. I have no clue as to how exactly
Civ 2 waste worked. Anyone with more information should speak up.

>   val = CLIP(trade_penalty, val, trade);

Ross, this function makes me nervous. It is rather misleading to call the
values trade penalty and trade, when shields are also penalised. It seems
misleading. Your implementation also makes fulltradesize/notradesize affect
shields. I do not think that is a good idea.

So I suggest going with the function city_waste(instead of city_corruption),
which is further down in this email. What do you think?

>   /* TODO: Civ2 rules check */
>   pcity->shield_waste = city_corruption(pcity, pcity->shield_prod);
>   pcity->shield_prod -= pcity->shield_waste;
> }


int city_waste(struct city *pcity, int shields)
{
  struct government *g = get_gov_pcity(pcity);
  struct city *capital;
  int dist;
  int val, shield_penalty = 0;

  if (g->corruption_level == 0) {
    return shield_penalty;
  }
  if (g->fixed_corruption_distance != 0) {
    dist = g->fixed_corruption_distance;
  } else {
    capital = find_palace(city_owner(pcity));
    if (!capital)
      dist = 36;
    else {
      int tmp = map_distance(capital->x, capital->y, pcity->x, pcity->y);
      dist = MIN(36, tmp);
    }
  }
  dist =
      dist * g->corruption_distance_factor + g->extra_corruption_distance;

  /* Ordered to reduce integer roundoff errors */
  val = shields * dist;
  val *= g->corruption_level;
  val /= g->corruption_modifier;
  val /= 100;

  if (city_got_building(pcity, B_COURTHOUSE)
   || city_got_building(pcity, B_PALACE)) {
    val /= 2;
  }
  val = CLIP(shield_penalty, val, shields);
  return val;
}


Aloha,
RK. 

"I don't believe in astrology.  But then I'm an Aquarius, and Aquarians
don't believe in astrology."
-- James R. F. Quirk


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Attachment: waste.diff
Description: waste.diff


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