undo/redo for editing item shortcuts

This commit is contained in:
2025-06-19 17:07:53 -05:00
parent 1db78b4a1b
commit 8d26268e7d
5 changed files with 31 additions and 11 deletions

View File

@@ -649,4 +649,15 @@ std::string cScenario::get_sdf_name(int row, int col) {
if(sdf_names[row].find(col) == sdf_names[row].end())
return "";
return sdf_names[row][col];
}
}
bool cScenario::cItemStorage::operator==(const cScenario::cItemStorage& other) const {
CHECK_EQ(other, ter_type);
CHECK_EQ(other, property);
for(int i = 0; i < 10; ++i){
if(item_num[i] != other.item_num[i]) return false;
if(item_odds[i] != other.item_odds[i]) return false;
}
return true;
}

View File

@@ -87,6 +87,8 @@ public:
short property;
cItemStorage();
cItemStorage& operator = (legacy::item_storage_shortcut_type& old);
bool operator==(const cItemStorage& other) const;
bool operator!=(const cItemStorage& other) { return !(*this == other); }
};
void destroy_terrain();
public: