]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/Resources.cpp
reordered type description creation to avoid reallocation
[l2e.git] / src / battle / Resources.cpp
index a1365d070bd05e25f35f242e488b4e548d1292e3..bd20eb091ab5c5755fce10bd2163e7ad0196f040 100644 (file)
@@ -83,9 +83,6 @@ Resources::Resources()
 
 void Resources::CreateTypeDescription() {
        Resources r;
-       TypeDescription &td(TypeDescription::CreateOrGet("BattleResources"));
-
-       td.SetSize(sizeof(Resources));
 
        int animationId(TypeDescription::GetTypeId("Animation"));
        int colorId(TypeDescription::GetTypeId("Color"));
@@ -97,6 +94,9 @@ void Resources::CreateTypeDescription() {
        int spriteId(TypeDescription::GetTypeId("Sprite"));
        int stringId(TypeDescription::GetTypeId("String"));
 
+       TypeDescription &td(TypeDescription::CreateOrGet("BattleResources"));
+       td.SetSize(sizeof(Resources));
+
        td.AddField("swapCursor", FieldDescription(((char *)&r.swapCursor) - ((char *)&r), spriteId, true));
        td.AddField("moveIcons", FieldDescription(((char *)&r.moveIcons) - ((char *)&r), spriteId, true));
        td.AddField("attackIcons", FieldDescription(((char *)&r.attackIcons) - ((char *)&r), spriteId, true));