(V_CIVIL, V_MILIT, V_SHELL, V_GUN, V_PETROL, V_IRON, V_DUST, V_BAR,

V_FOOD, V_OIL, V_LCM, V_HCM, V_UW, V_RAD, V_ITEM): Remove, use item
types instead.
This commit is contained in:
Markus Armbruster 2004-08-17 16:12:31 +00:00
parent 09def8f156
commit 8ef7f35a56
17 changed files with 64 additions and 81 deletions

View file

@ -40,8 +40,6 @@
#define PLG_INCUBATE 3
#define PLG_EXPOSED 4
#define V_ITEM(x) (x)
#define I_NONE 0
#define I_CIVIL 1
#define I_MILIT 2
@ -59,19 +57,4 @@
#define I_RAD 14
#define I_MAX 14
#define V_CIVIL V_ITEM(I_CIVIL)
#define V_MILIT V_ITEM(I_MILIT)
#define V_SHELL V_ITEM(I_SHELL)
#define V_GUN V_ITEM(I_GUN)
#define V_PETROL V_ITEM(I_PETROL)
#define V_IRON V_ITEM(I_IRON)
#define V_DUST V_ITEM(I_DUST)
#define V_BAR V_ITEM(I_BAR)
#define V_FOOD V_ITEM(I_FOOD)
#define V_OIL V_ITEM(I_OIL)
#define V_LCM V_ITEM(I_LCM)
#define V_HCM V_ITEM(I_HCM)
#define V_UW V_ITEM(I_UW)
#define V_RAD V_ITEM(I_RAD)
#endif /* _VAR_H_ */

View file

@ -59,7 +59,7 @@ deli(void)
if ((ich = whatitem(player->argp[1], "deliver what? ")) == 0)
return RET_SYN;
/*
if (ich->i_vtype == V_CIVIL || ich->i_vtype == V_MILIT) {
if (ich->i_vtype == I_CIVIL || ich->i_vtype == I_MILIT) {
pr("You cannot deliver people!\n");
return RET_FAIL;
}

View file

@ -99,13 +99,13 @@ drop(void)
if (target.sct_own == player->cnum
|| getrel(getnatp(target.sct_own), player->cnum) == ALLIED) {
if (ip->i_vtype == V_CIVIL && target.sct_own != target.sct_oldown) {
if (ip->i_vtype == I_CIVIL && target.sct_own != target.sct_oldown) {
pr("Can't drop civilians into occupied sectors.\n");
return RET_FAIL;
}
} else {
/* into the unknown... */
if (ip->i_vtype != V_SHELL) {
if (ip->i_vtype != I_SHELL) {
pr("You don't own %s!\n", xyas(tx, ty, player->cnum));
return RET_FAIL;
}
@ -152,7 +152,7 @@ drop(void)
} else {
getsect(tx, ty, &target);
if (target.sct_type == SCT_WATER && (mission_flags & P_MINE)
&& ip->i_vtype == V_SHELL)
&& ip->i_vtype == I_SHELL)
pln_mine(&bomb_list, &target);
else
pln_dropoff(&bomb_list, ip, tx, ty, (s_char *)&target, EF_SECTOR);

View file

