]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/Stats.cpp
reordered type description creation to avoid reallocation
[l2e.git] / src / battle / Stats.cpp
index 7ad7aa7a841e2925091e396bf67605393af7ecf2..cdf321036db0ab7941628371858983a63041fb93 100644 (file)
@@ -39,12 +39,12 @@ Stats::Stats(Uint16 attack, Uint16 defense, Uint16 strength, Uint16 agility, Uin
 
 void Stats::CreateTypeDescription() {
        Stats s;
-       TypeDescription &td(TypeDescription::CreateOrGet("Stats"));
-
-       td.SetSize(sizeof(Stats));
 
        int numberId(TypeDescription::GetTypeId("Number"));
 
+       TypeDescription &td(TypeDescription::CreateOrGet("Stats"));
+       td.SetSize(sizeof(Stats));
+
        td.AddField("atp", FieldDescription(((char *)&s.attack) - ((char *)&s), numberId, false));
        td.AddField("dfp", FieldDescription(((char *)&s.defense) - ((char *)&s), numberId, false));
        td.AddField("str", FieldDescription(((char *)&s.strength) - ((char *)&s), numberId, false));