diff --git a/include/ent.h b/include/ent.h index 4a8b8c5..2946875 100644 --- a/include/ent.h +++ b/include/ent.h @@ -74,7 +74,7 @@ struct MapEntities { // adds an entity to list (puts worldspawn at the beginning) void add_ent(Ent& addent); // finds all entities in list matching all stored replaceents and replaces with a withent - void replace_ents(EntList replace_entlist, Ent& withent); + void replace_ents(EntList& replace_entlist, Ent& withent); // replaces all applicable keyvals on an ent static void replace_ent(Ent& replaceent, Ent& withent); diff --git a/include/version.h b/include/version.h index bfd7be9..a218ce6 100644 --- a/include/version.h +++ b/include/version.h @@ -17,7 +17,7 @@ Created By: #define STRIPPER_QMM_VERSION_MAJOR 2 #define STRIPPER_QMM_VERSION_MINOR 4 -#define STRIPPER_QMM_VERSION_REV 2 +#define STRIPPER_QMM_VERSION_REV 3 #define STRIPPER_QMM_VERSION STRINGIFY(STRIPPER_QMM_VERSION_MAJOR) "." STRINGIFY(STRIPPER_QMM_VERSION_MINOR) "." STRINGIFY(STRIPPER_QMM_VERSION_REV) diff --git a/src/ent.cpp b/src/ent.cpp index f8e10d8..906e546 100644 --- a/src/ent.cpp +++ b/src/ent.cpp @@ -193,6 +193,7 @@ void MapEntities::apply_config(std::string file) { // with mode, don't accept empty entity else if (mode == mode_with && !ent.keyvals.empty()) { replace_ents(replace_entlist, ent); + replace_entlist.clear(); } } // it's a key/val pair line or something else @@ -339,7 +340,7 @@ void MapEntities::add_ent(Ent& addent) { // finds all entities in list matching all stored replaceents and replaces with a withent -void MapEntities::replace_ents(EntList replace_entlist, Ent& withent) { +void MapEntities::replace_ents(EntList& replace_entlist, Ent& withent) { // go through all replaceents for (auto& repent : replace_entlist) { // find any matching ents in given list @@ -378,11 +379,11 @@ TokenList MapEntities::tokenlist_from_entstring(EntString entstring) { // skip whitespace outside strings else if (std::isspace(c) && !buildstr) continue; - // handle opening braces - else if (c == '{') + // handle opening braces outside strings + else if (c == '{' && !buildstr) tokenlist.push_back("{"); - // handle closing braces - else if (c == '}') + // handle closing braces outside strings + else if (c == '}' && !buildstr) tokenlist.push_back("}"); // handle quote, start of a key or value else if (c == '"' && !buildstr) {