Routine when dying or quitting with a vault guard around */
| 1202 | |
| 1203 | /* Routine when dying or quitting with a vault guard around */ |
| 1204 | void |
| 1205 | paygd(boolean silently) |
| 1206 | { |
| 1207 | struct monst *grd = findgd(); |
| 1208 | long umoney = money_cnt(gi.invent); |
| 1209 | struct obj *coins, *nextcoins; |
| 1210 | int gdx, gdy; |
| 1211 | char buf[BUFSZ]; |
| 1212 | |
| 1213 | if (!umoney || !grd) |
| 1214 | return; |
| 1215 | |
| 1216 | if (u.uinvault) { |
| 1217 | if (!silently) |
| 1218 | Your("%ld %s goes into the Magic Memory Vault.", |
| 1219 | umoney, currency(umoney)); |
| 1220 | gdx = u.ux; |
| 1221 | gdy = u.uy; |
| 1222 | } else { |
| 1223 | if (grd->mpeaceful) /* peaceful guard has no "right" to your gold */ |
| 1224 | goto remove_guard; |
| 1225 | |
| 1226 | mnexto(grd, RLOC_NOMSG); |
| 1227 | if (!silently) |
| 1228 | pline("%s remits your gold to the vault.", Monnam(grd)); |
| 1229 | gdx = svr.rooms[EGD(grd)->vroom].lx + rn2(2); |
| 1230 | gdy = svr.rooms[EGD(grd)->vroom].ly + rn2(2); |
| 1231 | Sprintf(buf, "To Croesus: here's the gold recovered from %s the %s.", |
| 1232 | svp.plname, |
| 1233 | pmname(&mons[u.umonster], flags.female ? FEMALE : MALE)); |
| 1234 | make_grave(gdx, gdy, buf); |
| 1235 | } |
| 1236 | for (coins = gi.invent; coins; coins = nextcoins) { |
| 1237 | nextcoins = coins->nobj; |
| 1238 | if (objects[coins->otyp].oc_class == COIN_CLASS) { |
| 1239 | freeinv(coins); |
| 1240 | place_object(coins, gdx, gdy); |
| 1241 | stackobj(coins); |
| 1242 | } |
| 1243 | } |
| 1244 | remove_guard: |
| 1245 | mongone(grd); |
| 1246 | return; |
| 1247 | } |
| 1248 | |
| 1249 | /* |
| 1250 | * amount of gold in carried containers |
no test coverage detected