Browse Source

Fix reading map obj gfx constants

Marcus Huderle 6 years ago
parent
commit
07fa705b03
1 changed files with 4 additions and 13 deletions
  1. 4
    13
      project.cpp

+ 4
- 13
project.cpp View File

609
 
609
 
610
 QMap<QString, int> Project::getMapObjGfxConstants() {
610
 QMap<QString, int> Project::getMapObjGfxConstants() {
611
     QMap<QString, int> constants;
611
     QMap<QString, int> constants;
612
-    QString text = readTextFile(root + "/constants/map_object_constants.inc");
612
+    QString text = readTextFile(root + "/include/constants/map_objects.h");
613
     if (!text.isNull()) {
613
     if (!text.isNull()) {
614
-        QList<QStringList> *commands = parse(text);
615
-        for (int i = 0; i < commands->length(); i++) {
616
-            QStringList params = commands->value(i);
617
-            QString macro = params.value(0);
618
-            if (macro == ".set") {
619
-                QString constant = params.value(1);
620
-                if (constant.startsWith("MAP_OBJ_GFX_")) {
621
-                    int value = params.value(2).toInt(nullptr, 0);
622
-                    constants.insert(constant, value);
623
-                }
624
-            }
625
-        }
614
+        QStringList mapObjGfxPrefixes;
615
+        mapObjGfxPrefixes << "MAP_OBJ_GFX_";
616
+        constants = readCDefines(text, mapObjGfxPrefixes);
626
     }
617
     }
627
     return constants;
618
     return constants;
628
 }
619
 }