1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Large changeset, first part of editing H3 objects via mods feature. Changes:

- loading of all objects (including H3 objects) will be directed by mod handlers
- common base for all handlers accessible from mod system (IHanderBase)
- json format changes: use struct with string ID's instead of vector

- fixed some gcc/clang errors and warnings
- fixed several cases of memory leaks and invalid memory access (mostly related to usage of bonus system and/or identifiers resolution)

Note that right now loading is much slower than before due to excessive json validation (or not fast enough validator)
This commit is contained in:
Ivan Savenko
2013-04-21 12:49:26 +00:00
parent 8a4f81b981
commit c6cc6e6301
85 changed files with 4714 additions and 4441 deletions

View File

@@ -74,50 +74,50 @@
"capitol" : "AVCHFORZ.DEF"
},
"structures" :
[
{ "animation" : "TBELEXT5.def", "x" : 682, "y" : 183, "z" : -1, },
{ "animation" : "TBELEXT1.def", "x" : 23, "y" : 218 },
{ "id" : 0, "animation" : "TBELMAGE.def", "x" : 206, "y" : 58, "z" : 4, "border" : "TOELMAGE.bmp", "area" : "TZELMAGE.bmp" },
{ "id" : 1, "animation" : "TBELMAG2.def", "x" : 206, "y" : 58, "z" : 4, "border" : "TOELMAG2.bmp", "area" : "TZELMAG2.bmp" },
{ "id" : 2, "animation" : "TBELMAG3.def", "x" : 206, "y" : 58, "z" : 4, "border" : "TOELMAG3.bmp", "area" : "TZELMAG3.bmp" },
{ "id" : 3, "animation" : "TBELMAG4.def", "x" : 206, "y" : 58, "z" : 4, "border" : "TOELMAG4.bmp", "area" : "TZELMAG4.bmp" },
{ "id" : 4, "animation" : "TBELMAG5.def", "x" : 206, "y" : 58, "z" : 4, "border" : "TOELMAG5.bmp", "area" : "TZELMAG5.bmp" },
{ "id" : 5, "animation" : "TBELTVRN.def", "x" : 553, "y" : 203, "z" : 1, "border" : "TOELTVRN.bmp", "area" : "TZELTVRN.bmp" },
{ "id" : 6, "animation" : "TBELDOCK.def", "x" : 239, "y" : 215, "z" : 2, "border" : "TOELDOCK.bmp", "area" : "TZELDOCK.bmp" },
{ "id" : 7, "animation" : "TBELCSTL.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCSTL.bmp", "area" : "TZELCSTL.bmp" },
{ "id" : 8, "animation" : "TBELCAS2.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCAS2.bmp", "area" : "TZELCAS2.bmp" },
{ "id" : 9, "animation" : "TBELCAS3.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCAS3.bmp", "area" : "TZELCAS3.bmp" },
{ "id" : 10, "animation" : "TBELHALL.def", "x" : -1, "y" : 164, "z" : 5, "border" : "TOELHALL.bmp", "area" : "TZELHALL.bmp" },
{ "id" : 11, "animation" : "TBELHAL2.def", "x" : 0, "y" : 165, "z" : 5, "border" : "TOELHAL2.bmp", "area" : "TZELHAL2.bmp" },
{ "id" : 12, "animation" : "TBELHAL3.def", "x" : 0, "y" : 165, "z" : 5, "border" : "TOELHAL3.bmp", "area" : "TZELHAL3.bmp" },
{ "id" : 13, "animation" : "TBELHAL4.def", "x" : 0, "y" : 164, "z" : 5, "border" : "TOELHAL4.bmp", "area" : "TZELHAL4.bmp" },
{ "id" : 14, "animation" : "TBELMARK.def", "x" : 347, "y" : 216, "z" : 4, "border" : "TOELMARK.bmp", "area" : "TZELMARK.bmp" },
{ "id" : 15, "animation" : "TBELSILO.def", "x" : 372, "y" : 171, "z" : 2, "border" : "TOELSILO.bmp", "area" : "TZELSILO.bmp" },
{ "id" : 16, "animation" : "TBELBLAK.def", "x" : 449, "y" : 151, "z" : 1, "border" : "TOELBLAK.bmp", "area" : "TZELBLAK.bmp" },
{ "id" : 17, "animation" : "TBELSPEC.def", "x" : 284, "y" : 246, "z" : 4, "border" : "TOELSPEC.bmp", "area" : "TZELSPEC.bmp" },
{ "id" : 18, "animation" : "TBELHRD1.def", "x" : 689, "y" : 250, "border" : "TOELHRD1.bmp", "area" : "TZELHRD1.bmp", "hidden" : true },
{ "id" : 19, "animation" : "TBELHRD2.def", "x" : 689, "y" : 250, "border" : "TOELHRD2.bmp", "area" : "TZELHRD2.bmp", "hidden" : true, "builds" : 18 },
{ "id" : 20, "animation" : "TBELBOAT.def", "x" : 239, "y" : 215, "z" : 2, "border" : "TOELBOAT.bmp", "area" : "TZELBOAT.bmp", "hidden" : true },
{ "id" : 21, "animation" : "TBELEXT6.def", "x" : 104, "y" : 170, "z" : 3, "border" : "TOELEXT6.bmp", "area" : "TZELEXT6.bmp" },
{ "id" : 26, "animation" : "TBELHOLY.def", "x" : 307, "y" : 2, "border" : "TOELHOLY.bmp", "area" : "TZELHOLY.bmp" },
{ "id" : 27, "animation" : "TBELEXT2.def", "x" : 232, "y" : 205 },
{ "id" : 28, "animation" : "TBELEXT3.def", "x" : 516, "y" : 223, "z" : 1 },
{ "id" : 29, "animation" : "TBELEXT4.def", "x" : 0, "y" : 252, "z" : 6 },
{ "id" : 30, "animation" : "TBELDW_0.def", "x" : 689, "y" : 250, "border" : "TOELDW_0.bmp", "area" : "TZELDW_0.bmp" },
{ "id" : 31, "animation" : "TBELDW_1.def", "x" : 630, "y" : 50, "border" : "TOELDW_1.bmp", "area" : "TZELDW_1.bmp" },
{ "id" : 32, "animation" : "TBELDW_2.def", "x" : 709, "y" : 210, "z" : -1, "border" : "TOELDW_2.bmp", "area" : "TZELDW_2.bmp" },
{ "id" : 33, "animation" : "TBELDW_3.def", "x" : 108, "y" : 131, "z" : -1, "border" : "TOELDW_3.bmp", "area" : "TZELDW_3.bmp" },
{ "id" : 34, "animation" : "TBELDW_4.def", "x" : 264, "y" : 168, "z" : -1, "border" : "TOELDW_4.bmp", "area" : "TZELDW_4.bmp" },
{ "id" : 35, "animation" : "TBELDW_5.def", "x" : 394, "y" : 283, "z" : 2, "border" : "TOELDW_5.bmp", "area" : "TZELDW_5.bmp" },
{ "id" : 36, "animation" : "TBELDW_6.def", "x" : 43, "y" : 16, "z" : -2, "border" : "TOELDW_6.bmp", "area" : "TZELDW_6.bmp" },
{ "id" : 37, "animation" : "TBELUP_0.def", "x" : 689, "y" : 250, "border" : "TOELUP_0.bmp", "area" : "TZELUP_0.bmp" },
{ "id" : 38, "animation" : "TBELUP_1.def", "x" : 630, "y" : 50, "border" : "TOELUP_1.bmp", "area" : "TZELUP_1.bmp" },
{ "id" : 39, "animation" : "TBELUP_2.def", "x" : 709, "y" : 210, "z" : -1, "border" : "TOELUP_2.bmp", "area" : "TZELUP_2.bmp" },
{ "id" : 40, "animation" : "TBELUP_3.def", "x" : 108, "y" : 131, "z" : -1, "border" : "TOELUP_3.bmp", "area" : "TZELUP_3.bmp" },
{ "id" : 41, "animation" : "TBELUP_4.def", "x" : 264, "y" : 168, "z" : -1, "border" : "TOELUP_4.bmp", "area" : "TZELUP_4.bmp" },
{ "id" : 42, "animation" : "TBELUP_5.def", "x" : 394, "y" : 283, "z" : 2, "border" : "TOELUP_5.bmp", "area" : "TZELUP_5.bmp" },
{ "id" : 43, "animation" : "TBELUP_6.def", "x" : 43, "y" : 0, "z" : -2, "border" : "TOELUP_6.bmp", "area" : "TZELUP_6.bmp" },
],
{
"extraAnimation2":{ "animation" : "TBELEXT5.def", "x" : 682, "y" : 183, "z" : -1, },
"extraAnimation": { "animation" : "TBELEXT1.def", "x" : 23, "y" : 218 },
"mageGuild1": { "id" : 0, "animation" : "TBELMAGE.def", "x" : 206, "y" : 58, "z" : 4, "border" : "TOELMAGE.bmp", "area" : "TZELMAGE.bmp" },
"mageGuild2": { "id" : 1, "animation" : "TBELMAG2.def", "x" : 206, "y" : 58, "z" : 4, "border" : "TOELMAG2.bmp", "area" : "TZELMAG2.bmp" },
"mageGuild3": { "id" : 2, "animation" : "TBELMAG3.def", "x" : 206, "y" : 58, "z" : 4, "border" : "TOELMAG3.bmp", "area" : "TZELMAG3.bmp" },
"mageGuild4": { "id" : 3, "animation" : "TBELMAG4.def", "x" : 206, "y" : 58, "z" : 4, "border" : "TOELMAG4.bmp", "area" : "TZELMAG4.bmp" },
"mageGuild5": { "id" : 4, "animation" : "TBELMAG5.def", "x" : 206, "y" : 58, "z" : 4, "border" : "TOELMAG5.bmp", "area" : "TZELMAG5.bmp" },
"tavern": { "id" : 5, "animation" : "TBELTVRN.def", "x" : 553, "y" : 203, "z" : 1, "border" : "TOELTVRN.bmp", "area" : "TZELTVRN.bmp" },
"shipyard": { "id" : 6, "animation" : "TBELDOCK.def", "x" : 239, "y" : 215, "z" : 2, "border" : "TOELDOCK.bmp", "area" : "TZELDOCK.bmp" },
"fort": { "id" : 7, "animation" : "TBELCSTL.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCSTL.bmp", "area" : "TZELCSTL.bmp" },
"citadel": { "id" : 8, "animation" : "TBELCAS2.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCAS2.bmp", "area" : "TZELCAS2.bmp" },
"castle": { "id" : 9, "animation" : "TBELCAS3.def", "x" : 349, "y" : 101, "z" : -1, "border" : "TOELCAS3.bmp", "area" : "TZELCAS3.bmp" },
"villageHall": { "id" : 10, "animation" : "TBELHALL.def", "x" : -1, "y" : 164, "z" : 5, "border" : "TOELHALL.bmp", "area" : "TZELHALL.bmp" },
"townHall": { "id" : 11, "animation" : "TBELHAL2.def", "x" : 0, "y" : 165, "z" : 5, "border" : "TOELHAL2.bmp", "area" : "TZELHAL2.bmp" },
"cityHall": { "id" : 12, "animation" : "TBELHAL3.def", "x" : 0, "y" : 165, "z" : 5, "border" : "TOELHAL3.bmp", "area" : "TZELHAL3.bmp" },
"capitol": { "id" : 13, "animation" : "TBELHAL4.def", "x" : 0, "y" : 164, "z" : 5, "border" : "TOELHAL4.bmp", "area" : "TZELHAL4.bmp" },
"marketplace": { "id" : 14, "animation" : "TBELMARK.def", "x" : 347, "y" : 216, "z" : 4, "border" : "TOELMARK.bmp", "area" : "TZELMARK.bmp" },
"resourceSilo": { "id" : 15, "animation" : "TBELSILO.def", "x" : 372, "y" : 171, "z" : 2, "border" : "TOELSILO.bmp", "area" : "TZELSILO.bmp" },
"blacksmith": { "id" : 16, "animation" : "TBELBLAK.def", "x" : 449, "y" : 151, "z" : 1, "border" : "TOELBLAK.bmp", "area" : "TZELBLAK.bmp" },
"special1": { "id" : 17, "animation" : "TBELSPEC.def", "x" : 284, "y" : 246, "z" : 4, "border" : "TOELSPEC.bmp", "area" : "TZELSPEC.bmp" },
"horde1": { "id" : 18, "animation" : "TBELHRD1.def", "x" : 689, "y" : 250, "border" : "TOELHRD1.bmp", "area" : "TZELHRD1.bmp", "hidden" : true },
"horde1Upgr": { "id" : 19, "animation" : "TBELHRD2.def", "x" : 689, "y" : 250, "border" : "TOELHRD2.bmp", "area" : "TZELHRD2.bmp", "hidden" : true, "builds" : 18 },
"ship": { "id" : 20, "animation" : "TBELBOAT.def", "x" : 239, "y" : 215, "z" : 2, "border" : "TOELBOAT.bmp", "area" : "TZELBOAT.bmp", "hidden" : true },
"special2": { "id" : 21, "animation" : "TBELEXT6.def", "x" : 104, "y" : 170, "z" : 3, "border" : "TOELEXT6.bmp", "area" : "TZELEXT6.bmp" },
"grail": { "id" : 26, "animation" : "TBELHOLY.def", "x" : 307, "y" : 2, "border" : "TOELHOLY.bmp", "area" : "TZELHOLY.bmp" },
"extraTownHall": { "id" : 27, "animation" : "TBELEXT2.def", "x" : 232, "y" : 205 },
"extraCityHall": { "id" : 28, "animation" : "TBELEXT3.def", "x" : 516, "y" : 223, "z" : 1 },
"extraCapitol": { "id" : 29, "animation" : "TBELEXT4.def", "x" : 0, "y" : 252, "z" : 6 },
"dwellingLvl1": { "id" : 30, "animation" : "TBELDW_0.def", "x" : 689, "y" : 250, "border" : "TOELDW_0.bmp", "area" : "TZELDW_0.bmp" },
"dwellingLvl2": { "id" : 31, "animation" : "TBELDW_1.def", "x" : 630, "y" : 50, "border" : "TOELDW_1.bmp", "area" : "TZELDW_1.bmp" },
"dwellingLvl3": { "id" : 32, "animation" : "TBELDW_2.def", "x" : 709, "y" : 210, "z" : -1, "border" : "TOELDW_2.bmp", "area" : "TZELDW_2.bmp" },
"dwellingLvl4": { "id" : 33, "animation" : "TBELDW_3.def", "x" : 108, "y" : 131, "z" : -1, "border" : "TOELDW_3.bmp", "area" : "TZELDW_3.bmp" },
"dwellingLvl5": { "id" : 34, "animation" : "TBELDW_4.def", "x" : 264, "y" : 168, "z" : -1, "border" : "TOELDW_4.bmp", "area" : "TZELDW_4.bmp" },
"dwellingLvl6": { "id" : 35, "animation" : "TBELDW_5.def", "x" : 394, "y" : 283, "z" : 2, "border" : "TOELDW_5.bmp", "area" : "TZELDW_5.bmp" },
"dwellingLvl7": { "id" : 36, "animation" : "TBELDW_6.def", "x" : 43, "y" : 16, "z" : -2, "border" : "TOELDW_6.bmp", "area" : "TZELDW_6.bmp" },
"dwellingUpLvl1": { "id" : 37, "animation" : "TBELUP_0.def", "x" : 689, "y" : 250, "border" : "TOELUP_0.bmp", "area" : "TZELUP_0.bmp" },
"dwellingUpLvl2": { "id" : 38, "animation" : "TBELUP_1.def", "x" : 630, "y" : 50, "border" : "TOELUP_1.bmp", "area" : "TZELUP_1.bmp" },
"dwellingUpLvl3": { "id" : 39, "animation" : "TBELUP_2.def", "x" : 709, "y" : 210, "z" : -1, "border" : "TOELUP_2.bmp", "area" : "TZELUP_2.bmp" },
"dwellingUpLvl4": { "id" : 40, "animation" : "TBELUP_3.def", "x" : 108, "y" : 131, "z" : -1, "border" : "TOELUP_3.bmp", "area" : "TZELUP_3.bmp" },
"dwellingUpLvl5": { "id" : 41, "animation" : "TBELUP_4.def", "x" : 264, "y" : 168, "z" : -1, "border" : "TOELUP_4.bmp", "area" : "TZELUP_4.bmp" },
"dwellingUpLvl6": { "id" : 42, "animation" : "TBELUP_5.def", "x" : 394, "y" : 283, "z" : 2, "border" : "TOELUP_5.bmp", "area" : "TZELUP_5.bmp" },
"dwellingUpLvl7": { "id" : 43, "animation" : "TBELUP_6.def", "x" : 43, "y" : 0, "z" : -2, "border" : "TOELUP_6.bmp", "area" : "TZELUP_6.bmp" }
},
"icons" :
{
"village" : {"normal" : 34, "built" : 35 },
@@ -154,48 +154,53 @@
"moatDamage" : 70,
"buildings" :
[
{ "id" : 0 },
{ "id" : 1, "upgrades" : 0 },
{ "id" : 2, "upgrades" : 1 },
{ "id" : 3, "upgrades" : 2 },
{ "id" : 4, "upgrades" : 3 },
{ "id" : 5 },
{ "id" : 6 },
{ "id" : 7 },
{ "id" : 8, "upgrades" : 7 },
{ "id" : 9, "upgrades" : 8 },
{ "id" : 10, "mode" : "auto" },
{ "id" : 11, "upgrades" : 10, "requires" : [ 5 ] },
{ "id" : 12, "upgrades" : 11, "requires" : [ 0, 14, 16 ] },
{ "id" : 13, "upgrades" : 12, "requires" : [ 9 ] },
{ "id" : 14 },
{ "id" : 15, "requires" : [ 14 ] },
{ "id" : 16 },
{ "id" : 17, "requires" : [ 14 ] },
{ "id" : 18, "upgrades" : 30 },
{ "id" : 19, "upgrades" : 37, "requires" : [ 18 ], "mode" : "auto" },
{ "id" : 20, "upgrades" : 6 },
{ "id" : 21, "requires" : [ 0 ] },
{ "id" : 26, "mode" : "grail"},
{ "id" : 27, "requires" : [ 11 ], "mode" : "auto" },
{ "id" : 28, "requires" : [ 12 ], "mode" : "auto" },
{ "id" : 29, "requires" : [ 13 ], "mode" : "auto" },
{ "id" : 30, "requires" : [ 7 ] },
{ "id" : 31, "requires" : [ 30, 0 ] },
{ "id" : 32, "requires" : [ 30, 0 ] },
{ "id" : 33, "requires" : [ 31 ] },
{ "id" : 34, "requires" : [ 32 ] },
{ "id" : 35, "requires" : [ 33, 34 ] },
{ "id" : 36, "requires" : [ 35 ] },
{ "id" : 37, "upgrades" : 30 },
{ "id" : 38, "upgrades" : 31 },
{ "id" : 39, "upgrades" : 32 },
{ "id" : 40, "upgrades" : 33, "requires" : [ 31 ] },
{ "id" : 41, "upgrades" : 34 },
{ "id" : 42, "upgrades" : 35, "requires" : [ 1 ] },
{ "id" : 43, "upgrades" : 36 }
],
{
"mageGuild1": { "id" : 0 },
"mageGuild2": { "id" : 1, "upgrades" : 0 },
"mageGuild3": { "id" : 2, "upgrades" : 1 },
"mageGuild4": { "id" : 3, "upgrades" : 2 },
"mageGuild5": { "id" : 4, "upgrades" : 3 },
"tavern": { "id" : 5 },
"shipyard": { "id" : 6 },
"fort": { "id" : 7 },
"citadel": { "id" : 8, "upgrades" : 7 },
"castle": { "id" : 9, "upgrades" : 8 },
"villageHall": { "id" : 10, "mode" : "auto" },
"townHall": { "id" : 11, "upgrades" : 10, "requires" : [ 5 ] },
"cityHall": { "id" : 12, "upgrades" : 11, "requires" : [ 0, 14, 16 ] },
"capitol": { "id" : 13, "upgrades" : 12, "requires" : [ 9 ] },
"marketplace": { "id" : 14 },
"resourceSilo": { "id" : 15, "requires" : [ 14 ] },
"blacksmith": { "id" : 16 },
"special1": { "id" : 17, "requires" : [ 14 ] },
"horde1": { "id" : 18, "upgrades" : 30 },
"horde1Upgr": { "id" : 19, "upgrades" : 37, "requires" : [ 18 ], "mode" : "auto" },
"ship": { "id" : 20, "upgrades" : 6 },
"special2": { "id" : 21, "requires" : [ 0 ] },
"grail": { "id" : 26, "mode" : "grail"},
"extraTownHall": { "id" : 27, "requires" : [ 11 ], "mode" : "auto" },
"extraCityHall": { "id" : 28, "requires" : [ 12 ], "mode" : "auto" },
"extraCapitol": { "id" : 29, "requires" : [ 13 ], "mode" : "auto" },
"dwellingLvl1": { "id" : 30, "requires" : [ 7 ] },
"dwellingLvl2": { "id" : 31, "requires" : [ 30, 0 ] },
"dwellingLvl3": { "id" : 32, "requires" : [ 30, 0 ] },
"dwellingLvl4": { "id" : 33, "requires" : [ 31 ] },
"dwellingLvl5": { "id" : 34, "requires" : [ 32 ] },
"dwellingLvl6": { "id" : 35, "requires" : [ 33, 34 ] },
"dwellingLvl7": { "id" : 36, "requires" : [ 35 ] },
"dwellingUpLvl1": { "id" : 37, "upgrades" : 30 },
"dwellingUpLvl2": { "id" : 38, "upgrades" : 31 },
"dwellingUpLvl3": { "id" : 39, "upgrades" : 32 },
"dwellingUpLvl4": { "id" : 40, "upgrades" : 33, "requires" : [ 31 ] },
"dwellingUpLvl5": { "id" : 41, "upgrades" : 34 },
"dwellingUpLvl6": { "id" : 42, "upgrades" : 35, "requires" : [ 1 ] },
"dwellingUpLvl7": { "id" : 43, "upgrades" : 36 },
"horde2" : null,
"horde2Upgr" : null,
"special3" : null,
"special4" : null
},
"siege" :
{