Functions that place a given item in a slot ***/ Proper usage includes: * 1. Initializing the slot during character generation or a * restore. * 2. Setting the slot due to a player's actions. * 3. If one of the objects in the slot is split off, these * functions can be used to put the remainder back in the slot. * 4. Putting an item that was thrown and returned back into the slot
| 97 | * to print the appropriate messages. |
| 98 | */ |
| 99 | void |
| 100 | setuwep(struct obj *obj) |
| 101 | { |
| 102 | struct obj *olduwep = uwep; |
| 103 | |
| 104 | if (obj == uwep) |
| 105 | return; /* necessary to not set gu.unweapon */ |
| 106 | setworn(obj, W_WEP); |
| 107 | /* handle Ogresmasher before Sunsword; even though they can't be happening |
| 108 | at the same time, botl flag update should come before pline message */ |
| 109 | if (uwep == obj |
| 110 | && ((uwep && uwep->oartifact == ART_OGRESMASHER) |
| 111 | || (olduwep && olduwep->oartifact == ART_OGRESMASHER))) |
| 112 | disp.botl = TRUE; /* gaining or losing Con bonus */ |
| 113 | /* This message isn't printed in the caller because it happens |
| 114 | * *whenever* Sunsword is unwielded, from whatever cause. */ |
| 115 | if (uwep == obj && artifact_light(olduwep) && olduwep->lamplit) { |
| 116 | end_burn(olduwep, FALSE); |
| 117 | if (!Blind) |
| 118 | pline("%s shining.", Tobjnam(olduwep, "stop")); |
| 119 | } |
| 120 | if (uwep == obj |
| 121 | && (u_wield_art(ART_OGRESMASHER) |
| 122 | || is_art(olduwep, ART_OGRESMASHER))) |
| 123 | disp.botl = TRUE; |
| 124 | /* Note: Explicitly wielding a pick-axe will not give a "bashing" |
| 125 | * message. Wielding one via 'a'pplying it will. |
| 126 | * 3.2.2: Wielding arbitrary objects will give bashing message too. |
| 127 | */ |
| 128 | if (obj) { |
| 129 | gu.unweapon = (obj->oclass == WEAPON_CLASS) |
| 130 | ? is_launcher(obj) || is_ammo(obj) || is_missile(obj) |
| 131 | || (is_pole(obj) && !u.usteed && !is_art(obj, ART_SNICKERSNEE)) |
| 132 | : !is_weptool(obj) && !is_wet_towel(obj); |
| 133 | } else |
| 134 | gu.unweapon = TRUE; /* for "bare hands" message */ |
| 135 | } |
| 136 | |
| 137 | staticfn boolean |
| 138 | cant_wield_corpse(struct obj *obj) |
no test coverage detected