]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/Interpreter.cpp
new language, new compiler
[l2e.git] / src / loader / Interpreter.cpp
index 3cb0d452a755b4f36b0345912026564e310b395c..1888361c465dd3c75de8f8a0057e68f8025bd0ec 100644 (file)
@@ -385,7 +385,8 @@ void Interpreter::ReadObject(int typeId, int id, char *object, const PropertyLis
                                                }
                                        }
                                }
-                               std::memcpy(dest, &array.data, sizeof(char *));
+                               size_t pLen = sizeof(char *);
+                               std::memcpy(dest, &array.data, pLen);
                                dest += sizeof(char *);
                                std::memcpy(dest, &arraySize, sizeof(int));
                        } else if (i->second->IsLiteral() && !fd.IsReferenced()) {
@@ -624,6 +625,8 @@ void Interpreter::ReadScript(const std::vector<ScriptToken *> &s, Script *script
                                                ReadScriptVector(**i, text + cursor);
                                                cursor += sizeof(Vector<int>);
                                                break;
+                                       default:
+                                               break;
                                }
                        }
                } else if (cmd == "add") {
@@ -670,6 +673,8 @@ void Interpreter::ReadScript(const std::vector<ScriptToken *> &s, Script *script
                                                ReadScriptVector(**i, text + cursor);
                                                cursor += sizeof(Vector<int>);
                                                break;
+                                       default:
+                                               break;
                                }
                        }
                } else if (cmd == "mod") {
@@ -959,16 +964,18 @@ void Interpreter::CreateTypeDescriptions() {
                td.SetDescription("A signed integer.");
                td.SetSize(sizeof(int));
        }
-       {;
+       {
                TypeDescription &td(TypeDescription::Create(PATH_ID, "Path"));
                td.SetDescription("A path in the filesystem which is interpreted relative to the source file's location.");
                td.SetSize(1);
                td.AddSupertype(STRING_ID, 0);
        }
        {
+               Script s;
                TypeDescription &td(TypeDescription::Create(SCRIPT_ID, "Script"));
                td.SetDescription("Collection of commands that define a behaviour.");
                td.SetSize(sizeof(Script));
+               td.AddField("text", FieldDescription(((char *)&s.text) - ((char *)&s), STRING_ID).SetAggregate());
        }
        {
                TypeDescription &td(TypeDescription::Create(STRING_ID, "String"));