initial inventory: wear, wield, learn the spell/obj */
| 1251 | |
| 1252 | /* initial inventory: wear, wield, learn the spell/obj */ |
| 1253 | staticfn void |
| 1254 | ini_inv_use_obj(struct obj *obj) |
| 1255 | { |
| 1256 | /* Make the type known if necessary */ |
| 1257 | if (OBJ_DESCR(objects[obj->otyp]) && obj->known) |
| 1258 | discover_object(obj->otyp, TRUE, TRUE, FALSE); |
| 1259 | if (obj->otyp == OIL_LAMP) |
| 1260 | discover_object(POT_OIL, TRUE, TRUE, FALSE); |
| 1261 | |
| 1262 | if (obj->oclass == ARMOR_CLASS) { |
| 1263 | if (is_shield(obj) && !uarms && !(uwep && bimanual(uwep))) { |
| 1264 | /* Prior to 3.6.2 this used to unset uswapwep if it was set, |
| 1265 | but wearing a shield doesn't prevent having an alternate |
| 1266 | weapon ready to swap with the primary; just make sure we |
| 1267 | aren't two-weaponing (academic; no one starts that way) */ |
| 1268 | set_twoweap(FALSE); /* u.twoweap = FALSE */ |
| 1269 | setworn(obj, W_ARMS); |
| 1270 | } else if (is_helmet(obj) && !uarmh) |
| 1271 | setworn(obj, W_ARMH); |
| 1272 | else if (is_gloves(obj) && !uarmg) |
| 1273 | setworn(obj, W_ARMG); |
| 1274 | else if (is_shirt(obj) && !uarmu) |
| 1275 | setworn(obj, W_ARMU); |
| 1276 | else if (is_cloak(obj) && !uarmc) |
| 1277 | setworn(obj, W_ARMC); |
| 1278 | else if (is_boots(obj) && !uarmf) |
| 1279 | setworn(obj, W_ARMF); |
| 1280 | else if (is_suit(obj) && !uarm) |
| 1281 | setworn(obj, W_ARM); |
| 1282 | } |
| 1283 | |
| 1284 | if (obj->oclass == WEAPON_CLASS || is_weptool(obj) |
| 1285 | || obj->otyp == TIN_OPENER |
| 1286 | || obj->otyp == FLINT || obj->otyp == ROCK) { |
| 1287 | if (is_ammo(obj) || is_missile(obj)) { |
| 1288 | if (!uquiver) |
| 1289 | setuqwep(obj); |
| 1290 | } else if (!uwep && (!uarms || !bimanual(obj))) { |
| 1291 | setuwep(obj); |
| 1292 | } else if (!uswapwep) { |
| 1293 | setuswapwep(obj); |
| 1294 | } |
| 1295 | } |
| 1296 | if (obj->oclass == SPBOOK_CLASS && obj->otyp != SPE_BLANK_PAPER) |
| 1297 | initialspell(obj); |
| 1298 | } |
| 1299 | |
| 1300 | staticfn void |
| 1301 | ini_inv(const struct trobj *trop) |
no test coverage detected