split g into multiple structures
The consolidation of global variables from scattered source
files into decl.c and declared in decl.h was begun in 3.7.0.
Their placement in common files was done for centralized
initialization and potential re-initialization during a
"play again" scenario.
It wasn't really necessary for all of them to be housed in a
single huge structure to meet the "play again" requirement,
and the single huge structure has been a little unwieldy when
it comes to maintenance.
Following this commit, instead of one single extremely large structure
named 'g' to house all of the relocated global variables, they
are distributed into several ga through gz.
To make things easy for the developer, each variable is placed
into the struct corresponding to the starting letter of the variable.
That way, no lookup is required in order to know which struct houses
a particular variable, it is a simple match to the starting letter
for all the centralized global variables.
A global variable named 'amulets', would be found in ga.
ga.amulets
^ ^
A global varable named 'move', would be found in gm.
gm.moves
^ ^
A global variable named 'val_for_n_or_more' would be found in gv.
gv.val_for_n_or_more
^ ^
A global variable named 'youmonst' would be found in gy.
gy.youmonst
^ ^
This commit is contained in:
290
src/shk.c
290
src/shk.c
@@ -17,7 +17,7 @@ static void kops_gone(boolean);
|
||||
|
||||
#define NOTANGRY(mon) ((mon)->mpeaceful)
|
||||
#define ANGRY(mon) (!NOTANGRY(mon))
|
||||
#define IS_SHOP(x) (g.rooms[x].rtype >= SHOPBASE)
|
||||
#define IS_SHOP(x) (gr.rooms[x].rtype >= SHOPBASE)
|
||||
|
||||
#define muteshk(shkp) (helpless(shkp) || (shkp)->data->msound <= MS_ANIMAL)
|
||||
|
||||
@@ -103,7 +103,7 @@ static const char *const angrytexts[] = {
|
||||
long
|
||||
money2mon(struct monst* mon, long amount)
|
||||
{
|
||||
struct obj *ygold = findgold(g.invent);
|
||||
struct obj *ygold = findgold(gi.invent);
|
||||
|
||||
if (amount <= 0) {
|
||||
impossible("%s payment in money2mon!", amount ? "negative" : "zero");
|
||||
@@ -120,7 +120,7 @@ money2mon(struct monst* mon, long amount)
|
||||
remove_worn_item(ygold, FALSE); /* quiver */
|
||||
freeinv(ygold);
|
||||
add_to_minv(mon, ygold);
|
||||
g.context.botl = 1;
|
||||
gc.context.botl = 1;
|
||||
return amount;
|
||||
}
|
||||
|
||||
@@ -148,12 +148,12 @@ money2u(struct monst* mon, long amount)
|
||||
mongold = splitobj(mongold, amount);
|
||||
obj_extract_self(mongold);
|
||||
|
||||
if (!merge_choice(g.invent, mongold) && inv_cnt(FALSE) >= 52) {
|
||||
if (!merge_choice(gi.invent, mongold) && inv_cnt(FALSE) >= 52) {
|
||||
You("have no room for the gold!");
|
||||
dropy(mongold);
|
||||
} else {
|
||||
addinv(mongold);
|
||||
g.context.botl = 1;
|
||||
gc.context.botl = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ void
|
||||
shkgone(struct monst* mtmp)
|
||||
{
|
||||
struct eshk *eshk = ESHK(mtmp);
|
||||
struct mkroom *sroom = &g.rooms[eshk->shoproom - ROOMOFFSET];
|
||||
struct mkroom *sroom = &gr.rooms[eshk->shoproom - ROOMOFFSET];
|
||||
struct obj *otmp;
|
||||
char *p;
|
||||
int sx, sy;
|
||||
@@ -192,12 +192,12 @@ shkgone(struct monst* mtmp)
|
||||
discard_damage_owned_by(mtmp);
|
||||
sroom->resident = (struct monst *) 0;
|
||||
if (!search_special(ANY_SHOP))
|
||||
g.level.flags.has_shop = 0;
|
||||
gl.level.flags.has_shop = 0;
|
||||
|
||||
/* items on shop floor revert to ordinary objects */
|
||||
for (sx = sroom->lx; sx <= sroom->hx; sx++)
|
||||
for (sy = sroom->ly; sy <= sroom->hy; sy++)
|
||||
for (otmp = g.level.objects[sx][sy]; otmp;
|
||||
for (otmp = gl.level.objects[sx][sy]; otmp;
|
||||
otmp = otmp->nexthere)
|
||||
otmp->no_charge = 0;
|
||||
|
||||
@@ -218,14 +218,14 @@ void
|
||||
set_residency(register struct monst* shkp, register boolean zero_out)
|
||||
{
|
||||
if (on_level(&(ESHK(shkp)->shoplevel), &u.uz))
|
||||
g.rooms[ESHK(shkp)->shoproom - ROOMOFFSET].resident =
|
||||
gr.rooms[ESHK(shkp)->shoproom - ROOMOFFSET].resident =
|
||||
(zero_out) ? (struct monst *) 0 : shkp;
|
||||
}
|
||||
|
||||
void
|
||||
replshk(register struct monst* mtmp, register struct monst* mtmp2)
|
||||
{
|
||||
g.rooms[ESHK(mtmp2)->shoproom - ROOMOFFSET].resident = mtmp2;
|
||||
gr.rooms[ESHK(mtmp2)->shoproom - ROOMOFFSET].resident = mtmp2;
|
||||
if (inhishop(mtmp) && *u.ushops == ESHK(mtmp)->shoproom) {
|
||||
ESHK(mtmp2)->bill_p = &(ESHK(mtmp2)->bill[0]);
|
||||
}
|
||||
@@ -244,7 +244,7 @@ restshk(struct monst* shkp, boolean ghostly)
|
||||
/* savebones guarantees that non-homed shk's will be gone */
|
||||
if (ghostly) {
|
||||
assign_level(&eshkp->shoplevel, &u.uz);
|
||||
if (ANGRY(shkp) && strncmpi(eshkp->customer, g.plname, PL_NSIZ))
|
||||
if (ANGRY(shkp) && strncmpi(eshkp->customer, gp.plname, PL_NSIZ))
|
||||
pacify_shk(shkp, TRUE);
|
||||
}
|
||||
}
|
||||
@@ -277,19 +277,19 @@ setpaid(register struct monst* shkp)
|
||||
register struct obj *obj;
|
||||
register struct monst *mtmp;
|
||||
|
||||
clear_unpaid(shkp, g.invent);
|
||||
clear_unpaid(shkp, gi.invent);
|
||||
clear_unpaid(shkp, fobj);
|
||||
clear_unpaid(shkp, g.level.buriedobjlist);
|
||||
if (g.thrownobj)
|
||||
clear_unpaid_obj(shkp, g.thrownobj);
|
||||
if (g.kickedobj)
|
||||
clear_unpaid_obj(shkp, g.kickedobj);
|
||||
clear_unpaid(shkp, gl.level.buriedobjlist);
|
||||
if (gt.thrownobj)
|
||||
clear_unpaid_obj(shkp, gt.thrownobj);
|
||||
if (gk.kickedobj)
|
||||
clear_unpaid_obj(shkp, gk.kickedobj);
|
||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
|
||||
clear_unpaid(shkp, mtmp->minvent);
|
||||
for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp->nmon)
|
||||
for (mtmp = gm.migrating_mons; mtmp; mtmp = mtmp->nmon)
|
||||
clear_unpaid(shkp, mtmp->minvent);
|
||||
|
||||
while ((obj = g.billobjs) != 0) {
|
||||
while ((obj = gb.billobjs) != 0) {
|
||||
obj_extract_self(obj);
|
||||
dealloc_obj(obj);
|
||||
}
|
||||
@@ -327,10 +327,10 @@ call_kops(register struct monst* shkp, register boolean nearshop)
|
||||
if (!Deaf)
|
||||
pline("An alarm sounds!");
|
||||
|
||||
nokops = ((g.mvitals[PM_KEYSTONE_KOP].mvflags & G_GONE)
|
||||
&& (g.mvitals[PM_KOP_SERGEANT].mvflags & G_GONE)
|
||||
&& (g.mvitals[PM_KOP_LIEUTENANT].mvflags & G_GONE)
|
||||
&& (g.mvitals[PM_KOP_KAPTAIN].mvflags & G_GONE));
|
||||
nokops = ((gm.mvitals[PM_KEYSTONE_KOP].mvflags & G_GONE)
|
||||
&& (gm.mvitals[PM_KOP_SERGEANT].mvflags & G_GONE)
|
||||
&& (gm.mvitals[PM_KOP_LIEUTENANT].mvflags & G_GONE)
|
||||
&& (gm.mvitals[PM_KOP_KAPTAIN].mvflags & G_GONE));
|
||||
|
||||
if (!angry_guards(!!Deaf) && nokops) {
|
||||
if (Verbose(3, call_kops1) && !Deaf)
|
||||
@@ -416,7 +416,7 @@ u_left_shop(char *leavestring, boolean newlev)
|
||||
if (!Deaf && !muteshk(shkp))
|
||||
verbalize(not_upset ? "%s! Please pay before leaving."
|
||||
: "%s! Don't you leave without paying!",
|
||||
g.plname);
|
||||
gp.plname);
|
||||
else
|
||||
pline("%s %s that you need to pay before leaving%s",
|
||||
Shknam(shkp),
|
||||
@@ -529,7 +529,7 @@ static void
|
||||
deserted_shop(/*const*/ char* enterstring)
|
||||
{
|
||||
struct monst *mtmp;
|
||||
struct mkroom *r = &g.rooms[(int) *enterstring - ROOMOFFSET];
|
||||
struct mkroom *r = &gr.rooms[(int) *enterstring - ROOMOFFSET];
|
||||
int x, y, m = 0, n = 0;
|
||||
|
||||
for (x = r->lx; x <= r->hx; ++x)
|
||||
@@ -589,11 +589,11 @@ u_entered_shop(char* enterstring)
|
||||
eshkp->bill_p = &(eshkp->bill[0]);
|
||||
|
||||
if ((!eshkp->visitct || *eshkp->customer)
|
||||
&& strncmpi(eshkp->customer, g.plname, PL_NSIZ)) {
|
||||
&& strncmpi(eshkp->customer, gp.plname, PL_NSIZ)) {
|
||||
/* You seem to be new here */
|
||||
eshkp->visitct = 0;
|
||||
eshkp->following = 0;
|
||||
(void) strncpy(eshkp->customer, g.plname, PL_NSIZ);
|
||||
(void) strncpy(eshkp->customer, gp.plname, PL_NSIZ);
|
||||
pacify_shk(shkp, TRUE);
|
||||
}
|
||||
|
||||
@@ -610,11 +610,11 @@ u_entered_shop(char* enterstring)
|
||||
return;
|
||||
}
|
||||
|
||||
rt = g.rooms[*enterstring - ROOMOFFSET].rtype;
|
||||
rt = gr.rooms[*enterstring - ROOMOFFSET].rtype;
|
||||
|
||||
if (ANGRY(shkp)) {
|
||||
if (!Deaf && !muteshk(shkp))
|
||||
verbalize("So, %s, you dare return to %s %s?!", g.plname,
|
||||
verbalize("So, %s, you dare return to %s %s?!", gp.plname,
|
||||
s_suffix(shkname(shkp)), shtypes[rt - SHOPBASE].name);
|
||||
else
|
||||
pline("%s seems %s over your return to %s %s!",
|
||||
@@ -623,7 +623,7 @@ u_entered_shop(char* enterstring)
|
||||
} else if (eshkp->surcharge) {
|
||||
if (!Deaf && !muteshk(shkp))
|
||||
verbalize("Back again, %s? I've got my %s on you.",
|
||||
g.plname, mbodypart(shkp, EYE));
|
||||
gp.plname, mbodypart(shkp, EYE));
|
||||
else
|
||||
pline_The("atmosphere at %s %s seems unwelcoming.",
|
||||
s_suffix(shkname(shkp)), shtypes[rt - SHOPBASE].name);
|
||||
@@ -636,7 +636,7 @@ u_entered_shop(char* enterstring)
|
||||
Shknam(shkp), noit_mhis(shkp));
|
||||
} else {
|
||||
if (!Deaf && !muteshk(shkp))
|
||||
verbalize("%s, %s! Welcome%s to %s %s!", Hello(shkp), g.plname,
|
||||
verbalize("%s, %s! Welcome%s to %s %s!", Hello(shkp), gp.plname,
|
||||
eshkp->visitct++ ? " again" : "",
|
||||
s_suffix(shkname(shkp)), shtypes[rt - SHOPBASE].name);
|
||||
else
|
||||
@@ -720,7 +720,7 @@ pick_pick(struct obj* obj)
|
||||
|
||||
/* if you bring a sack of N picks into a shop to sell,
|
||||
don't repeat this N times when they're taken out */
|
||||
if (g.moves != pickmovetime) {
|
||||
if (gm.moves != pickmovetime) {
|
||||
if (!Deaf && !muteshk(shkp))
|
||||
verbalize("You sneaky %s! Get out of here with that pick!",
|
||||
cad(FALSE));
|
||||
@@ -730,7 +730,7 @@ pick_pick(struct obj* obj)
|
||||
haseyes(shkp->data) ? "glares at"
|
||||
: "is dismayed because of");
|
||||
}
|
||||
pickmovetime = g.moves;
|
||||
pickmovetime = gm.moves;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -836,7 +836,7 @@ shop_keeper(char rmno)
|
||||
{
|
||||
struct monst *shkp;
|
||||
|
||||
shkp = (rmno >= ROOMOFFSET) ? g.rooms[rmno - ROOMOFFSET].resident : 0;
|
||||
shkp = (rmno >= ROOMOFFSET) ? gr.rooms[rmno - ROOMOFFSET].resident : 0;
|
||||
if (shkp) {
|
||||
if (has_eshk(shkp)) {
|
||||
if (ANGRY(shkp)) {
|
||||
@@ -849,13 +849,13 @@ shop_keeper(char rmno)
|
||||
shkp->isshk ? "shopkeeper career change"
|
||||
: "shop resident not shopkeeper",
|
||||
(int) rmno,
|
||||
(int) g.rooms[rmno - ROOMOFFSET].rtype,
|
||||
(int) gr.rooms[rmno - ROOMOFFSET].rtype,
|
||||
shkp->mnum,
|
||||
/* [real shopkeeper name is kept in ESHK,
|
||||
not MGIVENNAME] */
|
||||
has_mgivenname(shkp) ? MGIVENNAME(shkp) : "anonymous");
|
||||
/* not sure if this is appropriate, because it does nothing to
|
||||
correct the underlying g.rooms[].resident issue but... */
|
||||
correct the underlying gr.rooms[].resident issue but... */
|
||||
return (struct monst *) 0;
|
||||
}
|
||||
}
|
||||
@@ -1072,7 +1072,7 @@ pay(long tmp, register struct monst* shkp)
|
||||
money2mon(shkp, balance);
|
||||
else if (balance < 0)
|
||||
money2u(shkp, -balance);
|
||||
g.context.botl = 1;
|
||||
gc.context.botl = 1;
|
||||
if (robbed) {
|
||||
robbed -= tmp;
|
||||
if (robbed < 0)
|
||||
@@ -1088,7 +1088,7 @@ home_shk(struct monst *shkp, boolean killkops)
|
||||
coordxy x = ESHK(shkp)->shk.x, y = ESHK(shkp)->shk.y;
|
||||
|
||||
(void) mnearto(shkp, x, y, TRUE, RLOC_NOMSG);
|
||||
g.level.flags.has_shop = 1;
|
||||
gl.level.flags.has_shop = 1;
|
||||
if (killkops) {
|
||||
kops_gone(TRUE);
|
||||
pacify_guards();
|
||||
@@ -1220,7 +1220,7 @@ hot_pursuit(register struct monst* shkp)
|
||||
return;
|
||||
|
||||
rile_shk(shkp);
|
||||
(void) strncpy(ESHK(shkp)->customer, g.plname, PL_NSIZ);
|
||||
(void) strncpy(ESHK(shkp)->customer, gp.plname, PL_NSIZ);
|
||||
ESHK(shkp)->following = 1;
|
||||
}
|
||||
|
||||
@@ -1280,7 +1280,7 @@ dopay(void)
|
||||
int pass, tmp, sk = 0, seensk = 0;
|
||||
boolean paid = FALSE, stashed_gold = (hidden_gold(TRUE) > 0L);
|
||||
|
||||
g.multi = 0;
|
||||
gm.multi = 0;
|
||||
|
||||
/* Find how many shk's there are, how many are in
|
||||
* sight, and are you in a shop room with one.
|
||||
@@ -1389,7 +1389,7 @@ dopay(void)
|
||||
}
|
||||
|
||||
if (shkp != resident && NOTANGRY(shkp)) {
|
||||
umoney = money_cnt(g.invent);
|
||||
umoney = money_cnt(gi.invent);
|
||||
if (!ltmp)
|
||||
You("do not owe %s anything.", shkname(shkp));
|
||||
else if (!umoney) {
|
||||
@@ -1419,7 +1419,7 @@ dopay(void)
|
||||
|
||||
/* ltmp is still eshkp->robbed here */
|
||||
if (!eshkp->billct && !eshkp->debit) {
|
||||
umoney = money_cnt(g.invent);
|
||||
umoney = money_cnt(gi.invent);
|
||||
if (!ltmp && NOTANGRY(shkp)) {
|
||||
You("do not owe %s anything.", shkname(shkp));
|
||||
if (!umoney)
|
||||
@@ -1457,7 +1457,7 @@ dopay(void)
|
||||
: shkname(shkp),
|
||||
noit_mhim(shkp));
|
||||
pay(1000L, shkp);
|
||||
if (strncmp(eshkp->customer, g.plname, PL_NSIZ) || rn2(3))
|
||||
if (strncmp(eshkp->customer, gp.plname, PL_NSIZ) || rn2(3))
|
||||
make_happy_shk(shkp, FALSE);
|
||||
else
|
||||
pline("But %s is as angry as ever.", shkname(shkp));
|
||||
@@ -1476,7 +1476,7 @@ dopay(void)
|
||||
long loan = eshkp->loan;
|
||||
char sbuf[BUFSZ];
|
||||
|
||||
umoney = money_cnt(g.invent);
|
||||
umoney = money_cnt(gi.invent);
|
||||
Sprintf(sbuf, "You owe %s %ld %s ", shkname(shkp), dtmp,
|
||||
currency(dtmp));
|
||||
if (loan) {
|
||||
@@ -1504,7 +1504,7 @@ dopay(void)
|
||||
eshkp->debit = 0L;
|
||||
eshkp->loan = 0L;
|
||||
You("pay that debt.");
|
||||
g.context.botl = 1;
|
||||
gc.context.botl = 1;
|
||||
} else {
|
||||
dtmp -= eshkp->credit;
|
||||
eshkp->credit = 0L;
|
||||
@@ -1513,7 +1513,7 @@ dopay(void)
|
||||
eshkp->loan = 0L;
|
||||
pline("That debt is partially offset by your credit.");
|
||||
You("pay the remainder.");
|
||||
g.context.botl = 1;
|
||||
gc.context.botl = 1;
|
||||
}
|
||||
paid = TRUE;
|
||||
}
|
||||
@@ -1523,7 +1523,7 @@ dopay(void)
|
||||
register boolean itemize;
|
||||
int iprompt;
|
||||
|
||||
umoney = money_cnt(g.invent);
|
||||
umoney = money_cnt(gi.invent);
|
||||
if (!umoney && !eshkp->credit) {
|
||||
You("%shave no gold or credit%s.",
|
||||
stashed_gold ? "seem to " : "", paid ? " left" : "");
|
||||
@@ -1629,7 +1629,7 @@ dopayobj(
|
||||
{
|
||||
register struct obj *obj = *obj_p;
|
||||
long ltmp, quan, save_quan;
|
||||
long umoney = money_cnt(g.invent);
|
||||
long umoney = money_cnt(gi.invent);
|
||||
int buy;
|
||||
boolean stashed_gold = (hidden_gold(TRUE) > 0L),
|
||||
consumed = (which == 0);
|
||||
@@ -1753,8 +1753,8 @@ paybill(
|
||||
which has been shut inside a statue] */
|
||||
|
||||
/* this is where inventory will end up if any shk takes it */
|
||||
g.repo.location.x = g.repo.location.y = 0;
|
||||
g.repo.shopkeeper = 0;
|
||||
gr.repo.location.x = gr.repo.location.y = 0;
|
||||
gr.repo.shopkeeper = 0;
|
||||
|
||||
/*
|
||||
* Scan all shopkeepers on the level, to prioritize them:
|
||||
@@ -1857,7 +1857,7 @@ inherits(struct monst* shkp, int numsk, int croaked, boolean silently)
|
||||
if (roomno == eshkp->shoproom && inhishop(shkp) && !eshkp->billct
|
||||
&& !eshkp->robbed && !eshkp->debit && NOTANGRY(shkp)
|
||||
&& !eshkp->following && u.ugrave_arise < LOW_PM) {
|
||||
taken = (g.invent != 0);
|
||||
taken = (gi.invent != 0);
|
||||
if (taken && !silently)
|
||||
pline("%s gratefully inherits all your possessions.",
|
||||
Shknam(shkp));
|
||||
@@ -1874,9 +1874,9 @@ inherits(struct monst* shkp, int numsk, int croaked, boolean silently)
|
||||
}
|
||||
|
||||
if (eshkp->following || ANGRY(shkp) || take) {
|
||||
if (!g.invent)
|
||||
if (!gi.invent)
|
||||
goto skip;
|
||||
umoney = money_cnt(g.invent);
|
||||
umoney = money_cnt(gi.invent);
|
||||
takes[0] = '\0';
|
||||
if (helpless(shkp))
|
||||
Strcat(takes, "wakes up and ");
|
||||
@@ -1890,7 +1890,7 @@ inherits(struct monst* shkp, int numsk, int croaked, boolean silently)
|
||||
eshkp->robbed = 0L;
|
||||
if (umoney > 0L) {
|
||||
money2mon(shkp, umoney);
|
||||
g.context.botl = 1;
|
||||
gc.context.botl = 1;
|
||||
}
|
||||
if (!silently)
|
||||
pline("%s %s all your possessions.", Shknam(shkp), takes);
|
||||
@@ -1899,11 +1899,11 @@ inherits(struct monst* shkp, int numsk, int croaked, boolean silently)
|
||||
set_repo_loc(shkp);
|
||||
} else {
|
||||
money2mon(shkp, loss);
|
||||
g.context.botl = 1;
|
||||
gc.context.botl = 1;
|
||||
if (!silently)
|
||||
pline("%s %s the %ld %s %sowed %s.", Shknam(shkp),
|
||||
takes, loss, currency(loss),
|
||||
strncmp(eshkp->customer, g.plname, PL_NSIZ) ? ""
|
||||
strncmp(eshkp->customer, gp.plname, PL_NSIZ) ? ""
|
||||
: "you ",
|
||||
noit_mhim(shkp));
|
||||
/* shopkeeper has now been paid in full */
|
||||
@@ -1945,9 +1945,9 @@ set_repo_loc(struct monst* shkp)
|
||||
oy = u.uy;
|
||||
}
|
||||
/* finish_paybill will deposit invent here */
|
||||
g.repo.location.x = ox;
|
||||
g.repo.location.y = oy;
|
||||
g.repo.shopkeeper = shkp;
|
||||
gr.repo.location.x = ox;
|
||||
gr.repo.location.y = oy;
|
||||
gr.repo.shopkeeper = shkp;
|
||||
}
|
||||
|
||||
/* called at game exit, after inventory disclosure but before making bones;
|
||||
@@ -1955,8 +1955,8 @@ set_repo_loc(struct monst* shkp)
|
||||
void
|
||||
finish_paybill(void)
|
||||
{
|
||||
struct monst *shkp = g.repo.shopkeeper;
|
||||
int ox = g.repo.location.x, oy = g.repo.location.y;
|
||||
struct monst *shkp = gr.repo.shopkeeper;
|
||||
int ox = gr.repo.location.x, oy = gr.repo.location.y;
|
||||
|
||||
#if 0 /* don't bother */
|
||||
if (ox == 0 && oy == 0)
|
||||
@@ -1966,7 +1966,7 @@ finish_paybill(void)
|
||||
unleash_all();
|
||||
/* if hero has any gold left, take it into shopkeeper's possession */
|
||||
if (shkp) {
|
||||
long umoney = money_cnt(g.invent);
|
||||
long umoney = money_cnt(gi.invent);
|
||||
|
||||
if (umoney)
|
||||
money2mon(shkp, umoney);
|
||||
@@ -1983,7 +1983,7 @@ bp_to_obj(register struct bill_x* bp)
|
||||
register unsigned int id = bp->bo_id;
|
||||
|
||||
if (bp->useup)
|
||||
obj = o_on(id, g.billobjs);
|
||||
obj = o_on(id, gb.billobjs);
|
||||
else
|
||||
obj = find_oid(id);
|
||||
return obj;
|
||||
@@ -1992,7 +1992,7 @@ bp_to_obj(register struct bill_x* bp)
|
||||
/*
|
||||
* Look for o_id on all lists but billobj. Return obj or NULL if not found.
|
||||
* Its OK for restore_timers() to call this function, there should not
|
||||
* be any timeouts on the g.billobjs chain.
|
||||
* be any timeouts on the gb.billobjs chain.
|
||||
*/
|
||||
struct obj *
|
||||
find_oid(unsigned int id)
|
||||
@@ -2002,19 +2002,19 @@ find_oid(unsigned int id)
|
||||
int i;
|
||||
|
||||
/* first check various obj lists directly */
|
||||
if ((obj = o_on(id, g.invent)) != 0)
|
||||
if ((obj = o_on(id, gi.invent)) != 0)
|
||||
return obj;
|
||||
if ((obj = o_on(id, fobj)) != 0)
|
||||
return obj;
|
||||
if ((obj = o_on(id, g.level.buriedobjlist)) != 0)
|
||||
if ((obj = o_on(id, gl.level.buriedobjlist)) != 0)
|
||||
return obj;
|
||||
if ((obj = o_on(id, g.migrating_objs)) != 0)
|
||||
if ((obj = o_on(id, gm.migrating_objs)) != 0)
|
||||
return obj;
|
||||
|
||||
/* not found yet; check inventory for members of various monst lists */
|
||||
mmtmp[0] = fmon;
|
||||
mmtmp[1] = g.migrating_mons;
|
||||
mmtmp[2] = g.mydogs; /* for use during level changes */
|
||||
mmtmp[1] = gm.migrating_mons;
|
||||
mmtmp[2] = gm.mydogs; /* for use during level changes */
|
||||
for (i = 0; i < 3; i++)
|
||||
for (mon = mmtmp[i]; mon; mon = mon->nmon)
|
||||
if ((obj = o_on(id, mon->minvent)) != 0)
|
||||
@@ -2539,7 +2539,7 @@ add_one_tobill(struct obj *obj, boolean dummy, struct monst *shkp)
|
||||
bp->bo_id = obj->o_id;
|
||||
bp->bquan = obj->quan;
|
||||
if (dummy) { /* a dummy object must be inserted into */
|
||||
bp->useup = 1; /* the g.billobjs chain here. crucial for */
|
||||
bp->useup = 1; /* the gb.billobjs chain here. crucial for */
|
||||
add_to_billobjs(obj); /* eating floorfood in shop. see eat.c */
|
||||
} else
|
||||
bp->useup = 0;
|
||||
@@ -2564,8 +2564,8 @@ add_to_billobjs(struct obj* obj)
|
||||
if (obj->timed)
|
||||
obj_stop_timers(obj);
|
||||
|
||||
obj->nobj = g.billobjs;
|
||||
g.billobjs = obj;
|
||||
obj->nobj = gb.billobjs;
|
||||
gb.billobjs = obj;
|
||||
obj->where = OBJ_ONBILL;
|
||||
|
||||
/* if hero drinks a shop-owned potion, it will have been flagged
|
||||
@@ -2797,12 +2797,12 @@ append_honorific(char *buf)
|
||||
};
|
||||
|
||||
Strcat(buf, honored[rn2(SIZE(honored) - 1) + u.uevent.udemigod]);
|
||||
if (is_vampire(g.youmonst.data))
|
||||
if (is_vampire(gy.youmonst.data))
|
||||
Strcat(buf, (flags.female) ? " dark lady" : " dark lord");
|
||||
else if (maybe_polyd(is_elf(g.youmonst.data), Race_if(PM_ELF)))
|
||||
else if (maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF)))
|
||||
Strcat(buf, (flags.female) ? " hiril" : " hir");
|
||||
else
|
||||
Strcat(buf, !is_human(g.youmonst.data) ? " creature"
|
||||
Strcat(buf, !is_human(gy.youmonst.data) ? " creature"
|
||||
: (flags.female) ? " lady"
|
||||
: " sir");
|
||||
}
|
||||
@@ -2858,7 +2858,7 @@ sub_one_frombill(register struct obj* obj, register struct monst* shkp)
|
||||
otmp = newobj();
|
||||
*otmp = *obj;
|
||||
otmp->oextra = (struct oextra *) 0;
|
||||
bp->bo_id = otmp->o_id = next_ident(); /* g.context.ident++ */
|
||||
bp->bo_id = otmp->o_id = next_ident(); /* gc.context.ident++ */
|
||||
otmp->where = OBJ_FREE;
|
||||
otmp->quan = (bp->bquan -= obj->quan);
|
||||
otmp->owt = 0; /* superfluous */
|
||||
@@ -3046,7 +3046,7 @@ stolen_value(
|
||||
if (!silent) {
|
||||
if (canseemon(shkp)) {
|
||||
Norep("%s booms: \"%s, you are a thief!\"",
|
||||
Shknam(shkp), g.plname);
|
||||
Shknam(shkp), gp.plname);
|
||||
} else if (!Deaf) {
|
||||
Norep("You hear a scream, \"Thief!\""); /* Deaf-aware */
|
||||
}
|
||||
@@ -3104,9 +3104,9 @@ sellobj_state(int deliberate)
|
||||
This retains the old pre-query risk that slippery fingers while in
|
||||
shops entailed: you drop it, you've lost it.
|
||||
*/
|
||||
g.sell_response = (deliberate != SELL_NORMAL) ? '\0' : 'a';
|
||||
g.sell_how = deliberate;
|
||||
g.auto_credit = FALSE;
|
||||
gs.sell_response = (deliberate != SELL_NORMAL) ? '\0' : 'a';
|
||||
gs.sell_how = deliberate;
|
||||
ga.auto_credit = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3146,7 +3146,7 @@ sellobj(register struct obj* obj, coordxy x, coordxy y)
|
||||
|
||||
/* get one case out of the way: nothing to sell, and no gold */
|
||||
if (!(isgold || cgold)
|
||||
&& ((offer + gltmp) == 0L || g.sell_how == SELL_DONTSELL)) {
|
||||
&& ((offer + gltmp) == 0L || gs.sell_how == SELL_DONTSELL)) {
|
||||
boolean unpaid = is_unpaid(obj);
|
||||
|
||||
if (container) {
|
||||
@@ -3158,7 +3158,7 @@ sellobj(register struct obj* obj, coordxy x, coordxy y)
|
||||
} else
|
||||
obj->no_charge = 1;
|
||||
|
||||
if (!unpaid && (g.sell_how != SELL_DONTSELL)
|
||||
if (!unpaid && (gs.sell_how != SELL_DONTSELL)
|
||||
&& !special_stock(obj, shkp, FALSE))
|
||||
pline("%s seems uninterested.", Shknam(shkp));
|
||||
return;
|
||||
@@ -3197,7 +3197,7 @@ sellobj(register struct obj* obj, coordxy x, coordxy y)
|
||||
|
||||
donate_gold(gltmp, shkp, TRUE);
|
||||
|
||||
if (!offer || g.sell_how == SELL_DONTSELL) {
|
||||
if (!offer || gs.sell_how == SELL_DONTSELL) {
|
||||
if (!isgold) {
|
||||
if (container)
|
||||
dropped_container(obj, shkp, FALSE);
|
||||
@@ -3227,9 +3227,9 @@ sellobj(register struct obj* obj, coordxy x, coordxy y)
|
||||
char c, qbuf[BUFSZ];
|
||||
long tmpcr = ((offer * 9L) / 10L) + (offer <= 1L);
|
||||
|
||||
if (g.sell_how == SELL_NORMAL || g.auto_credit) {
|
||||
c = g.sell_response = 'y';
|
||||
} else if (g.sell_response != 'n') {
|
||||
if (gs.sell_how == SELL_NORMAL || ga.auto_credit) {
|
||||
c = gs.sell_response = 'y';
|
||||
} else if (gs.sell_response != 'n') {
|
||||
pline("%s cannot pay you at present.", Shknam(shkp));
|
||||
Sprintf(qbuf, "Will you accept %ld %s in credit for ", tmpcr,
|
||||
currency(tmpcr));
|
||||
@@ -3237,14 +3237,14 @@ sellobj(register struct obj* obj, coordxy x, coordxy y)
|
||||
(obj->quan == 1L) ? "that" : "those"));
|
||||
if (c == 'a') {
|
||||
c = 'y';
|
||||
g.auto_credit = TRUE;
|
||||
ga.auto_credit = TRUE;
|
||||
}
|
||||
} else /* previously specified "quit" */
|
||||
c = 'n';
|
||||
|
||||
if (c == 'y') {
|
||||
shk_names_obj(shkp, obj,
|
||||
((g.sell_how != SELL_NORMAL)
|
||||
((gs.sell_how != SELL_NORMAL)
|
||||
? "traded %s for %ld zorkmid%s in %scredit."
|
||||
: "relinquish %s and acquire %ld zorkmid%s in %scredit."),
|
||||
tmpcr, (eshkp->credit > 0L) ? "additional " : "");
|
||||
@@ -3254,7 +3254,7 @@ sellobj(register struct obj* obj, coordxy x, coordxy y)
|
||||
subfrombill(obj, shkp);
|
||||
} else {
|
||||
if (c == 'q')
|
||||
g.sell_response = 'n';
|
||||
gs.sell_response = 'n';
|
||||
if (container)
|
||||
dropped_container(obj, shkp, FALSE);
|
||||
if (!obj->unpaid)
|
||||
@@ -3267,7 +3267,7 @@ sellobj(register struct obj* obj, coordxy x, coordxy y)
|
||||
|
||||
if (short_funds)
|
||||
offer = shkmoney;
|
||||
if (!g.sell_response) {
|
||||
if (!gs.sell_response) {
|
||||
long yourc = 0L, shksc;
|
||||
|
||||
if (container) {
|
||||
@@ -3333,9 +3333,9 @@ sellobj(register struct obj* obj, coordxy x, coordxy y)
|
||||
} else
|
||||
qbuf[0] = '\0'; /* just to pacify lint */
|
||||
|
||||
switch (g.sell_response ? g.sell_response : nyaq(qbuf)) {
|
||||
switch (gs.sell_response ? gs.sell_response : nyaq(qbuf)) {
|
||||
case 'q':
|
||||
g.sell_response = 'n';
|
||||
gs.sell_response = 'n';
|
||||
/*FALLTHRU*/
|
||||
case 'n':
|
||||
if (container)
|
||||
@@ -3345,7 +3345,7 @@ sellobj(register struct obj* obj, coordxy x, coordxy y)
|
||||
subfrombill(obj, shkp);
|
||||
break;
|
||||
case 'a':
|
||||
g.sell_response = 'y';
|
||||
gs.sell_response = 'y';
|
||||
/*FALLTHRU*/
|
||||
case 'y':
|
||||
if (container)
|
||||
@@ -3355,7 +3355,7 @@ sellobj(register struct obj* obj, coordxy x, coordxy y)
|
||||
subfrombill(obj, shkp);
|
||||
pay(-offer, shkp);
|
||||
shk_names_obj(shkp, obj,
|
||||
(g.sell_how != SELL_NORMAL)
|
||||
(gs.sell_how != SELL_NORMAL)
|
||||
? ((!ltmp && cltmp && only_partially_your_contents)
|
||||
? "sold some items inside %s for %ld gold piece%s.%s"
|
||||
: "sold %s for %ld gold piece%s.%s")
|
||||
@@ -3541,22 +3541,22 @@ add_damage(
|
||||
if (!*shops)
|
||||
return;
|
||||
}
|
||||
for (tmp_dam = g.level.damagelist; tmp_dam; tmp_dam = tmp_dam->next)
|
||||
for (tmp_dam = gl.level.damagelist; tmp_dam; tmp_dam = tmp_dam->next)
|
||||
if (tmp_dam->place.x == x && tmp_dam->place.y == y) {
|
||||
tmp_dam->cost += cost;
|
||||
tmp_dam->when = g.moves; /* needed by pay_for_damage() */
|
||||
tmp_dam->when = gm.moves; /* needed by pay_for_damage() */
|
||||
return;
|
||||
}
|
||||
tmp_dam = (struct damage *) alloc((unsigned) sizeof *tmp_dam);
|
||||
(void) memset((genericptr_t) tmp_dam, 0, sizeof *tmp_dam);
|
||||
tmp_dam->when = g.moves;
|
||||
tmp_dam->when = gm.moves;
|
||||
tmp_dam->place.x = x;
|
||||
tmp_dam->place.y = y;
|
||||
tmp_dam->cost = cost;
|
||||
tmp_dam->typ = levl[x][y].typ;
|
||||
tmp_dam->flags = levl[x][y].flags;
|
||||
tmp_dam->next = g.level.damagelist;
|
||||
g.level.damagelist = tmp_dam;
|
||||
tmp_dam->next = gl.level.damagelist;
|
||||
gl.level.damagelist = tmp_dam;
|
||||
/* If player saw damage, display as a wall forever */
|
||||
if (cansee(x, y))
|
||||
levl[x][y].seenv = SVALL;
|
||||
@@ -3588,7 +3588,7 @@ repairable_damage(struct damage *dam, struct monst *shkp)
|
||||
y = dam->place.y;
|
||||
|
||||
/* too soon to fix it? */
|
||||
if ((g.moves - dam->when) < REPAIR_DELAY)
|
||||
if ((gm.moves - dam->when) < REPAIR_DELAY)
|
||||
return FALSE;
|
||||
/* is it a wall? don't fix if anyone is in the way */
|
||||
if (!IS_ROOM(dam->typ)) {
|
||||
@@ -3616,7 +3616,7 @@ repairable_damage(struct damage *dam, struct monst *shkp)
|
||||
static struct damage *
|
||||
find_damage(struct monst *shkp)
|
||||
{
|
||||
struct damage *dam = g.level.damagelist;
|
||||
struct damage *dam = gl.level.damagelist;
|
||||
|
||||
if (shk_impaired(shkp))
|
||||
return NULL;
|
||||
@@ -3637,10 +3637,10 @@ discard_damage_struct(struct damage *dam)
|
||||
if (!dam)
|
||||
return;
|
||||
|
||||
if (dam == g.level.damagelist) {
|
||||
g.level.damagelist = dam->next;
|
||||
if (dam == gl.level.damagelist) {
|
||||
gl.level.damagelist = dam->next;
|
||||
} else {
|
||||
struct damage *prev = g.level.damagelist;
|
||||
struct damage *prev = gl.level.damagelist;
|
||||
|
||||
while (prev && prev->next != dam)
|
||||
prev = prev->next;
|
||||
@@ -3655,7 +3655,7 @@ discard_damage_struct(struct damage *dam)
|
||||
static void
|
||||
discard_damage_owned_by(struct monst *shkp)
|
||||
{
|
||||
struct damage *dam = g.level.damagelist, *dam2, *prevdam = NULL;
|
||||
struct damage *dam = gl.level.damagelist, *dam2, *prevdam = NULL;
|
||||
|
||||
while (dam) {
|
||||
coordxy x = dam->place.x, y = dam->place.y;
|
||||
@@ -3664,8 +3664,8 @@ discard_damage_owned_by(struct monst *shkp)
|
||||
dam2 = dam->next;
|
||||
if (prevdam)
|
||||
prevdam->next = dam2;
|
||||
if (dam == g.level.damagelist)
|
||||
g.level.damagelist = dam2;
|
||||
if (dam == gl.level.damagelist)
|
||||
gl.level.damagelist = dam2;
|
||||
(void) memset(dam, 0, sizeof(struct damage));
|
||||
free((genericptr_t) dam);
|
||||
dam = dam2;
|
||||
@@ -3719,7 +3719,7 @@ litter_getpos(int *k, coordxy x, coordxy y, struct monst *shkp)
|
||||
|
||||
*k = 0; /* number of adjacent shop spots */
|
||||
|
||||
if (g.level.objects[x][y] && !IS_ROOM(levl[x][y].typ)) {
|
||||
if (gl.level.objects[x][y] && !IS_ROOM(levl[x][y].typ)) {
|
||||
for (i = 0; i < 9; i++) {
|
||||
ix = x + horiz(i);
|
||||
iy = y + vert(i);
|
||||
@@ -3767,7 +3767,7 @@ litter_scatter(
|
||||
unplacebc(); /* pick 'em up */
|
||||
placebc(); /* put 'em down */
|
||||
}
|
||||
while ((otmp = g.level.objects[x][y]) != 0)
|
||||
while ((otmp = gl.level.objects[x][y]) != 0)
|
||||
/* Don't mess w/ boulders -- just merge into wall */
|
||||
if (otmp->otyp == BOULDER || otmp->otyp == ROCK) {
|
||||
obj_extract_self(otmp);
|
||||
@@ -3776,7 +3776,7 @@ litter_scatter(
|
||||
int trylimit = 10;
|
||||
int i = rn2(9), ix, iy;
|
||||
|
||||
/* otmp must be moved otherwise g.level.objects[x][y] will
|
||||
/* otmp must be moved otherwise gl.level.objects[x][y] will
|
||||
never become Null and while-loop won't terminate */
|
||||
do {
|
||||
i = (i + 1) % 9;
|
||||
@@ -3940,7 +3940,7 @@ fix_shop_damage(void)
|
||||
struct damage *damg, *nextdamg;
|
||||
|
||||
/* if this level has no shop damage, there's nothing to do */
|
||||
if (!g.level.damagelist)
|
||||
if (!gl.level.damagelist)
|
||||
return;
|
||||
|
||||
/* go through all shopkeepers on the level */
|
||||
@@ -3952,7 +3952,7 @@ fix_shop_damage(void)
|
||||
/* go through all damage data trying to have this shopkeeper
|
||||
fix it; repair_damage() will only make repairs for damage
|
||||
matching shop controlled by specified shopkeeper */
|
||||
for (damg = g.level.damagelist; damg; damg = nextdamg) {
|
||||
for (damg = gl.level.damagelist; damg; damg = nextdamg) {
|
||||
nextdamg = damg->next;
|
||||
if (repair_damage(shkp, damg, TRUE))
|
||||
discard_damage_struct(damg);
|
||||
@@ -3966,7 +3966,7 @@ fix_shop_damage(void)
|
||||
int
|
||||
shk_move(struct monst *shkp)
|
||||
{
|
||||
coordxy gx, gy, omx, omy;
|
||||
coordxy gtx, gty, omx, omy;
|
||||
int udist;
|
||||
schar appr;
|
||||
struct eshk *eshkp = ESHK(shkp);
|
||||
@@ -3988,22 +3988,22 @@ shk_move(struct monst *shkp)
|
||||
return 0;
|
||||
}
|
||||
if (eshkp->following) {
|
||||
if (strncmp(eshkp->customer, g.plname, PL_NSIZ)) {
|
||||
if (strncmp(eshkp->customer, gp.plname, PL_NSIZ)) {
|
||||
if (!Deaf && !muteshk(shkp))
|
||||
verbalize("%s, %s! I was looking for %s.", Hello(shkp),
|
||||
g.plname, eshkp->customer);
|
||||
gp.plname, eshkp->customer);
|
||||
eshkp->following = 0;
|
||||
return 0;
|
||||
}
|
||||
if (g.moves > g.followmsg + 4) {
|
||||
if (gm.moves > gf.followmsg + 4) {
|
||||
if (!Deaf && !muteshk(shkp))
|
||||
verbalize("%s, %s! Didn't you forget to pay?",
|
||||
Hello(shkp), g.plname);
|
||||
Hello(shkp), gp.plname);
|
||||
else
|
||||
pline("%s holds out %s upturned %s.",
|
||||
Shknam(shkp), noit_mhis(shkp),
|
||||
mbodypart(shkp, HAND));
|
||||
g.followmsg = g.moves;
|
||||
gf.followmsg = gm.moves;
|
||||
if (!rn2(9)) {
|
||||
pline("%s doesn't like customers who don't pay.",
|
||||
Shknam(shkp));
|
||||
@@ -4016,9 +4016,9 @@ shk_move(struct monst *shkp)
|
||||
}
|
||||
|
||||
appr = 1;
|
||||
gx = eshkp->shk.x;
|
||||
gy = eshkp->shk.y;
|
||||
satdoor = (gx == omx && gy == omy);
|
||||
gtx = eshkp->shk.x;
|
||||
gty = eshkp->shk.y;
|
||||
satdoor = (gtx == omx && gty == omy);
|
||||
if (eshkp->following || ((z = holetime()) >= 0 && z * z <= udist)) {
|
||||
/* [This distance check used to apply regardless of
|
||||
whether the shk was following, but that resulted in
|
||||
@@ -4029,17 +4029,17 @@ shk_move(struct monst *shkp)
|
||||
next level once the character fell through the hole.] */
|
||||
if (udist > 4 && eshkp->following && !eshkp->billct)
|
||||
return -1; /* leave it to m_move */
|
||||
gx = u.ux;
|
||||
gy = u.uy;
|
||||
gtx = u.ux;
|
||||
gty = u.uy;
|
||||
} else if (ANGRY(shkp)) {
|
||||
/* Move towards the hero if the shopkeeper can see him. */
|
||||
if (shkp->mcansee && m_canseeu(shkp)) {
|
||||
gx = u.ux;
|
||||
gy = u.uy;
|
||||
gtx = u.ux;
|
||||
gty = u.uy;
|
||||
}
|
||||
avoid = FALSE;
|
||||
} else {
|
||||
#define GDIST(x, y) (dist2(x, y, gx, gy))
|
||||
#define GDIST(x, y) (dist2(x, y, gtx, gty))
|
||||
if (Invis || u.usteed) {
|
||||
avoid = FALSE;
|
||||
} else {
|
||||
@@ -4053,7 +4053,7 @@ shk_move(struct monst *shkp)
|
||||
return 0;
|
||||
avoid = !badinv;
|
||||
} else {
|
||||
avoid = (*u.ushops && distu(gx, gy) > 8);
|
||||
avoid = (*u.ushops && distu(gtx, gty) > 8);
|
||||
badinv = FALSE;
|
||||
}
|
||||
|
||||
@@ -4062,13 +4062,13 @@ shk_move(struct monst *shkp)
|
||||
if (!badinv && !onlineu(omx, omy))
|
||||
return 0;
|
||||
if (satdoor)
|
||||
appr = gx = gy = 0;
|
||||
appr = gtx = gty = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
z = move_special(shkp, inhishop(shkp), appr, uondoor, avoid, omx, omy, gx,
|
||||
gy);
|
||||
z = move_special(shkp, inhishop(shkp), appr, uondoor, avoid, omx, omy,
|
||||
gtx, gty);
|
||||
if (z > 0)
|
||||
after_shk_move(shkp);
|
||||
|
||||
@@ -4174,13 +4174,13 @@ shopdig(register int fall)
|
||||
} else
|
||||
pline("%s %s your backpack!", Shknam(shkp), grabs);
|
||||
|
||||
for (obj = g.invent; obj; obj = obj2) {
|
||||
for (obj = gi.invent; obj; obj = obj2) {
|
||||
obj2 = obj->nobj;
|
||||
if ((obj->owornmask & ~(W_SWAPWEP | W_QUIVER)) != 0
|
||||
|| (obj == uswapwep && u.twoweap)
|
||||
|| (obj->otyp == LEASH && obj->leashmon))
|
||||
continue;
|
||||
if (obj == g.current_wand)
|
||||
if (obj == gc.current_wand)
|
||||
continue;
|
||||
setnotworn(obj);
|
||||
freeinv(obj);
|
||||
@@ -4206,7 +4206,7 @@ makekops(coord* mm)
|
||||
if ((cnt = k_cnt[k]) == 0)
|
||||
break;
|
||||
mndx = k_mndx[k];
|
||||
if (g.mvitals[mndx].mvflags & G_GONE)
|
||||
if (gm.mvitals[mndx].mvflags & G_GONE)
|
||||
continue;
|
||||
|
||||
while (cnt--)
|
||||
@@ -4232,10 +4232,10 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify)
|
||||
nearest_damage = nearest_shk;
|
||||
int picks = 0;
|
||||
|
||||
for (tmp_dam = g.level.damagelist; tmp_dam; tmp_dam = tmp_dam->next) {
|
||||
for (tmp_dam = gl.level.damagelist; tmp_dam; tmp_dam = tmp_dam->next) {
|
||||
char *shp;
|
||||
|
||||
if (tmp_dam->when != g.moves || !tmp_dam->cost)
|
||||
if (tmp_dam->when != gm.moves || !tmp_dam->cost)
|
||||
continue;
|
||||
cost_of_damage += tmp_dam->cost;
|
||||
Strcpy(shops_affected,
|
||||
@@ -4282,7 +4282,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify)
|
||||
y = appear_here->place.y;
|
||||
|
||||
/* not the best introduction to the shk... */
|
||||
(void) strncpy(ESHK(shkp)->customer, g.plname, PL_NSIZ);
|
||||
(void) strncpy(ESHK(shkp)->customer, gp.plname, PL_NSIZ);
|
||||
|
||||
/* if the shk is already on the war path, be sure it's all out */
|
||||
if (ANGRY(shkp) || ESHK(shkp)->following) {
|
||||
@@ -4335,7 +4335,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify)
|
||||
}
|
||||
|
||||
if ((um_dist(x, y, 1) && !uinshp) || cant_mollify
|
||||
|| (money_cnt(g.invent) + ESHK(shkp)->credit) < cost_of_damage
|
||||
|| (money_cnt(gi.invent) + ESHK(shkp)->credit) < cost_of_damage
|
||||
|| !rn2(50)) {
|
||||
getcad:
|
||||
if (muteshk(shkp)) {
|
||||
@@ -4377,7 +4377,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify)
|
||||
cost_of_damage = check_credit(cost_of_damage, shkp);
|
||||
if (cost_of_damage > 0L) {
|
||||
money2mon(shkp, cost_of_damage);
|
||||
g.context.botl = 1;
|
||||
gc.context.botl = 1;
|
||||
}
|
||||
pline("Mollified, %s accepts your restitution.", shkname(shkp));
|
||||
/* move shk back to his home loc */
|
||||
@@ -4415,7 +4415,7 @@ costly_spot(coordxy x, coordxy y)
|
||||
struct monst *shkp;
|
||||
struct eshk *eshkp;
|
||||
|
||||
if (!g.level.flags.has_shop)
|
||||
if (!gl.level.flags.has_shop)
|
||||
return FALSE;
|
||||
shkp = shop_keeper(*in_rooms(x, y, SHOPBASE));
|
||||
if (!shkp || !inhishop(shkp))
|
||||
@@ -4454,7 +4454,7 @@ shop_object(register coordxy x, register coordxy y)
|
||||
if (!(shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) || !inhishop(shkp))
|
||||
return (struct obj *) 0;
|
||||
|
||||
for (otmp = g.level.objects[x][y]; otmp; otmp = otmp->nexthere)
|
||||
for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp->nexthere)
|
||||
if (otmp->oclass != COIN_CLASS)
|
||||
break;
|
||||
/* note: otmp might have ->no_charge set, but that's ok */
|
||||
@@ -4598,15 +4598,15 @@ shk_chat(struct monst* shkp)
|
||||
(!Deaf && !muteshk(shkp)) ? "mentions" : "indicates",
|
||||
noit_mhe(shkp), eshk->robbed ? "non-paying" : "rude");
|
||||
} else if (eshk->following) {
|
||||
if (strncmp(eshk->customer, g.plname, PL_NSIZ)) {
|
||||
if (strncmp(eshk->customer, gp.plname, PL_NSIZ)) {
|
||||
if (!Deaf && !muteshk(shkp))
|
||||
verbalize("%s %s! I was looking for %s.",
|
||||
Hello(shkp), g.plname, eshk->customer);
|
||||
Hello(shkp), gp.plname, eshk->customer);
|
||||
eshk->following = 0;
|
||||
} else {
|
||||
if (!Deaf && !muteshk(shkp))
|
||||
verbalize("%s %s! Didn't you forget to pay?",
|
||||
Hello(shkp), g.plname);
|
||||
Hello(shkp), gp.plname);
|
||||
else
|
||||
pline("%s taps you on the %s.",
|
||||
Shknam(shkp), body_part(ARM));
|
||||
@@ -4950,7 +4950,7 @@ cad(
|
||||
{
|
||||
const char *res = 0;
|
||||
|
||||
switch (is_demon(g.youmonst.data) ? 3 : poly_gender()) {
|
||||
switch (is_demon(gy.youmonst.data) ? 3 : poly_gender()) {
|
||||
case 0:
|
||||
res = "cad";
|
||||
break;
|
||||
@@ -4969,7 +4969,7 @@ cad(
|
||||
break;
|
||||
}
|
||||
if (altusage) {
|
||||
char *cadbuf = mon_nam(&g.youmonst); /* snag an output buffer */
|
||||
char *cadbuf = mon_nam(&gy.youmonst); /* snag an output buffer */
|
||||
|
||||
/* alternate usage adds a leading double quote and trailing
|
||||
exclamation point plus sentence separating spaces */
|
||||
|
||||
Reference in New Issue
Block a user