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:
parent
7d90028f20
commit
cd8d742392
11 changed files with 514 additions and 471 deletions
|
@ -37,9 +37,10 @@
|
|||
#include <ctype.h>
|
||||
#include "commands.h"
|
||||
#include "file.h"
|
||||
#include "land.h"
|
||||
#include "map.h"
|
||||
#include "path.h"
|
||||
#include "empobj.h"
|
||||
#include "unit.h"
|
||||
|
||||
static int set_leader(struct emp_qelem *list, struct lndstr **leaderp);
|
||||
static void switch_leader(struct emp_qelem *list, int land_uid);
|
||||
|
@ -187,16 +188,16 @@ march(void)
|
|||
static int
|
||||
set_leader(struct emp_qelem *list, struct lndstr **leaderp)
|
||||
{
|
||||
struct llist *llp = (struct llist *)(list->q_back);
|
||||
struct ulist *llp = (struct ulist *)(list->q_back);
|
||||
|
||||
if (!*leaderp)
|
||||
pr("Leader is ");
|
||||
else if ((*leaderp)->lnd_uid != llp->land.lnd_uid)
|
||||
else if ((*leaderp)->lnd_uid != llp->unit.land.lnd_uid)
|
||||
pr("Changing leader to ");
|
||||
else
|
||||
return 0;
|
||||
*leaderp = &llp->land;
|
||||
pr("%s\n", prland(&llp->land));
|
||||
*leaderp = &llp->unit.land;
|
||||
pr("%s\n", prland(&llp->unit.land));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -204,7 +205,7 @@ static void
|
|||
switch_leader(struct emp_qelem *list, int land_uid)
|
||||
{
|
||||
struct emp_qelem *qp, *save;
|
||||
struct llist *llp;
|
||||
struct ulist *llp;
|
||||
|
||||
if (QEMPTY(list))
|
||||
return;
|
||||
|
@ -214,8 +215,8 @@ switch_leader(struct emp_qelem *list, int land_uid)
|
|||
emp_remque(qp);
|
||||
emp_insque(qp, list);
|
||||
qp = list->q_back;
|
||||
llp = (struct llist *)qp;
|
||||
if (llp->land.lnd_uid == land_uid || land_uid == -1)
|
||||
llp = (struct ulist *)qp;
|
||||
if (llp->unit.land.lnd_uid == land_uid || land_uid == -1)
|
||||
break;
|
||||
} while (list->q_back != save);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue