Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#8754) effects patch
Home

[Freeciv-Dev] (PR#8754) effects patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: vasc@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#8754) effects patch
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 5 Aug 2004 09:29:25 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8754 >

In this function:

+/**************************************************************************
+  Returns the effect sources of this type currently active at the city.
+**************************************************************************/
+struct building_vector get_city_bonus_sources(const struct city *pcity,
+                                             enum effect_type eff)
+{
+  struct player *plr = city_owner(pcity);
+  struct building_vector res;
+
+  building_vector_init(&res);
+
+  building_vector_iterate(get_buildings_with_effect(eff), pbldg) {
+    if (get_effect_value(TARGET_CITY, plr, pcity, B_LAST, NULL, *pbldg,
eff)) {+      building_vector_append(&res, pbldg);
+    }
+  } building_vector_iterate_end;
+
+  return res;
+}

memory is allocated, since a building vector is basically a pointer.  It
must later be freed (presumably by the caller) via building_vector_free.
 I doubt this is done (I didn't check), but even if it is this must be
documented in the header.

jason



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