X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FParsedSource.cpp;h=e1a1d0aa030e3100e0a831205407e611443fb4aa;hb=cddc8a96cce6117dac14248455ac70d332a4a9f8;hp=c0d3a411782fea5e840b97720b2222c8d120a416;hpb=d5959073b2c413ba1bd6f3d14bc8bcf59304e488;p=l2e.git diff --git a/src/loader/ParsedSource.cpp b/src/loader/ParsedSource.cpp index c0d3a41..e1a1d0a 100644 --- a/src/loader/ParsedSource.cpp +++ b/src/loader/ParsedSource.cpp @@ -191,11 +191,14 @@ Literal::Literal(const vector &v) , i3(0), i4(0) , b(false) , type(ARRAY_VALUES) { - + if (!v.empty()) { + typeName = v.front()->GetLiteral().GetTypeName(); + } } -Literal::Literal(const std::vector &pls) +Literal::Literal(const string &typeName, const vector &pls) : props(0) +, typeName(typeName) , propertyLists(pls) , i1(0), i2(0) , i3(0), i4(0) @@ -206,6 +209,7 @@ Literal::Literal(const std::vector &pls) Literal::Literal(bool b) : props(0) +, typeName("Boolean") , i1(0), i2(0) , i3(0), i4(0) , b(b) @@ -215,6 +219,7 @@ Literal::Literal(bool b) Literal::Literal(int r, int g, int b, int a) : props(0) +, typeName("Color") , i1(r), i2(g) , i3(b), i4(a) , b(false) @@ -224,6 +229,7 @@ Literal::Literal(int r, int g, int b, int a) Literal::Literal(int number) : props(0) +, typeName("Number") , i1(number), i2(0) , i3(0), i4(0) , b(false) @@ -233,6 +239,7 @@ Literal::Literal(int number) Literal::Literal(const string &dir, const string &path) : props(0) +, typeName("Path") , str(CatPath(dir, path)) , i1(0), i2(0) , i3(0), i4(0) @@ -243,6 +250,7 @@ Literal::Literal(const string &dir, const string &path) Literal::Literal(const string &str) : props(0) +, typeName("String") , str(str) , i1(0), i2(0) , i3(0), i4(0) @@ -253,6 +261,7 @@ Literal::Literal(const string &str) Literal::Literal(int x, int y) : props(0) +, typeName("Vector") , i1(x), i2(y) , i3(0), i4(0) , b(false) @@ -262,7 +271,7 @@ Literal::Literal(int x, int y) Literal::Literal(const string &typeName, PropertyList *properties) : props(properties) -, str(typeName) +, typeName(typeName) , i1(0), i2(0) , i3(0), i4(0) , b(false) @@ -380,11 +389,7 @@ int Literal::GetY() const { } const string &Literal::GetTypeName() const { - if (type == OBJECT) { - return str; - } else { - throw runtime_error("tried to access type name of non-object literal"); - } + return typeName; } const PropertyList *Literal::GetProperties() const {