@ -74,7 +74,7 @@ explore(void)
if (!(ip = whatitem(player->argp[1], "explore with what? (civ/mil) ")))
return RET_SYN;
vtype = ip->i_vtype;
if ((vtype != V_CIVIL) && (vtype != V_MILIT)) {
if ((vtype != I_CIVIL) && (vtype != I_MILIT)) {
pr("You can only explore with civs and mil.\n");
return RET_FAIL;
}
@ -94,7 +94,7 @@ explore(void)
}
own = sect.sct_own;
mob = (int)sect.sct_mobil;
if (vtype == V_CIVIL && sect.sct_oldown != own) {
if (vtype == I_CIVIL && sect.sct_oldown != own) {
pr("You can't explore with conquered populace!\n");
return RET_SYN;
}
@ -103,12 +103,12 @@ explore(void)
xyas(sect.sct_x, sect.sct_y, player->cnum));
return RET_SYN;
}
if (vtype == V_CIVIL) {
if (vtype == I_CIVIL) {
work = sect.sct_work;
if (work != 100)
pr("Warning: civil unrest\n");
loyal = sect.sct_loyal;
} else if (vtype == V_MILIT) {
} else if (vtype == I_MILIT) {
work = 100;
loyal = 0;
}
@ -226,7 +226,7 @@ explore(void)
sect.sct_work = work;
sect.sct_loyal = loyal;
}
if (vtype == V_CIVIL && sect.sct_oldown != player->cnum) {
if (vtype == I_CIVIL && sect.sct_oldown != player->cnum) {
pr("Your civilians don't want to stay!\n");
getsect(start.sct_x, start.sct_y, &sect);
if (sect.sct_own != own) {
@ -262,7 +262,7 @@ explore(void)
}
if (infected && sect.sct_pstage == PLG_HEALTHY)
sect.sct_pstage = PLG_EXPOSED;
if (vtype == V_CIVIL) {
if (vtype == I_CIVIL) {
sect.sct_loyal
= (amt_dst * sect.sct_loyal + amount * loyal) / (amt_dst + amount);
sect.sct_work

View file

@ -113,7 +113,7 @@ fly(void)
dst_type = EF_SHIP;
}
if (ip && ip->i_vtype == V_CIVIL && target.sct_own != target.sct_oldown) {
if (ip && ip->i_vtype == I_CIVIL && target.sct_own != target.sct_oldown) {
pr("Can't fly civilians into occupied sectors.\n");
return RET_FAIL;
}

View file

@ -771,7 +771,7 @@ load_comm_ship(struct sctstr *sectp, struct shpstr *sp,
move_amt = sect_amt - ITEM_MAX;
if (!move_amt)
return RET_OK;
if (sectp->sct_oldown != player->cnum && item == V_CIVIL) {
if (sectp->sct_oldown != player->cnum && item == I_CIVIL) {
pr("%s civilians refuse to %s at %s!\n",
move_amt < 0 ? "Your" : "Foreign",
move_amt < 0 ? "disembark" : "board",
@ -979,7 +979,7 @@ load_comm_land(struct sctstr *sectp, struct lndstr *lp,
xyas(lp->lnd_x, lp->lnd_y, player->cnum));
return RET_FAIL;
}
if (sectp->sct_oldown != player->cnum && item == V_CIVIL) {
if (sectp->sct_oldown != player->cnum && item == I_CIVIL) {
pr("%s civilians refuse to %s at %s!\n",
move_amt < 0 ? "Your" : "Foreign",
move_amt < 0 ? "disembark" : "board",
@ -990,7 +990,7 @@ load_comm_land(struct sctstr *sectp, struct lndstr *lp,
lp->lnd_item[item] = land_amt + move_amt;
/* Did we put mils onto this unit? If so, reset the fortification */
if (item == V_MILIT && move_amt > 0)
if (item == I_MILIT && move_amt > 0)
lp->lnd_harden = 0;
if (move_amt >= 0) {
pr("%d %s loaded onto %s at %s\n",

View file

@ -94,7 +94,7 @@ move(void)
* military control necessary to move
* goodies in occupied territory.
*/
if (!istest && sect.sct_oldown != player->cnum && vtype != V_MILIT) {
if (!istest && sect.sct_oldown != player->cnum && vtype != I_MILIT) {
int tot_mil = 0;
struct nstr_item ni;
struct lndstr land;
@ -119,7 +119,7 @@ move(void)
}
own = sect.sct_own;
mob = (int)sect.sct_mobil;
if (!istest && vtype == V_CIVIL && sect.sct_oldown != own) {
if (!istest && vtype == I_CIVIL && sect.sct_oldown != own) {
pr("You can't move conquered populace!\n");
return RET_FAIL;
}
@ -128,12 +128,12 @@ move(void)
xyas(sect.sct_x, sect.sct_y, player->cnum));
return RET_SYN;
}
if (vtype == V_CIVIL) {
if (vtype == I_CIVIL) {
work = sect.sct_work;
if (work != 100)
pr("Warning: civil unrest\n");
loyal = sect.sct_loyal;
} else if (vtype == V_MILIT) {
} else if (vtype == I_MILIT) {
work = 100;
loyal = 0;
}
@ -251,7 +251,7 @@ move(void)
pr("Somebody has captured that sector!\n");
getsect(x, y, &sect);
}
if (vtype == V_CIVIL && sect.sct_item[I_CIVIL]
if (vtype == I_CIVIL && sect.sct_item[I_CIVIL]
&& sect.sct_oldown != player->cnum) {
pr("Your civilians don't want to stay!\n");
getsect(x, y, &sect);
@ -330,7 +330,7 @@ move(void)
*/
if (infected && sect.sct_pstage == PLG_HEALTHY)
sect.sct_pstage = PLG_EXPOSED;
if (vtype == V_CIVIL) {
if (vtype == I_CIVIL) {
sect.sct_loyal
= (amt_dst * sect.sct_loyal + amount * loyal) / (amt_dst + amount);
sect.sct_work
@ -388,16 +388,16 @@ would_abandon(struct sctstr *sp, int vtype, int amnt, struct lndstr *lp)
{
int mil, civs, loyalcivs;
if ((vtype != V_CIVIL) && (vtype != V_MILIT))
if ((vtype != I_CIVIL) && (vtype != I_MILIT))
return 0;
mil = sp->sct_item[I_MILIT];
civs = sp->sct_item[I_CIVIL];
if (vtype == V_MILIT)
if (vtype == I_MILIT)
mil -= amnt;
if (vtype == V_CIVIL)
if (vtype == I_CIVIL)
civs -= amnt;
if (sp->sct_own == sp->sct_oldown)

View file

@ -64,7 +64,7 @@ shoo(void)
s_char buf[128];
ip = whatitem(player->argp[1], "Shoot what <civ or uw> ");
if (ip == 0 || (ip->i_vtype != V_CIVIL && ip->i_vtype != V_UW))
if (ip == 0 || (ip->i_vtype != I_CIVIL && ip->i_vtype != I_UW))
return RET_SYN;
item = ip->i_vtype;
if (!snxtsct(&nstr, player->argp[2]))

View file

@ -196,12 +196,12 @@ commdamage(register int amt, int dam, int vtype)
{
int lost;
if (vtype == V_BAR && opt_SUPER_BARS)
if (vtype == I_BAR && opt_SUPER_BARS)
return amt;
lost = amt - effdamage(amt, dam);
if (vtype == V_MILIT || vtype == V_CIVIL || vtype == V_UW)
if (vtype == I_MILIT || vtype == I_CIVIL || vtype == I_UW)
lost = ldround(people_damage * lost, 1);
return amt - lost;
}

View file

@ -92,7 +92,7 @@ init_pchr(void)
for (p = pchr, pcount = 0; pcount < prd_maxno; pcount++, p++) {
if (opt_GO_RENEW) {
if (p->p_type == V_DUST || p->p_type == V_OIL)
if (p->p_type == I_DUST || p->p_type == I_OIL)
p->p_nrdep = 0;
}
}

View file

@ -43,20 +43,20 @@ struct ichrstr ichr[I_MAX + 2] = {
/* mnem vtype val sell lbs rg,wh,ur,bnk name */
{'?', 0, 0, 0, 0, {0, 0, 0, 0}, "unused"},
/* STM CHANGED HERE */
{'c', V_CIVIL, 1, 0, 1, {10, 10, 10, 10}, "civilians"},
{'m', V_MILIT, 0, 0, 1, {1, 1, 1, 1}, "military"},
{'s', V_SHELL, 5, 1, 1, {1, 10, 1, 1}, "shells"},
{'g', V_GUN, 60, 1, 10, {1, 10, 1, 1}, "guns"},
{'p', V_PETROL, 4, 1, 1, {1, 10, 1, 1}, "petrol"},
{'i', V_IRON, 2, 1, 1, {1, 10, 1, 1}, "iron ore"},
{'d', V_DUST, 20, 1, 5, {1, 10, 1, 1}, "dust (gold)"},
{'b', V_BAR, 280, 1, 50, {1, 5, 1, 4}, "bars of gold"},
{'f', V_FOOD, 0, 1, 1, {1, 10, 1, 1}, "food"},
{'o', V_OIL, 8, 1, 1, {1, 10, 1, 1}, "oil"},
{'l', V_LCM, 2, 1, 1, {1, 10, 1, 1}, "light products"},
{'h', V_HCM, 4, 1, 1, {1, 10, 1, 1}, "heavy products"},
{'u', V_UW, 1, 1, 2, {1, 2, 1, 1}, "uncompensated workers"},
{'r', V_RAD, 150, 1, 8, {1, 10, 1, 1}, "radioactive materials"},
{'c', I_CIVIL, 1, 0, 1, {10, 10, 10, 10}, "civilians"},
{'m', I_MILIT, 0, 0, 1, {1, 1, 1, 1}, "military"},
{'s', I_SHELL, 5, 1, 1, {1, 10, 1, 1}, "shells"},
{'g', I_GUN, 60, 1, 10, {1, 10, 1, 1}, "guns"},
{'p', I_PETROL, 4, 1, 1, {1, 10, 1, 1}, "petrol"},
{'i', I_IRON, 2, 1, 1, {1, 10, 1, 1}, "iron ore"},
{'d', I_DUST, 20, 1, 5, {1, 10, 1, 1}, "dust (gold)"},
{'b', I_BAR, 280, 1, 50, {1, 5, 1, 4}, "bars of gold"},
{'f', I_FOOD, 0, 1, 1, {1, 10, 1, 1}, "food"},
{'o', I_OIL, 8, 1, 1, {1, 10, 1, 1}, "oil"},
{'l', I_LCM, 2, 1, 1, {1, 10, 1, 1}, "light products"},
{'h', I_HCM, 4, 1, 1, {1, 10, 1, 1}, "heavy products"},
{'u', I_UW, 1, 1, 2, {1, 2, 1, 1}, "uncompensated workers"},
{'r', I_RAD, 150, 1, 8, {1, 10, 1, 1}, "radioactive materials"},
{0, 0, 0, 0, 0, {0, 0, 0, 0}, 0}
};

View file

@ -45,34 +45,34 @@ struct pchrstr pchr[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0,
"unused", "",},
{{I_LCM, I_HCM, I_NONE}, {2, 1, 0},
V_SHELL, -1, 3, 0, 0, NAT_TLEV, 20, 10, 100,
I_SHELL, -1, 3, 0, 0, NAT_TLEV, 20, 10, 100,
"shells", "shells",},
{{I_OIL, I_LCM, I_HCM}, {1, 5, 10},
V_GUN, -1, 30, 0, 0, NAT_TLEV, 20, 10, 100,
I_GUN, -1, 30, 0, 0, NAT_TLEV, 20, 10, 100,
"guns", "guns",},
{{I_OIL, I_NONE, I_NONE}, {1, 0, 0},
V_PETROL, -1, 1, 0, 0, NAT_TLEV, 20, 10, 1000,
I_PETROL, -1, 1, 0, 0, NAT_TLEV, 20, 10, 1000,
"petrol", "petrol",},
{{I_NONE, I_NONE, I_NONE}, {0, 0, 0},
V_IRON, -1, 0, offsetof(struct sctstr, sct_min), 0, -1, 0, 0, 100,
I_IRON, -1, 0, offsetof(struct sctstr, sct_min), 0, -1, 0, 0, 100,
"iron ore", "iron",},
{{I_NONE, I_NONE, I_NONE}, {0, 0, 0},
V_DUST, -1, 0, offsetof(struct sctstr, sct_gmin), 20, -1, 0, 0, 100,
I_DUST, -1, 0, offsetof(struct sctstr, sct_gmin), 20, -1, 0, 0, 100,
"gold dust", "dust",},
{{I_DUST, I_NONE, I_NONE}, {5, 0, 0},
V_BAR, -1, 10, 0, 0, -1, 0, 0, 100,
I_BAR, -1, 10, 0, 0, -1, 0, 0, 100,
"gold bars", "bars",},
{{I_NONE, I_NONE, I_NONE}, {0, 0, 0},
V_FOOD, -1, 0, offsetof(struct sctstr, sct_fertil), 0, NAT_TLEV, -10, 10, 900,
I_FOOD, -1, 0, offsetof(struct sctstr, sct_fertil), 0, NAT_TLEV, -10, 10, 900,
"food", "food",},
{{I_NONE, I_NONE, I_NONE}, {0, 0, 0},
V_OIL, -1, 0, offsetof(struct sctstr, sct_oil), 10, NAT_TLEV, -10, 10, 100,
I_OIL, -1, 0, offsetof(struct sctstr, sct_oil), 10, NAT_TLEV, -10, 10, 100,
"oil", "oil",},
{{I_IRON, I_NONE, I_NONE}, {1, 0, 0},
V_LCM, -1, 0, 0, 0, NAT_TLEV, -10, 10, 100,
I_LCM, -1, 0, 0, 0, NAT_TLEV, -10, 10, 100,
"light construction materials", "lcm",},
{{I_IRON, I_NONE, I_NONE}, {2, 0, 0},
V_HCM, -1, 0, 0, 0, NAT_TLEV, -10, 10, 100,
I_HCM, -1, 0, 0, 0, NAT_TLEV, -10, 10, 100,
"heavy construction materials", "hcm",},
{{I_DUST, I_OIL, I_LCM}, {1, 5, 10},
0, NAT_TLEV, 300, 0, 0, NAT_ELEV, 5, 10, 100,
@ -87,10 +87,10 @@ struct pchrstr pchr[] = {
0, NAT_HLEV, 9, 0, 0, -1, 0, 0, 100,
"happy strollers", "happy",},
{{I_NONE, I_NONE, I_NONE}, {0, 0, 0},
V_RAD, -1, 2, offsetof(struct sctstr, sct_uran), 35, NAT_TLEV, 40, 10, 100,
I_RAD, -1, 2, offsetof(struct sctstr, sct_uran), 35, NAT_TLEV, 40, 10, 100,
"radioactive materials", "rad",},
{{I_NONE, I_NONE, I_NONE}, {0, 0, 0},
V_DUST, -1, 0, offsetof(struct sctstr, sct_gmin), 20, -1, 0, 0, 75,
I_DUST, -1, 0, offsetof(struct sctstr, sct_gmin), 20, -1, 0, 0, 75,
"gold dust", "dust",},
{{I_NONE, I_NONE, I_NONE}, {0, 0, 0},
0, 0, 0, 0, 0, 0, 0, 0, 0, "", "",}

View file

@ -2554,7 +2554,7 @@ ask_move_in_off(struct combat *off, struct combat *def)
}
if (dam) {
left = commdamage(num_mil, dam, V_MILIT);
left = commdamage(num_mil, dam, I_MILIT);
if (left < num_mil) {
if (left) {
pr("%d of the mil you were moving were destroyed!\nOnly %d mil made it to %s\n", num_mil - left, left, xyas(def->x, def->y, player->cnum));

View file

@ -1134,9 +1134,9 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
}
/* Note we check would_abandon first because we don't want
to always have to do these checks */
if (would_abandon(&osect, V_CIVIL, 0, &(llp->land))) {
if (would_abandon(&osect, I_CIVIL, 0, &(llp->land))) {
stop = 0;
if (!want_to_abandon(&osect, V_CIVIL, 0, &(llp->land))) {
if (!want_to_abandon(&osect, I_CIVIL, 0, &(llp->land))) {
stop = 1;
}
/* now check stuff */

View file

@ -292,7 +292,7 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
xyas(tx, ty, player->cnum));
return;
}
if (ip->i_vtype == V_CIVIL && sectp->sct_own != sectp->sct_oldown) {
if (ip->i_vtype == I_CIVIL && sectp->sct_own != sectp->sct_oldown) {
pr("%s is occupied. Your civilians suffer from identity crisis and die.\n",
xyas(tx, ty, player->cnum));
return;
@ -621,7 +621,7 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, s_char mission)
own = sect.sct_oldown;
}
if (ip) {
if (ip->i_vtype == V_CIVIL) {
if (ip->i_vtype == I_CIVIL) {
if (pp->pln_own != own) {
pr("You don't control those civilians!\n");
return -1;

View file

@ -80,7 +80,7 @@ deliver(register struct sctstr *from, struct ichrstr *ip, int dir,
vtype = ip->i_vtype;
pack_src = ip->i_pkg[dp->d_pkg];
mobility = from->sct_mobil / 2;
if (vtype == V_CIVIL && from->sct_own != from->sct_oldown) {
if (vtype == I_CIVIL && from->sct_own != from->sct_oldown) {
wu(0, from->sct_own,
"The conquered populace in %s refuses to relocate!\n",
ownxy(from));

View file

@ -98,13 +98,13 @@ load_it(register struct shpstr *sp, register struct sctstr *psect, int i)
sect_amt = psect->sct_item[comm];
/* check for disloyal civilians */
if (psect->sct_oldown != shipown && comm == V_CIVIL) {
if (psect->sct_oldown != shipown && comm == I_CIVIL) {
wu(0, shipown,
"Ship #%d - unable to load disloyal civilians at %s.",
sp->shp_uid, xyas(psect->sct_x, psect->sct_y, psect->sct_own));
return 0;
}
if (comm == V_CIVIL || comm == V_MILIT)
if (comm == I_CIVIL || comm == I_MILIT)
sect_amt--; /* leave 1 civ or mil to hold the sector. */
vship = &mchr[(int)sp->shp_type];
abs_max = max_amt = vship->m_item[comm];
@ -133,7 +133,7 @@ load_it(register struct shpstr *sp, register struct sctstr *psect, int i)
sp->shp_item[comm] = ship_amt + transfer;
if (comm == V_CIVIL || comm == V_MILIT)
if (comm == I_CIVIL || comm == I_MILIT)
sect_amt++; /*adjustment */
psect->sct_item[comm] = sect_amt - transfer;
@ -188,14 +188,14 @@ unload_it(register struct shpstr *sp)
sect_amt = sectp->sct_item[comm];
/* check for disloyal civilians */
if (sectp->sct_oldown != shipown && comm == V_CIVIL) {
if (sectp->sct_oldown != shipown && comm == I_CIVIL) {
wu(0, sp->shp_own,
"Ship #%d - unable to unload civilians into a disloyal sector at %s.",
sp->shp_uid, xyas(sectp->sct_x, sectp->sct_y,
sectp->sct_own));
continue;
}
if (comm == V_CIVIL)
if (comm == I_CIVIL)
ship_amt--; /* This leaves 1 civs on board the ship */
max_amt = min(ship_amt, ITEM_MAX - sect_amt);