| 1270 | } |
| 1271 | |
| 1272 | void CObjectDialog::OnObjpadDeleteAll() { |
| 1273 | if (Cur_object_index == -1) |
| 1274 | return; |
| 1275 | |
| 1276 | object *objp = &Objects[Cur_object_index]; |
| 1277 | |
| 1278 | if (objp->type == OBJ_PLAYER) { |
| 1279 | OutrageMessageBox("You cannot use this function on player objects."); |
| 1280 | return; |
| 1281 | } |
| 1282 | |
| 1283 | int type = objp->type, id = objp->id; |
| 1284 | |
| 1285 | if (type == OBJ_DOOR) { |
| 1286 | if (OutrageMessageBox(MBOX_YESNO, |
| 1287 | "It's very, very bad to delete a door object. Are you sure you want to delete all instances " |
| 1288 | "of the \"%s\" door?", |
| 1289 | Doors[id].name) != IDYES) |
| 1290 | return; |
| 1291 | } else { // Not a door |
| 1292 | char *objid_name; |
| 1293 | if (IS_GENERIC(type)) |
| 1294 | objid_name = Object_info[id].name; |
| 1295 | else |
| 1296 | objid_name = "<unknown>"; |
| 1297 | if (OutrageMessageBox(MBOX_YESNO, "Are you sure you want to delete all %s objects of type \"%s\" in the mine?", |
| 1298 | Object_type_names[type], objid_name) != IDYES) |
| 1299 | return; |
| 1300 | } |
| 1301 | |
| 1302 | int count = 0; |
| 1303 | for (int objnum = 0; objnum <= Highest_object_index; objnum++) { |
| 1304 | if ((Objects[objnum].type == type) && (Objects[objnum].id == id)) { |
| 1305 | ObjDelete(objnum); |
| 1306 | count++; |
| 1307 | } |
| 1308 | } |
| 1309 | |
| 1310 | EditorStatus("%d objects deleted.", count); |
| 1311 | World_changed = 1; |
| 1312 | } |
nothing calls this directly
no test coverage detected