(march, navi): Switch to struct empobj * for leader and rename to leader.
No functional changes.
This commit is contained in:
parent
aafb4fdf8a
commit
90b987058b
2 changed files with 50 additions and 50 deletions
|
@ -51,7 +51,7 @@ march(void)
|
||||||
int together;
|
int together;
|
||||||
char *cp = NULL;
|
char *cp = NULL;
|
||||||
int leader_uid;
|
int leader_uid;
|
||||||
struct lndstr *lnd; /* leader */
|
struct empobj *leader;
|
||||||
int dir;
|
int dir;
|
||||||
int stopping = 0;
|
int stopping = 0;
|
||||||
int skip = 0;
|
int skip = 0;
|
||||||
|
@ -69,12 +69,12 @@ march(void)
|
||||||
pr("No lands\n");
|
pr("No lands\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
lnd = (struct lndstr *)get_leader(&land_list);
|
leader = get_leader(&land_list);
|
||||||
leader_uid = lnd->lnd_uid;
|
leader_uid = leader->uid;
|
||||||
pr("Leader is %s\n", prland(lnd));
|
pr("Leader is %s\n", obj_nameof(leader));
|
||||||
if (player->argp[2]) {
|
if (player->argp[2]) {
|
||||||
strcpy(buf, player->argp[2]);
|
strcpy(buf, player->argp[2]);
|
||||||
if (!(cp = lnd_path(together, lnd, buf)))
|
if (!(cp = lnd_path(together, (struct lndstr *)leader, buf)))
|
||||||
cp = player->argp[2];
|
cp = player->argp[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,19 +88,19 @@ march(void)
|
||||||
pr("No lands left\n");
|
pr("No lands left\n");
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
lnd = (struct lndstr *)get_leader(&land_list);
|
leader = get_leader(&land_list);
|
||||||
if (lnd->lnd_uid != leader_uid) {
|
if (leader->uid != leader_uid) {
|
||||||
leader_uid = lnd->lnd_uid;
|
leader_uid = leader->uid;
|
||||||
pr_leader_change((struct empobj *)lnd);
|
pr_leader_change(leader);
|
||||||
stopping = 1;
|
stopping = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!skip)
|
if (!skip)
|
||||||
nav_map(lnd->lnd_x, lnd->lnd_y, 1);
|
nav_map(leader->x, leader->y, 1);
|
||||||
else
|
else
|
||||||
skip = 0;
|
skip = 0;
|
||||||
sprintf(prompt, "<%.1f:%.1f: %s> ", maxmob,
|
sprintf(prompt, "<%.1f:%.1f: %s> ", maxmob,
|
||||||
minmob, xyas(lnd->lnd_x, lnd->lnd_y, player->cnum));
|
minmob, xyas(leader->x, leader->y, player->cnum));
|
||||||
cp = getstring(prompt, buf);
|
cp = getstring(prompt, buf);
|
||||||
/* Just in case any of our lands were shelled while we were at the
|
/* Just in case any of our lands were shelled while we were at the
|
||||||
* prompt, we call lnd_mar() again.
|
* prompt, we call lnd_mar() again.
|
||||||
|
@ -110,14 +110,14 @@ march(void)
|
||||||
pr("No lands left\n");
|
pr("No lands left\n");
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
lnd = (struct lndstr *)get_leader(&land_list);
|
leader = get_leader(&land_list);
|
||||||
if (lnd->lnd_uid != leader_uid) {
|
if (leader->uid != leader_uid) {
|
||||||
leader_uid = lnd->lnd_uid;
|
leader_uid = leader->uid;
|
||||||
pr_leader_change((struct empobj *)lnd);
|
pr_leader_change(leader);
|
||||||
stopping = 1;
|
stopping = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (cp && !(cp = lnd_path(together, lnd, buf)))
|
if (cp && !(cp = lnd_path(together, (struct lndstr *)leader, buf)))
|
||||||
cp = buf;
|
cp = buf;
|
||||||
}
|
}
|
||||||
if (cp == NULL || *cp == '\0')
|
if (cp == NULL || *cp == '\0')
|
||||||
|
@ -131,7 +131,7 @@ march(void)
|
||||||
}
|
}
|
||||||
ac = parse(cp, player->argp, NULL, scanspace, NULL);
|
ac = parse(cp, player->argp, NULL, scanspace, NULL);
|
||||||
if (ac <= 1) {
|
if (ac <= 1) {
|
||||||
sprintf(dp, "%d", lnd->lnd_uid);
|
sprintf(dp, "%d", leader->uid);
|
||||||
player->argp[1] = dp;
|
player->argp[1] = dp;
|
||||||
cp++;
|
cp++;
|
||||||
} else
|
} else
|
||||||
|
@ -152,10 +152,10 @@ march(void)
|
||||||
switch_leader(&land_list, -1);
|
switch_leader(&land_list, -1);
|
||||||
else
|
else
|
||||||
switch_leader(&land_list, atoi(player->argp[1]));
|
switch_leader(&land_list, atoi(player->argp[1]));
|
||||||
lnd = (struct lndstr *)get_leader(&land_list);
|
leader = get_leader(&land_list);
|
||||||
if (lnd->lnd_uid != leader_uid) {
|
if (leader->uid != leader_uid) {
|
||||||
leader_uid = lnd->lnd_uid;
|
leader_uid = leader->uid;
|
||||||
pr_leader_change((struct empobj *)lnd);
|
pr_leader_change(leader);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
|
@ -177,7 +177,7 @@ march(void)
|
||||||
case 'd':
|
case 'd':
|
||||||
if (ac == 2) {
|
if (ac == 2) {
|
||||||
player->argp[2] = player->argp[1];
|
player->argp[2] = player->argp[1];
|
||||||
sprintf(dp, "%d", lnd->lnd_uid);
|
sprintf(dp, "%d", leader->uid);
|
||||||
player->argp[1] = dp;
|
player->argp[1] = dp;
|
||||||
}
|
}
|
||||||
landmine();
|
landmine();
|
||||||
|
|
|
@ -50,7 +50,7 @@ navi(void)
|
||||||
int together;
|
int together;
|
||||||
char *cp = NULL;
|
char *cp = NULL;
|
||||||
int leader_uid;
|
int leader_uid;
|
||||||
struct shpstr *shp; /* flagship */
|
struct empobj *leader;
|
||||||
int dir;
|
int dir;
|
||||||
int stopping = 0;
|
int stopping = 0;
|
||||||
int skip = 0;
|
int skip = 0;
|
||||||
|
@ -70,12 +70,12 @@ navi(void)
|
||||||
pr("No ships\n");
|
pr("No ships\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
shp = (struct shpstr *)get_leader(&ship_list);
|
leader = get_leader(&ship_list);
|
||||||
leader_uid = shp->shp_uid;
|
leader_uid = leader->uid;
|
||||||
pr("Flagship is %s\n", prship(shp));
|
pr("Flagship is %s\n", obj_nameof(leader));
|
||||||
if (player->argp[2]) {
|
if (player->argp[2]) {
|
||||||
strcpy(buf, player->argp[2]);
|
strcpy(buf, player->argp[2]);
|
||||||
if (!(cp = shp_path(together, shp, buf)))
|
if (!(cp = shp_path(together, (struct shpstr *)leader, buf)))
|
||||||
cp = player->argp[2];
|
cp = player->argp[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,20 +95,20 @@ navi(void)
|
||||||
}
|
}
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
shp = (struct shpstr *)get_leader(&ship_list);
|
leader = get_leader(&ship_list);
|
||||||
if (shp->shp_uid != leader_uid) {
|
if (leader->uid != leader_uid) {
|
||||||
leader_uid = shp->shp_uid;
|
leader_uid = leader->uid;
|
||||||
pr_leader_change((struct empobj *)shp);
|
pr_leader_change(leader);
|
||||||
stopping = 1;
|
stopping = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!skip)
|
if (!skip)
|
||||||
nav_map(shp->shp_x, shp->shp_y,
|
nav_map(leader->x, leader->y,
|
||||||
!(mchr[(int)shp->shp_type].m_flags & M_SUB));
|
!(mchr[(int)leader->type].m_flags & M_SUB));
|
||||||
else
|
else
|
||||||
skip = 0;
|
skip = 0;
|
||||||
sprintf(prompt, "<%.1f:%.1f: %s> ", maxmob,
|
sprintf(prompt, "<%.1f:%.1f: %s> ", maxmob,
|
||||||
minmob, xyas(shp->shp_x, shp->shp_y, player->cnum));
|
minmob, xyas(leader->x, leader->y, player->cnum));
|
||||||
cp = getstring(prompt, buf);
|
cp = getstring(prompt, buf);
|
||||||
/* Just in case any of our ships were shelled while we were
|
/* Just in case any of our ships were shelled while we were
|
||||||
* at the prompt, we call shp_nav() again.
|
* at the prompt, we call shp_nav() again.
|
||||||
|
@ -123,21 +123,21 @@ navi(void)
|
||||||
}
|
}
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
shp = (struct shpstr *)get_leader(&ship_list);
|
leader = get_leader(&ship_list);
|
||||||
if (shp->shp_uid != leader_uid) {
|
if (leader->uid != leader_uid) {
|
||||||
leader_uid = shp->shp_uid;
|
leader_uid = leader->uid;
|
||||||
pr_leader_change((struct empobj *)shp);
|
pr_leader_change(leader);
|
||||||
stopping = 1;
|
stopping = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (cp && !(cp = shp_path(together, shp, buf)))
|
if (cp && !(cp = shp_path(together, (struct shpstr *)leader, buf)))
|
||||||
cp = buf;
|
cp = buf;
|
||||||
}
|
}
|
||||||
radmapnopr(shp->shp_x, shp->shp_y, (int)shp->shp_effic,
|
radmapnopr(leader->x, leader->y, (int)leader->effic,
|
||||||
(int)techfact(shp->shp_tech,
|
(int)techfact(leader->tech,
|
||||||
mchr[(int)shp->shp_type].m_vrnge),
|
mchr[(int)leader->type].m_vrnge),
|
||||||
(mchr[(int)shp->shp_type].m_flags & M_SONAR)
|
(mchr[(int)leader->type].m_flags & M_SONAR)
|
||||||
? techfact(shp->shp_tech, 1.0) : 0.0);
|
? techfact(leader->tech, 1.0) : 0.0);
|
||||||
if (cp == NULL || *cp == '\0')
|
if (cp == NULL || *cp == '\0')
|
||||||
cp = &dirch[DIR_STOP];
|
cp = &dirch[DIR_STOP];
|
||||||
dir = chkdir(*cp, DIR_STOP, DIR_VIEW);
|
dir = chkdir(*cp, DIR_STOP, DIR_VIEW);
|
||||||
|
@ -156,7 +156,7 @@ navi(void)
|
||||||
}
|
}
|
||||||
ac = parse(cp, player->argp, NULL, scanspace, NULL);
|
ac = parse(cp, player->argp, NULL, scanspace, NULL);
|
||||||
if (ac <= 1) {
|
if (ac <= 1) {
|
||||||
sprintf(dp, "%d", shp->shp_uid);
|
sprintf(dp, "%d", leader->uid);
|
||||||
player->argp[1] = dp;
|
player->argp[1] = dp;
|
||||||
cp++;
|
cp++;
|
||||||
} else
|
} else
|
||||||
|
@ -177,10 +177,10 @@ navi(void)
|
||||||
switch_leader(&ship_list, -1);
|
switch_leader(&ship_list, -1);
|
||||||
else
|
else
|
||||||
switch_leader(&ship_list, atoi(player->argp[1]));
|
switch_leader(&ship_list, atoi(player->argp[1]));
|
||||||
shp = (struct shpstr *)get_leader(&ship_list);
|
leader = get_leader(&ship_list);
|
||||||
if (shp->shp_uid != leader_uid) {
|
if (leader->uid != leader_uid) {
|
||||||
leader_uid = shp->shp_uid;
|
leader_uid = leader->uid;
|
||||||
pr_leader_change((struct empobj *)shp);
|
pr_leader_change(leader);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
|
@ -206,7 +206,7 @@ navi(void)
|
||||||
case 'd':
|
case 'd':
|
||||||
if (ac == 2) {
|
if (ac == 2) {
|
||||||
player->argp[2] = player->argp[1];
|
player->argp[2] = player->argp[1];
|
||||||
sprintf(dp, "%d", shp->shp_uid);
|
sprintf(dp, "%d", leader->uid);
|
||||||
player->argp[1] = dp;
|
player->argp[1] = dp;
|
||||||
}
|
}
|
||||||
mine();
|
mine();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue