undo/redo for drawing/erasing fields

This commit is contained in:
2025-06-14 19:13:03 -05:00
parent 1f9daccf2d
commit eab83c2112
6 changed files with 167 additions and 17 deletions

View File

@@ -353,15 +353,29 @@ cEnumLookup field_names = {
"explored", "wall-force", "wall-fire", "field-antimagic", "cloud-stink", "wall-ice", "wall-blades", "cloud-sleep",
"obj-block", "spec-spot", "field-web", "obj-crate", "obj-barrel", "barr-fire", "barr-force", "field-quickfire",
"sfx-sm-bld", "sfx-med-bld", "sfx-lg-bld", "sfx-sm-slm", "sfx-lg-slm", "sfx-ash", "sfx-bone", "sfx-rock",
"barr-cage", "", "", "", "", "", "", "",
"barr-cage", "spec-road", "", "", "", "", "", "",
"dispel", "smash",
};
// Field names that can be printed in the editor
cEnumLookup field_names_editor = {
"", "", "", "", "", "", "", "",
"Block", "Special Spot", "Web", "Crate", "Barrel", "Fire Barrier", "Force Barrier", "Quickfire",
"Small Blood", "Medium Blood", "Large Blood", "Small Slime", "Large Slime", "Ash", "Bones", "Rocks",
"", "Road", "", "", "", "", "", "",
"", "",
};
std::ostream& operator << (std::ostream& out, eFieldType e) {
writeEnum(out, e, field_names, "dispel");
return out;
}
std::string get_editor_field_name(eFieldType e){
std::ostringstream sstr;
writeEnum(sstr, e, field_names_editor);
return sstr.str();
}
std::istream& operator >> (std::istream& in, eFieldType& e) {
if(!readEnum(in, e, field_names, FIELD_DISPEL))
in.setstate(std::ios::failbit);