]> git.localhorst.tv Git - l2e.git/blobdiff - src/graphics/Gauge.cpp
switched to static type IDs
[l2e.git] / src / graphics / Gauge.cpp
index d0e891a74b56e345d8d065141bacc8d731ba11c8..6f44173f80f6e811473ce65cbde41005de0e570b 100644 (file)
@@ -7,10 +7,12 @@
 
 #include "Gauge.h"
 
+#include "../loader/Interpreter.h"
 #include "../loader/TypeDescription.h"
 
 using geometry::Vector;
 using loader::FieldDescription;
+using loader::Interpreter;
 using loader::TypeDescription;
 
 namespace graphics {
@@ -86,11 +88,7 @@ void Gauge::Draw(SDL_Surface *dest, const Vector<int> &position, int width, Uint
 void Gauge::CreateTypeDescription() {
        Gauge g;
 
-       int imageId(TypeDescription::GetTypeId("Image"));
-       int numberId(TypeDescription::GetTypeId("Number"));
-       int vectorId(TypeDescription::GetTypeId("Vector"));
-
-       TypeDescription &td(TypeDescription::CreateOrGet("Gauge"));
+       TypeDescription &td(TypeDescription::Create(TYPE_ID, "Gauge"));
        td.SetDescription(
                        "Gauges display a percentage by filling the left part different than the right.\n"
                        "The fill level is only mapped with repeat.\n"
@@ -98,13 +96,13 @@ void Gauge::CreateTypeDescription() {
        td.SetConstructor(&Construct);
        td.SetSize(sizeof(Gauge));
 
-       td.AddField("image", FieldDescription(((char *)&g.surface) - ((char *)&g), imageId).SetReferenced().SetDescription("the underlying graphic from which the gauge parts are cut"));
-       td.AddField("full", FieldDescription(((char *)&g.fullOffset) - ((char *)&g), vectorId).SetDescription("top-left corner of the filled gauge"));
-       td.AddField("empty", FieldDescription(((char *)&g.emptyOffset) - ((char *)&g), vectorId).SetDescription("top-left corner of the empty gauge"));
-       td.AddField("height", FieldDescription(((char *)&g.height) - ((char *)&g), numberId).SetDescription("height of the gauges"));
-       td.AddField("start", FieldDescription(((char *)&g.startWidth) - ((char *)&g), numberId).SetDescription("width of the start part"));
-       td.AddField("repeat", FieldDescription(((char *)&g.repeatWidth) - ((char *)&g), numberId).SetDescription("width of the repeat part"));
-       td.AddField("end", FieldDescription(((char *)&g.endWidth) - ((char *)&g), numberId).SetDescription("width of the end part"));
+       td.AddField("image", FieldDescription(((char *)&g.surface) - ((char *)&g), Interpreter::IMAGE_ID).SetReferenced().SetDescription("the underlying graphic from which the gauge parts are cut"));
+       td.AddField("full", FieldDescription(((char *)&g.fullOffset) - ((char *)&g), Interpreter::VECTOR_ID).SetDescription("top-left corner of the filled gauge"));
+       td.AddField("empty", FieldDescription(((char *)&g.emptyOffset) - ((char *)&g), Interpreter::VECTOR_ID).SetDescription("top-left corner of the empty gauge"));
+       td.AddField("height", FieldDescription(((char *)&g.height) - ((char *)&g), Interpreter::NUMBER_ID).SetDescription("height of the gauges"));
+       td.AddField("start", FieldDescription(((char *)&g.startWidth) - ((char *)&g), Interpreter::NUMBER_ID).SetDescription("width of the start part"));
+       td.AddField("repeat", FieldDescription(((char *)&g.repeatWidth) - ((char *)&g), Interpreter::NUMBER_ID).SetDescription("width of the repeat part"));
+       td.AddField("end", FieldDescription(((char *)&g.endWidth) - ((char *)&g), Interpreter::NUMBER_ID).SetDescription("width of the end part"));
 }
 
 void Gauge::Construct(void *data) {