[Freeciv-Dev] (PR#8754) effects patch: everlasting wonders
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#8754) effects patch: everlasting wonders |
From: |
"Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx> |
Date: |
Wed, 19 May 2004 17:46:52 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8754 >
This patch adds support for everlasting wonders. Like Manhattan. Apply
after effects2.diff and implement2.diff.
diff -Nurd -X diff_ignore fc/common/eff.c freeciv/common/eff.c
--- fc/common/eff.c 2004-05-19 23:49:13.567720664 +0100
+++ freeciv/common/eff.c 2004-05-20 01:46:27.271435168 +0100
@@ -786,6 +786,53 @@
/**************************************************************************
...
**************************************************************************/
+static int inline active_everlasting_building(struct player *plr, Impr_Type_id
id, enum effect_type
eff)
+{
+ struct eff_group *group;
+
+ if (!(group = *get_building_eff_group(id, eff))) {
+ /* unique. */
+ if (is_wonder(id) && game.global_wonders[id] != 0) {
+ return id;
+ }
+
+ return -1;
+ } else {
+ /* got more than one building in the same equiv group?
+ * first in the group that exists wins. */
+ building_vector_iterate(&group->buildings, elt) {
+ if (is_wonder(*elt) && game.global_wonders[*elt] != 0) {
+ return *elt;
+ }
+ } building_vector_iterate_end;
+
+ return -1;
+ }
+}
+
+/**************************************************************************
+...
+**************************************************************************/
+int get_everlasting_bonus(struct player *plr, enum effect_type eff)
+{
+ int bonus = 0;
+
+ building_vector_iterate(get_effect_buildings(eff), elt) {
+ int active;
+
+ active = active_everlasting_building(plr, *elt, eff);
+
+ if (active == *elt) {
+ bonus += get_player_power(plr, active, eff);
+ }
+ } building_vector_iterate_end;
+
+ return bonus;
+}
+
+/**************************************************************************
+...
+**************************************************************************/
static int inline active_player_building(struct player *plr, Impr_Type_id id,
enum effect_type eff)
{
struct eff_group *group;
diff -Nurd -X diff_ignore fc/common/eff.h freeciv/common/eff.h
--- fc/common/eff.h 2004-05-19 23:49:13.528726592 +0100
+++ freeciv/common/eff.h 2004-05-20 01:46:37.167930672 +0100
@@ -48,6 +48,7 @@
int parse_req(Impr_Type_id id, enum req_type req, const char *arg);
/* Functions to know the bonuses a certain effect is granting. */
+int get_everlasting_bonus(struct player *plr, enum effect_type eff);
int get_player_bonus(struct player *plr, enum effect_type eff);
int get_city_bonus(struct city *pcity, enum effect_type eff);
- [Freeciv-Dev] Re: (PR#8754) effects patch, Per Inge Mathisen, 2004/05/17
- [Freeciv-Dev] (PR#8754) effects patch, Vasco Alexandre da Silva Costa, 2004/05/17
- [Freeciv-Dev] Re: (PR#8754) effects patch (2), Per Inge Mathisen, 2004/05/17
- [Freeciv-Dev] Re: (PR#8754) effects patch, Jason Short, 2004/05/17
- [Freeciv-Dev] (PR#8754) effects patch, Vasco Alexandre da Silva Costa, 2004/05/19
- [Freeciv-Dev] (PR#8754) effects patch v2, Vasco Alexandre da Silva Costa, 2004/05/19
- [Freeciv-Dev] (PR#8754) effects patch, Vasco Alexandre da Silva Costa, 2004/05/19
- [Freeciv-Dev] (PR#8754) effects patch, Vasco Alexandre da Silva Costa, 2004/05/19
- [Freeciv-Dev] (PR#8754) fix civ1 ruleset equiv_range for Hoover and Bach, Vasco Alexandre da Silva Costa, 2004/05/19
- [Freeciv-Dev] (PR#8754) effects patch: everlasting wonders,
Vasco Alexandre da Silva Costa <=
- [Freeciv-Dev] Re: (PR#8754) effects patch: everlasting wonders, Per Inge Mathisen, 2004/05/20
- [Freeciv-Dev] (PR#8754) effects patch, Vasco Alexandre da Silva Costa, 2004/05/20
- [Freeciv-Dev] (PR#8754) effects patch v3, Vasco Alexandre da Silva Costa, 2004/05/21
- [Freeciv-Dev] (PR#8754) effects patch, Jason Short, 2004/05/26
- [Freeciv-Dev] (PR#8754) effects patch, Vasco Alexandre da Silva Costa, 2004/05/28
- [Freeciv-Dev] (PR#8754) effects patch, Vasco Alexandre da Silva Costa, 2004/05/28
- [Freeciv-Dev] (PR#8754) effects patch, Vasco Alexandre da Silva Costa, 2004/05/29
- [Freeciv-Dev] (PR#8754) effects patch, Marcelo Burda, 2004/05/31
- [Freeciv-Dev] (PR#8754) effects patch, Vasco Alexandre da Silva Costa, 2004/05/31
- [Freeciv-Dev] Re: (PR#8754) effects patch, Mike Kaufman, 2004/05/31
|
|