From 05d8fad3142dee2546dfab78028f13e725919268 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sat, 9 Aug 2014 12:31:43 +0300 Subject: [PATCH] Miscellaneous fixes to banks: - fixed evaluation of bank thread by AI (1850) - fixed crash on evaluating bank threat after loading from save (1830) - fixed typo in bank config. TODO: schema? --- config/objects/creatureBanks.json | 24 ++++++++++++------------ lib/mapObjects/CommonConstructors.cpp | 1 + lib/mapObjects/CommonConstructors.h | 6 ++++++ lib/mapObjects/JsonRandom.cpp | 1 + 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/config/objects/creatureBanks.json b/config/objects/creatureBanks.json index 665e06fd3..27270927e 100644 --- a/config/objects/creatureBanks.json +++ b/config/objects/creatureBanks.json @@ -110,7 +110,7 @@ }, "dwarvenTreasury" : { "index" : 1, - "resetDuraition" : 28, + "resetDuration" : 28, "name" : "Dwarven Treasury", "rmg" : { "value" : 2000, @@ -197,7 +197,7 @@ }, "griffinConservatory" : { "index" : 2, - "resetDuraition" : 28, + "resetDuration" : 28, "name" : "Griffin Conservatory", "rmg" : { "value" : 2000, @@ -268,7 +268,7 @@ }, "inpCache" : { "index" : 3, - "resetDuraition" : 28, + "resetDuration" : 28, "name" : "Imp Cache", "rmg" : { "value" : 5000, @@ -354,7 +354,7 @@ }, "medusaStore" : { "index" : 4, - "resetDuraition" : 28, + "resetDuration" : 28, "name" : "Medusa Stores", "rmg" : { "value" : 1500, @@ -441,7 +441,7 @@ }, "nagaBank" : { "index" : 5, - "resetDuraition" : 28, + "resetDuration" : 28, "name" : "Naga Bank", "rmg" : { "value" : 3000, @@ -528,7 +528,7 @@ }, "dragonflyHive" : { "index" : 6, - "resetDuraition" : 28, + "resetDuration" : 28, "name" : "Dragon Fly Hive", "rmg" : { "value" : 9000, @@ -605,7 +605,7 @@ "types" : { "shipwreck" : { "index" : 0, - "resetDuraition" : 28, + "resetDuration" : 28, "name" : "Shipwreck", "rmg" : { "value" : 2000, @@ -696,7 +696,7 @@ "types" : { "derelictShip" : { "index" : 0, - "resetDuraition" : 28, + "resetDuration" : 28, "name" : "Derelict Ship", "rmg" : { "value" : 4000, @@ -788,7 +788,7 @@ "types" : { "crypt" : { "index" : 0, - "resetDuraition" : 28, + "resetDuration" : 28, "name" : "Crypt", "rmg" : { "value" : 1000, @@ -877,7 +877,7 @@ "types" : { "dragonUtopia" : { "index" : 0, - "resetDuraition" : 28, + "resetDuration" : 28, "name" : "Dragon Utopia", "rmg" : { "value" : 10000, @@ -986,7 +986,7 @@ "types" : { "pyramid" : { "index" : 0, - "resetDuraition" : 28, + "resetDuration" : 28, "name" : "Pyramid", "rmg" : { "value" : 5000, @@ -1011,4 +1011,4 @@ } } } -} \ No newline at end of file +} diff --git a/lib/mapObjects/CommonConstructors.cpp b/lib/mapObjects/CommonConstructors.cpp index 3241abb56..b0064f573 100644 --- a/lib/mapObjects/CommonConstructors.cpp +++ b/lib/mapObjects/CommonConstructors.cpp @@ -303,6 +303,7 @@ void CBankInstanceConstructor::configureObject(CGObjectInstance * object, CRando CBankInfo::CBankInfo(JsonVector config): config(config) { + assert(!config.empty()); } static void addStackToArmy(IObjectInfo::CArmyStructure & army, const CCreature * crea, si32 amount) diff --git a/lib/mapObjects/CommonConstructors.h b/lib/mapObjects/CommonConstructors.h index 5853c2062..e4f44bd05 100644 --- a/lib/mapObjects/CommonConstructors.h +++ b/lib/mapObjects/CommonConstructors.h @@ -184,4 +184,10 @@ public: void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const; std::unique_ptr getObjectInfo(ObjectTemplate tmpl) const; + + template void serialize(Handler &h, const int version) + { + h & levels & bankResetDuration; + h & static_cast&>(*this); + } }; diff --git a/lib/mapObjects/JsonRandom.cpp b/lib/mapObjects/JsonRandom.cpp index d27d06d5f..be28ce5e2 100644 --- a/lib/mapObjects/JsonRandom.cpp +++ b/lib/mapObjects/JsonRandom.cpp @@ -202,6 +202,7 @@ namespace JsonRandom for (auto creaID : crea->upgrades) info.allowedCreatures.push_back(VLC->creh->creatures[creaID]); } + ret.push_back(info); } return ret; }