[Freeciv-Dev] (PR#18520) [Patch] Remove find_boat()
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#18520) [Patch] Remove find_boat() |
From: |
"Marko Lindqvist" <cazfi74@xxxxxxxxx> |
Date: |
Tue, 11 Jul 2006 15:22:29 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=18520 >
This converts last user of find_boat() to use aiferry_find_boat()
instead. find_boat() is removed.
- ML
diff -Nurd -X.diff_ignore freeciv/ai/aiunit.c freeciv/ai/aiunit.c
--- freeciv/ai/aiunit.c 2006-07-11 19:04:51.593750000 +0300
+++ freeciv/ai/aiunit.c 2006-07-12 01:12:36.515625000 +0300
@@ -1205,7 +1205,6 @@
int maxd, needferry;
/* Do we have access to sea? */
bool harbor = FALSE;
- struct tile *best_tile = NULL;
/* Build cost of the attacker (+adjustments) */
int bcost, bcost_bal;
bool handicap = ai_handicap(pplayer, H_TARGETS);
@@ -1315,7 +1314,7 @@
generate_warmap(tile_get_city(*dest_tile), punit);
if (is_ground_unit(punit)) {
- int boatid = find_boat(pplayer, &best_tile, 2);
+ int boatid = aiferry_find_boat(punit, 2, NULL);
ferryboat = player_find_unit_by_id(pplayer, boatid);
}
@@ -1472,7 +1471,7 @@
if (punit->id != 0 && ferryboat && is_ground_unit(punit)) {
UNIT_LOG(LOG_DEBUG, punit, "in fstk with boat %s@(%d, %d) -> %s@(%d,
%d)"
" (go_by_boat=%d, move_time=%d, want=%d, best=%d)",
- unit_type(ferryboat)->name, best_tile->x, best_tile->y,
+ unit_type(ferryboat)->name, ferryboat->tile->x,
ferryboat->tile->y,
acity->name, TILE_XY(acity->tile),
go_by_boat, move_time, want, best);
}
diff -Nurd -X.diff_ignore freeciv/server/settlers.c freeciv/server/settlers.c
--- freeciv/server/settlers.c 2006-07-12 00:50:02.031250000 +0300
+++ freeciv/server/settlers.c 2006-07-12 01:13:08.078125000 +0300
@@ -653,39 +653,6 @@
}
/**************************************************************************
- Tries to find a boat for our unit. Requires warmap to be initialized
- with respect to x, y. cap is the requested capacity on the transport.
- Note that it may return a transport with less than cap capacity if this
- transport has zero move cost to x, y.
-
- The "virtual boats" code is not used. It is probably too unreliable,
- since the AI switches its production back and forth continously.
-
- FIXME: if there is a (free) boat in a city filled with units,
- ground_unit_transporter_capacity will return negative.
- TODO: Kill me. There is a reliable version of this, find_ferry.
-**************************************************************************/
-Unit_type_id find_boat(struct player *pplayer, struct tile **ptile, int cap)
-{
- int best = 22; /* arbitrary maximum distance, I will admit! */
- Unit_type_id id = 0;
- unit_list_iterate(pplayer->units, aunit)
- if (is_ground_units_transport(aunit)) {
- if (WARMAP_COST(aunit->tile) < best &&
- (WARMAP_COST(aunit->tile) == 0 ||
- ground_unit_transporter_capacity(aunit->tile,
- pplayer) >= cap)) {
- id = aunit->id;
- best = WARMAP_COST(aunit->tile);
- *ptile = aunit->tile;
- }
- }
- unit_list_iterate_end;
- if (id != 0) return(id);
- return(id);
-}
-
-/**************************************************************************
Returns TRUE if there are (other) ground units than punit stacked on
punit's tile.
**************************************************************************/
diff -Nurd -X.diff_ignore freeciv/server/settlers.h freeciv/server/settlers.h
--- freeciv/server/settlers.h 2006-07-11 19:08:20.593750000 +0300
+++ freeciv/server/settlers.h 2006-07-12 01:13:16.625000000 +0300
@@ -18,7 +18,6 @@
void auto_settlers_init(void);
void auto_settlers_player(struct player *pplayer);
-int find_boat(struct player *pplayer, struct tile **boat_tile, int cap);
#define MORT 24
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#18520) [Patch] Remove find_boat(),
Marko Lindqvist <=
|
|