| 1140 | } |
| 1141 | |
| 1142 | staticfn void |
| 1143 | add_erosion_words(struct obj *obj, char *prefix) |
| 1144 | { |
| 1145 | boolean iscrys = (obj->otyp == CRYSKNIFE); |
| 1146 | boolean rknown; |
| 1147 | |
| 1148 | rknown = (iflags.override_ID == 0) ? obj->rknown : TRUE; |
| 1149 | |
| 1150 | if (!is_damageable(obj) && !iscrys) |
| 1151 | return; |
| 1152 | |
| 1153 | /* The only cases where any of these bits do double duty are for |
| 1154 | * rotted food and diluted potions, which are all not is_damageable(). |
| 1155 | */ |
| 1156 | if (obj->oeroded && !iscrys) { |
| 1157 | switch (obj->oeroded) { |
| 1158 | case 2: |
| 1159 | Strcat(prefix, "very "); |
| 1160 | break; |
| 1161 | case 3: |
| 1162 | Strcat(prefix, "thoroughly "); |
| 1163 | break; |
| 1164 | } |
| 1165 | Strcat(prefix, is_rustprone(obj) ? "rusty " |
| 1166 | : is_crackable(obj) ? "cracked " |
| 1167 | : "burnt "); |
| 1168 | } |
| 1169 | if (obj->oeroded2 && !iscrys) { |
| 1170 | switch (obj->oeroded2) { |
| 1171 | case 2: |
| 1172 | Strcat(prefix, "very "); |
| 1173 | break; |
| 1174 | case 3: |
| 1175 | Strcat(prefix, "thoroughly "); |
| 1176 | break; |
| 1177 | } |
| 1178 | Strcat(prefix, is_corrodeable(obj) ? "corroded " : "rotted "); |
| 1179 | } |
| 1180 | /* note: it is possible for an item to be both eroded and erodeproof |
| 1181 | (cursed scroll of destroy armor read while confused erodeproofs an |
| 1182 | item of armor without repairing existing erosion) */ |
| 1183 | if (rknown && obj->oerodeproof) |
| 1184 | Strcat(prefix, iscrys ? "fixed " |
| 1185 | : is_rustprone(obj) ? "rustproof " |
| 1186 | : is_corrodeable(obj) ? "corrodeproof " |
| 1187 | : is_flammable(obj) ? "fireproof " |
| 1188 | : is_crackable(obj) ? "tempered " /* hardened */ |
| 1189 | : is_rottable(obj) ? "rotproof " |
| 1190 | : ""); |
| 1191 | } |
| 1192 | |
| 1193 | /* used to prevent rust on items where rust makes no difference */ |
| 1194 | boolean |
no test coverage detected