undo/redo edit placed item

This commit is contained in:
2025-06-11 20:19:15 -05:00
parent 161dce6d25
commit 8eec250cd5
5 changed files with 46 additions and 3 deletions

View File

@@ -276,4 +276,15 @@ bool cTown::any_preset_items() const {
if(item.code >= 0) return true;
}
return false;
}
bool cTown::cItem::operator==(const cTown::cItem& other) {
CHECK_EQ(other, loc);
CHECK_EQ(other, code);
CHECK_EQ(other, ability);
CHECK_EQ(other, charges);
CHECK_EQ(other, always_there);
CHECK_EQ(other, property);
CHECK_EQ(other, contained);
return true;
}

View File

@@ -59,6 +59,9 @@ public:
eEnchant ability;
int charges = -1;
bool always_there = false, property = false, contained = false;
// For detecting actual changes to town items in the editor
bool operator==(const cItem& other);
bool operator!=(const cItem& other) { return !(*this == other); }
void import_legacy(legacy::preset_item_type old);
cItem();