[Freeciv-Dev] (PR#13585) remove wid API
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13585 >
This patch removes the WID (worlist ID) API. It is unused,
undocumented, and (AFAICT) unhelpful.
-jason
Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.174
diff -p -u -r1.174 climisc.c
--- client/climisc.c 1 Aug 2005 23:09:35 -0000 1.174
+++ client/climisc.c 1 Aug 2005 23:17:28 -0000
@@ -491,54 +491,6 @@ struct city_production cid_production(ci
return prod;
}
-/**************************************************************************
-...
-**************************************************************************/
-wid wid_encode(bool is_unit, bool is_worklist, int id)
-{
- assert(!is_unit || !is_worklist);
-
- if (is_unit)
- return id + B_LAST;
- if (is_worklist)
- return id + B_LAST + U_LAST;
- return id;
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-bool wid_is_unit(wid wid)
-{
- assert(wid != WORKLIST_END);
-
- return (wid >= B_LAST && wid < B_LAST + U_LAST);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-bool wid_is_worklist(wid wid)
-{
- assert(wid != WORKLIST_END);
-
- return (wid >= B_LAST + U_LAST);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
-int wid_id(wid wid)
-{
- assert(wid != WORKLIST_END);
-
- if (wid >= B_LAST + U_LAST)
- return wid - (B_LAST + U_LAST);
- if (wid >= B_LAST)
- return wid - B_LAST;
- return wid;
-}
-
/****************************************************************
...
*****************************************************************/
@@ -848,52 +800,6 @@ int collect_cids5(cid * dest_cids, struc
}
/**************************************************************************
- Collect the wids of all possible targets of the given city.
-**************************************************************************/
-int collect_wids1(wid * dest_wids, struct city *pcity, bool wl_first,
- bool advanced_tech)
-{
- cid cids[U_LAST + B_LAST];
- int item, cids_used, wids_used = 0;
- struct item items[U_LAST + B_LAST];
-
- /* Fill in the global worklists now? */
- /* perhaps judicious use of goto would be good here? -mck */
- if (wl_first && game.player_ptr->worklists[0].is_valid && pcity) {
- int i;
- for (i = 0; i < MAX_NUM_WORKLISTS; i++) {
- if (game.player_ptr->worklists[i].is_valid) {
- dest_wids[wids_used] = wid_encode(FALSE, TRUE, i);
- wids_used++;
- }
- }
- }
-
- /* Fill in improvements and units */
- cids_used = collect_cids4(cids, pcity, advanced_tech);
- name_and_sort_items(cids, cids_used, items, FALSE, pcity);
-
- for (item = 0; item < cids_used; item++) {
- cid cid = items[item].cid;
- dest_wids[wids_used] = wid_encode(cid_is_unit(cid), FALSE, cid_id(cid));
- wids_used++;
- }
-
- /* we didn't fill in the global worklists above */
- if (!wl_first && game.player_ptr->worklists[0].is_valid && pcity) {
- int i;
- for (i = 0; i < MAX_NUM_WORKLISTS; i++) {
- if (game.player_ptr->worklists[i].is_valid) {
- dest_wids[wids_used] = wid_encode(FALSE, TRUE, i);
- wids_used++;
- }
- }
- }
-
- return wids_used;
-}
-
-/**************************************************************************
...
**************************************************************************/
int num_supported_units_in_city(struct city *pcity)
Index: client/climisc.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.h,v
retrieving revision 1.57
diff -p -u -r1.57 climisc.h
--- client/climisc.h 1 Aug 2005 23:09:35 -0000 1.57
+++ client/climisc.h 1 Aug 2005 23:17:28 -0000
@@ -21,7 +21,6 @@
struct Clause;
typedef int cid;
-typedef int wid;
void client_remove_player(int plrno);
void client_remove_city(struct city *pcity);
@@ -58,24 +57,6 @@ bool cid_is_unit(cid cid);
int cid_id(cid cid);
struct city_production cid_production(cid cid);
-/*
- * A worklist id (wid) can hold all objects which can be part of a
- * city worklist: improvements (with wonders), units and global
- * worklists. This is achieved by seperation the value set:
- * - (wid < B_LAST) denotes a improvement (including wonders)
- * - (B_LAST <= wid < B_LAST + U_LAST) denotes a unit with the
- * unit_type_id of (wid - B_LAST)
- * - (B_LAST + U_LAST<= wid) denotes a global worklist with the id of
- * (wid - (B_LAST + U_LAST))
- */
-
-#define WORKLIST_END (-1)
-
-wid wid_encode(bool is_unit, bool is_worklist, int id);
-bool wid_is_unit(wid wid);
-bool wid_is_worklist(wid wid);
-int wid_id(wid wid);
-
bool city_can_build_impr_or_unit(struct city *pcity, cid cid);
bool city_unit_supported(struct city *pcity, cid cid);
bool city_unit_present(struct city *pcity, cid cid);
@@ -96,8 +77,6 @@ int collect_cids2(cid * dest_cids);
int collect_cids3(cid * dest_cids);
int collect_cids4(cid * dest_cids, struct city *pcity, bool advanced_tech);
int collect_cids5(cid * dest_cids, struct city *pcity);
-int collect_wids1(wid * dest_wids, struct city *pcity, bool wl_first,
- bool advanced_tech);
/* the number of units in city */
int num_present_units_in_city(struct city* pcity);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#13585) remove wid API,
Jason Short <=
|
|