Combined struct llist and struct mlist into superset struct ulist.

(assa, set_leader, switch_leader, set_flagship, switch_flagship,
take_move_in_mob, get_land, ask_olist, att_get_defense,
get_dlist, get_ototal, get_dtotal, kill_land, att_infect_units,
put_land, att_reacting_units, count_bodies, att_fight,
send_reacting_units_home, take_def, ask_move_in, move_in_land,
lnd_print, lnd_delete, lnd_take_casualty, lnd_takemob,
lnd_sel, lnd_mar, lnd_put, lnd_sweep, contains_engineer,
lnd_check_mines, lnd_list, lnd_mess,
lnd_damage, lnd_easiest_target, lnd_mar_one_sector, shp_sel,
shp_nav, shp_put, shp_sweep, shp_check_one_mines, shp_check_mines,
shp_list, shp_mess, shp_count, shp_damage_one, shp_damage,
shp_contains, most_valuable_ship, shp_easiest_target,
shp_missile_interdiction, notify_coastguard,
shp_view, shp_nav_one_sector, shp_missdef, nav_ship,
fltp_to_list): Switch to struct ulist from either struct mlist
or struct llist.
This commit is contained in:
Ron Koenderink 2006-09-25 03:29:06 +00:00
parent 7d90028f20
commit cd8d742392
11 changed files with 514 additions and 471 deletions

View file

@ -38,7 +38,8 @@
#include "map.h"
#include "optlist.h"
#include "path.h"
#include "ship.h"
#include "empobj.h"
#include "unit.h"
static int set_flagship(struct emp_qelem *list, struct shpstr **flagshipp);
static void switch_flagship(struct emp_qelem *list, int ship_uid);
@ -288,16 +289,16 @@ nav_map(int x, int y, int show_designations)
static int
set_flagship(struct emp_qelem *list, struct shpstr **flagshipp)
{
struct mlist *mlp = (struct mlist *)(list->q_back);
struct ulist *mlp = (struct ulist *)(list->q_back);
if (!*flagshipp)
pr("Flagship is ");
else if ((*flagshipp)->shp_uid != mlp->ship.shp_uid)
else if ((*flagshipp)->shp_uid != mlp->unit.ship.shp_uid)
pr("Changing flagship to ");
else
return 0;
*flagshipp = &mlp->ship;
pr("%s\n", prship(&mlp->ship));
*flagshipp = &mlp->unit.ship;
pr("%s\n", prship(&mlp->unit.ship));
return 1;
}
@ -305,7 +306,7 @@ static void
switch_flagship(struct emp_qelem *list, int ship_uid)
{
struct emp_qelem *qp, *save;
struct mlist *mlp;
struct ulist *mlp;
if (QEMPTY(list))
return;
@ -315,8 +316,8 @@ switch_flagship(struct emp_qelem *list, int ship_uid)
emp_remque(qp);
emp_insque(qp, list);
qp = list->q_back;
mlp = (struct mlist *)qp;
if (mlp->ship.shp_uid == ship_uid || ship_uid == -1)
mlp = (struct ulist *)qp;
if (mlp->unit.ship.shp_uid == ship_uid || ship_uid == -1)
break;
} while (list->q_back != save);
}