From 0763b9a7582c20d0194009fd90e7112d4b223919 Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Tue, 15 Jul 2014 22:33:51 +0200 Subject: [PATCH] - Implemented object per zone limit - Various tweaks for Travis & repo --- Mods/WoG/config/wog/creatureBanks.json | 817 ------------------------- Mods/WoG/config/wog/dwellings.json | 31 - Mods/WoG/mod.json | 72 --- lib/mapObjects/ObjectTemplate.h | 2 + lib/rmg/CRmgTemplateZone.cpp | 15 +- lib/rmg/CRmgTemplateZone.h | 6 +- 6 files changed, 20 insertions(+), 923 deletions(-) delete mode 100644 Mods/WoG/config/wog/creatureBanks.json delete mode 100644 Mods/WoG/config/wog/dwellings.json delete mode 100644 Mods/WoG/mod.json diff --git a/Mods/WoG/config/wog/creatureBanks.json b/Mods/WoG/config/wog/creatureBanks.json deleted file mode 100644 index 9b4d61409..000000000 --- a/Mods/WoG/config/wog/creatureBanks.json +++ /dev/null @@ -1,817 +0,0 @@ -{ - "core:creatureBank" : { - "types" : { - "huntingLodge" : { - "name" : "Hunting Lodge", - "index" : 11, - "levels": [ - { - "chance": 30, - "guards": [ - { "amount": 3, "type" : "dendroidGuard" }, - { "amount": 4, "type" : "woodElf" }, - { "amount": 3, "type" : "dendroidGuard" }, - { "amount": 4, "type" : "woodElf" } - ], - "combat_value": 100, - "reward" : { - "resources": - { - "wood" : 15, - "gold" : 500 - } - } - }, - { - "chance": 30, - "guards": [ - { "amount": 4, "type" : "dendroidGuard" }, - { "amount": 6, "type" : "woodElf" }, - { "amount": 4, "type" : "dendroidGuard" }, - { "amount": 6, "type" : "woodElf" } - ], - "combat_value": 150, - "reward" : { - "resources": - { - "wood" : 20, - "gold" : 500 - }, - "value": 3000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 5, "type" : "dendroidGuard" }, - { "amount": 8, "type" : "woodElf" }, - { "amount": 5, "type" : "dendroidGuard" }, - { "amount": 8, "type" : "woodElf" } - ], - "combat_value": 200, - "reward" : { - "resources": - { - "wood" : 25, - "gold" : 500 - }, - "value": 4000 - } - }, - { - "chance": 10, - "guards": [ - { "amount": 6, "type" : "dendroidGuard" }, - { "amount": 10, "type" : "woodElf" }, - { "amount": 6, "type" : "dendroidGuard" }, - { "amount": 10, "type" : "woodElf" } - ], - "combat_value": 300, - "reward" : { - "resources": - { - "wood" : 40, - "gold" : 1000 - }, - "value": 6000 - } - } - ] - }, - "snowGrotto" : - { - "name" : "Snow-covered Grotto", - "index" : 12, - "levels": [ - { - "chance": 30, - "guards": [ - { "amount": 5, "type" : "ironGolem" }, - { "amount": 20, "type" : "masterGremlin" }, - { "amount": 5, "type" : "ironGolem" }, - { "amount": 20, "type" : "masterGremlin" } - ], - "combat_value": 100, - "reward" : { - "resources": - { - "ore" : 15, - "gold" : 500 - } - } - }, - { - "chance": 30, - "guards": [ - { "amount": 6, "type" : "ironGolem" }, - { "amount": 30, "type" : "masterGremlin" }, - { "amount": 6, "type" : "ironGolem" }, - { "amount": 30, "type" : "masterGremlin" } - ], - "combat_value": 150, - "reward" : { - "resources": - { - "ore" : 20, - "gold" : 500 - }, - "value": 3000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 7, "type" : "ironGolem" }, - { "amount": 40, "type" : "masterGremlin" }, - { "amount": 7, "type" : "ironGolem" }, - { "amount": 40, "type" : "masterGremlin" } - ], - "combat_value": 200, - "reward" : { - "resources": - { - "ore" : 30, - "gold" : 500 - }, - "value": 4000 - } - }, - { - "chance": 10, - "guards": [ - { "amount": 8, "type" : "ironGolem" }, - { "amount": 50, "type" : "masterGremlin" }, - { "amount": 8, "type" : "ironGolem" }, - { "amount": 50, "type" : "masterGremlin" } - ], - "combat_value": 300, - "reward" : { - "resources": - { - "ore" : 40, - "gold" : 1000 - }, - "value": 6000 - } - } - ] - }, - "martialSpiritPalace" : - { - "name" : "Palace of Martial Spirit", - "index" : 13, - "levels": [ - { - "chance": 30, - "guards": [ - { "amount": 10, "type" : "godWar" }, - { "amount": 10, "type" : "godWar" }, - { "amount": 10, "type" : "godWar" }, - { "amount": 10, "type" : "godWar" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godWar" } - ], - "value": 38000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 15, "type" : "godWar" }, - { "amount": 15, "type" : "godWar" }, - { "amount": 15, "type" : "godWar" }, - { "amount": 15, "type" : "godWar" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godWar" } - ], - "value": 57000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 20, "type" : "godWar" }, - { "amount": 20, "type" : "godWar" }, - { "amount": 20, "type" : "godWar" }, - { "amount": 20, "type" : "godWar" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godWar" } - ], - "value": 75000 - } - }, - { - "chance": 10, - "guards": [ - { "amount": 30, "type" : "godWar" }, - { "amount": 30, "type" : "godWar" }, - { "amount": 30, "type" : "godWar" }, - { "amount": 30, "type" : "godWar" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godWar" } - ], - "value": 90000 - } - } - ] - }, - "pacificationCitadel" : - { - "name" : "Citadel of Pacification", - "index" : 14, - "levels": [ - { - "chance": 30, - "guards": [ - { "amount": 10, "type" : "godPeace" }, - { "amount": 10, "type" : "godPeace" }, - { "amount": 10, "type" : "godPeace" }, - { "amount": 10, "type" : "godPeace" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godPeace" } - ], - "value": 38000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 15, "type" : "godPeace" }, - { "amount": 15, "type" : "godPeace" }, - { "amount": 15, "type" : "godPeace" }, - { "amount": 15, "type" : "godPeace" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godPeace" } - ], - "value": 57000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 20, "type" : "godPeace" }, - { "amount": 20, "type" : "godPeace" }, - { "amount": 20, "type" : "godPeace" }, - { "amount": 20, "type" : "godPeace" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godPeace" } - ], - "value": 75000 - } - }, - { - "chance": 10, - "guards": [ - { "amount": 30, "type" : "godPeace" }, - { "amount": 30, "type" : "godPeace" }, - { "amount": 30, "type" : "godPeace" }, - { "amount": 30, "type" : "godPeace" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godPeace" } - ], - "value": 90000 - } - } - ] - }, - "magiciansMonastery" : - { - "name" : "Monastery of Magicians", - "index" : 15, - "levels": [ - { - "chance": 30, - "guards": [ - { "amount": 10, "type" : "godMana" }, - { "amount": 10, "type" : "godMana" }, - { "amount": 10, "type" : "godMana" }, - { "amount": 10, "type" : "godMana" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godMana" } - ], - "value": 38000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 15, "type" : "godMana" }, - { "amount": 15, "type" : "godMana" }, - { "amount": 15, "type" : "godMana" }, - { "amount": 15, "type" : "godMana" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godMana" } - ], - "value": 57000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 20, "type" : "godMana" }, - { "amount": 20, "type" : "godMana" }, - { "amount": 20, "type" : "godMana" }, - { "amount": 20, "type" : "godMana" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godMana" } - ], - "value": 75000 - } - }, - { - "chance": 10, - "guards": [ - { "amount": 30, "type" : "godMana" }, - { "amount": 30, "type" : "godMana" }, - { "amount": 30, "type" : "godMana" }, - { "amount": 30, "type" : "godMana" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godMana" } - ], - "value": 90000 - } - } - ] - }, - "legendsLibrary" : - { - "name" : "Library of Legends", - "index" : 16, - "levels": [ - { - "chance": 30, - "guards": [ - { "amount": 10, "type" : "godLore" }, - { "amount": 10, "type" : "godLore" }, - { "amount": 10, "type" : "godLore" }, - { "amount": 10, "type" : "godLore" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godLore" } - ], - "value": 38000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 15, "type" : "godLore" }, - { "amount": 15, "type" : "godLore" }, - { "amount": 15, "type" : "godLore" }, - { "amount": 15, "type" : "godLore" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godLore" } - ], - "value": 57000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 20, "type" : "godLore" }, - { "amount": 20, "type" : "godLore" }, - { "amount": 20, "type" : "godLore" }, - { "amount": 20, "type" : "godLore" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godLore" } - ], - "value": 75000 - } - }, - { - "chance": 10, - "guards": [ - { "amount": 30, "type" : "godLore" }, - { "amount": 30, "type" : "godLore" }, - { "amount": 30, "type" : "godLore" }, - { "amount": 30, "type" : "godLore" } - ], - "combat_value": 2000, - "reward" : { - "creatures": [ - { "amount": 1, "type" : "godLore" } - ], - "value": 90000 - } - } - ] - }, - "transylvanianTavern" : - { - "name" : "Transylvanian Tavern", - "index" : 17, - "levels": [ - { - "chance": 30, - "guards": [ - { "amount": 2, "type" : "vampire" }, - { "amount": 2, "type" : "vampire" }, - { "amount": 2, "type" : "vampire" }, - { "amount": 2, "type" : "vampire" }, - { "amount": 2, "type" : "vampire" } - ], - "combat_value": 100, - "reward" : { - "resources": - { - "gold" : 1500 - }, - "creatures": [ - { "amount": 3, "type" : "vampireLord" } - ] - } - }, - { - "chance": 30, - "guards": [ - { "amount": 3, "type" : "vampire" }, - { "amount": 3, "type" : "vampire" }, - { "amount": 3, "type" : "vampire" }, - { "amount": 3, "type" : "vampire" }, - { "amount": 3, "type" : "vampire" } - ], - "combat_value": 150, - "reward" : { - "resources": - { - "gold" : 2500 - }, - "creatures": [ - { "amount": 5, "type" : "vampireLord" } - ], - "value": 3000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 4, "type" : "vampire" }, - { "amount": 4, "type" : "vampire" }, - { "amount": 4, "type" : "vampire" }, - { "amount": 4, "type" : "vampire" }, - { "amount": 4, "type" : "vampire" } - ], - "combat_value": 200, - "reward" : { - "resources": - { - "gold" : 3500 - }, - "creatures": [ - { "amount": 7, "type" : "vampireLord" } - ], - "value": 4000 - } - }, - { - "chance": 10, - "guards": [ - { "amount": 6, "type" : "vampire" }, - { "amount": 6, "type" : "vampire" }, - { "amount": 6, "type" : "vampire" }, - { "amount": 6, "type" : "vampire" }, - { "amount": 6, "type" : "vampire" } - ], - "combat_value": 250, - "reward" : { - "resources": - { - "gold" : 5000 - }, - "creatures": [ - { "amount": 9, "type" : "vampireLord" } - ], - "value": 5000 - } - } - ] - }, - "homeofthebat" : - { - "name" : "Home of the Bat", - "index" : 18, - "levels": [ - { - "chance": 30, - "guards": [ - { "amount": 2, "type" : "vampire" }, - { "amount": 2, "type" : "vampire" }, - { "amount": 2, "type" : "vampire", "upgrade_chance": 50 }, - { "amount": 2, "type" : "vampire" }, - { "amount": 2, "type" : "vampire" } - ], - "combat_value": 100, - "reward" : { - "resources": - { - "mercury" : 2, - "sulfur" : 2, - "crystal" : 2, - "gems" : 2 - }, - "creatures": [ - { "amount": 3, "type" : "vampireLord" } - ] - } - }, - { - "chance": 30, - "guards": [ - { "amount": 3, "type" : "vampire" }, - { "amount": 3, "type" : "vampire" }, - { "amount": 3, "type" : "vampire", "upgrade_chance": 70 }, - { "amount": 3, "type" : "vampire" }, - { "amount": 3, "type" : "vampire" } - ], - "combat_value": 150, - "reward" : { - "resources": - { - "mercury" : 3, - "sulfur" : 3, - "crystal" : 3, - "gems" : 3 - }, - "creatures": [ - { "amount": 5, "type" : "vampireLord" } - ], - "value": 3000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 4, "type" : "vampire" }, - { "amount": 4, "type" : "vampire" }, - { "amount": 4, "type" : "vampire", "upgrade_chance": 80 }, - { "amount": 4, "type" : "vampire" }, - { "amount": 4, "type" : "vampire" } - ], - "combat_value": 200, - "reward" : { - "resources": - { - "mercury" : 4, - "sulfur" : 4, - "crystal" : 4, - "gems" : 4 - }, - "creatures": [ - { "amount": 7, "type" : "vampireLord" } - ], - "value": 4000 - } - }, - { - "chance": 10, - "guards": [ - { "amount": 6, "type" : "vampire" }, - { "amount": 6, "type" : "vampire" }, - { "amount": 6, "type" : "vampire", "upgrade_chance": 50 }, - { "amount": 6, "type" : "vampire" }, - { "amount": 6, "type" : "vampire" } - ], - "combat_value": 250, - "reward" : { - "resources": - { - "mercury" : 5, - "sulfur" : 5, - "crystal" : 5, - "gems" : 5 - }, - "creatures": [ - { "amount": 9, "type" : "vampireLord" } - ], - "value": 5000 - } - } - ] - }, - "lostBottle" : - { - "name" : "Lost Bottle", - "index" : 19, - "levels": [ - { - "chance": 30, - "guards": [ - { "amount": 2, "type" : "genie" }, - { "amount": 2, "type" : "genie" }, - { "amount": 2, "type" : "genie", "upgrade_chance": 50 }, - { "amount": 2, "type" : "genie" }, - { "amount": 2, "type" : "genie" } - ], - "combat_value": 100, - "reward" : { - "resources": - { - "mercury" : 2, - "sulfur" : 2, - "crystal" : 2, - "gems" : 2 - }, - "creatures": [ - { "amount": 3, "type" : "genie" } - ] - } - }, - { - "chance": 30, - "guards": [ - { "amount": 3, "type" : "genie" }, - { "amount": 3, "type" : "genie" }, - { "amount": 3, "type" : "genie", "upgrade_chance": 70 }, - { "amount": 3, "type" : "genie" }, - { "amount": 3, "type" : "genie" } - ], - "combat_value": 150, - "reward" : { - "resources": - { - "mercury" : 3, - "sulfur" : 3, - "crystal" : 3, - "gems" : 3 - }, - "creatures": [ - { "amount": 5, "type" : "genie" } - ], - "value": 3000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 4, "type" : "genie" }, - { "amount": 4, "type" : "genie" }, - { "amount": 4, "type" : "genie", "upgrade_chance": 80 }, - { "amount": 4, "type" : "genie" }, - { "amount": 4, "type" : "genie" } - ], - "combat_value": 200, - "reward" : { - "resources": - { - "mercury" : 4, - "sulfur" : 4, - "crystal" : 4, - "gems" : 4 - }, - "creatures": [ - { "amount": 7, "type" : "genie" } - ], - "value": 4000 - } - }, - { - "chance": 10, - "guards": [ - { "amount": 6, "type" : "genie" }, - { "amount": 6, "type" : "genie" }, - { "amount": 6, "type" : "genie", "upgrade_chance": 90 }, - { "amount": 6, "type" : "genie" }, - { "amount": 6, "type" : "genie" } - ], - "combat_value": 250, - "reward" : { - "resources": - { - "mercury" : 5, - "sulfur" : 5, - "crystal" : 5, - "gems" : 5 - }, - "creatures": [ - { "amount": 9, "type" : "genie" } - ], - "value": 5000 - } - } - ] - }, - "grotto" : - { - "name" : "Grotto", - "index" : 20, - "levels": [ - { - "chance": 30, - "guards": [ - { "amount": 3, "type" : "harpy" }, - { "amount": 3, "type" : "beholder" }, - { "amount": 3, "type" : "harpy" }, - { "amount": 3, "type" : "beholder" } - ], - "combat_value": 200, - "reward" : { - "resources": - { - "ore" : 20, - "gold" : 1000 - } - } - }, - { - "chance": 30, - "guards": [ - { "amount": 4, "type" : "harpy" }, - { "amount": 4, "type" : "beholder" }, - { "amount": 4, "type" : "harpy" }, - { "amount": 4, "type" : "beholder" } - ], - "combat_value": 300, - "reward" : { - "resources": - { - "ore" : 25, - "gold" : 1000 - }, - "value": 3000 - } - }, - { - "chance": 30, - "guards": [ - { "amount": 5, "type" : "harpy" }, - { "amount": 5, "type" : "beholder" }, - { "amount": 5, "type" : "harpy" }, - { "amount": 5, "type" : "beholder" } - ], - "combat_value": 400, - "reward" : { - "resources": - { - "ore" : 30, - "gold" : 1500 - }, - "value": 4000 - } - }, - { - "chance": 10, - "guards": [ - { "amount": 6, "type" : "harpy" }, - { "amount": 6, "type" : "beholder" }, - { "amount": 6, "type" : "harpy" }, - { "amount": 6, "type" : "beholder" } - ], - "combat_value": 500, - "reward" : { - "resources": - { - "ore" : 35, - "gold" : 2000 - }, - "value": 5000 - } - } - ] - } - } - } -} diff --git a/Mods/WoG/config/wog/dwellings.json b/Mods/WoG/config/wog/dwellings.json deleted file mode 100644 index 696fa2e5a..000000000 --- a/Mods/WoG/config/wog/dwellings.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "core:creatureGeneratorCommon" : { - "types" : { - "supremeArchangel" : { "index" : 80, "creatures" : [[ "supremeArchangel" ]] }, - "diamondDragon" : { "index" : 81, "creatures" : [[ "diamondDragon" ]] }, - "lordofThunder" : { "index" : 82, "creatures" : [[ "lordofThunder" ]] }, - "hellBaron" : { "index" : 83, "creatures" : [[ "hellBaron" ]] }, - "bloodDragon" : { "index" : 84, "creatures" : [[ "bloodDragon" ]] }, - - "darknessDragon" : { "index" : 85, "creatures" : [[ "darknessDragon" ]] }, - "ghostBehemoth" : { "index" : 86, "creatures" : [[ "ghostBehemoth" ]] }, - "hellHydra" : { "index" : 87, "creatures" : [[ "hellHydra" ]] }, - "sacredPhoenix" : { "index" : 88, "creatures" : [[ "sacredPhoenix" ]] }, - "lavaSharpshooter" : { "index" : 89, "creatures" : [[ "lavaSharpshooter" ]] }, - - "arcticSharpshooter" : { "index" : 90, "creatures" : [[ "arcticSharpshooter" ]] }, - "gorynych" : { "index" : 91, "creatures" : [[ "gorynych" ]] }, - "nightmare" : { "index" : 92, "creatures" : [[ "nightmare" ]] }, - "minotaurKing2" : { "index" : 93, "creatures" : [[ "minotaurKing2" ]] }, - "warZealot" : { "index" : 94, "creatures" : [[ "warZealot" ]] }, - - "santaGremlin" : { "index" : 95, "creatures" : [[ "santaGremlin" ]] }, - "sylvanCentaur" : { "index" : 96, "creatures" : [[ "sylvanCentaur" ]] }, - "sorceress" : { "index" : 97, "creatures" : [[ "sorceress" ]] }, - "werewolf" : { "index" : 98, "creatures" : [[ "werewolf" ]] }, - "hellSteed" : { "index" : 99, "creatures" : [[ "hellSteed" ]] }, - - "dracolich" : { "index" :100, "creatures" : [[ "dracolich" ]] } - } - } -} diff --git a/Mods/WoG/mod.json b/Mods/WoG/mod.json deleted file mode 100644 index 9e26047f4..000000000 --- a/Mods/WoG/mod.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name" : "In The Wake of Gods", - "description" : "Unnofficial addon for Heroes of Might and Magic III", - - "version" : "0.0.0", - "author" : "WoG Team", - "contact" : "http://forum.vcmi.eu/index.php", - "modType" : "Expansion", - - "artifacts" : - [ - "config/wog/artifacts.json" - ], - - "creatures" : - [ - "config/wog/creatures.json" - ], - - "heroClasses" : - [ - "config/wog/heroClasses.json" - ], - - "objects" : - [ - "config/wog/dwellings.json", - "config/wog/creatureBanks.json" - ], - - "filesystem": - { - "" : - [ - { "type" : "map", "path" : "/Config/wogFileOverrides.json"} - ], - "CONFIG/" : - [ - { "type" : "dir", "path" : "/Config"} - ], - "DATA/" : - [ - {"type" : "lod", "path" : "/Data/hmm35wog.pac"}, - {"type" : "dir", "path" : "/Data"} - ], - "SPRITES/": - [ - {"type" : "lod", "path" : "/Data/hmm35wog.pac"}, - {"type" : "lod", "path" : "/Data/wog - animated objects.pac"}, - {"type" : "lod", "path" : "/Data/wog - animated trees.pac"}, - {"type" : "lod", "path" : "/Data/wog - battle decorations.pac"} - ], - "SOUNDS/": - [ - {"type" : "snd", "path" : "/Data/wog - sounds.snd"}, - {"type" : "snd", "path" : "/Data/wog.snd"} - ], - "MUSIC/": - [ - {"type" : "dir", "path" : "/Mp3"} - ], - "VIDEO/": - [ - {"type" : "vid", "path" : "/Data/wog - video.vid"}, - {"type" : "vid", "path" : "/Data/wog.vid"} - ], - "MAPS/": - [ - {"type" : "dir", "path" : "/Maps"} - ] - } -} diff --git a/lib/mapObjects/ObjectTemplate.h b/lib/mapObjects/ObjectTemplate.h index 73e375c21..8184efba1 100644 --- a/lib/mapObjects/ObjectTemplate.h +++ b/lib/mapObjects/ObjectTemplate.h @@ -75,6 +75,8 @@ public: void readMap(CBinaryReader & reader); void readJson(const JsonNode & node); + bool operator==(const ObjectTemplate& ot) const { return (id == ot.id && subid == ot.subid); } + template void serialize(Handler &h, const int version) { h & usedTiles & allowedTerrains & animationFile & stringID; diff --git a/lib/rmg/CRmgTemplateZone.cpp b/lib/rmg/CRmgTemplateZone.cpp index 43a0cf2fe..39206c931 100644 --- a/lib/rmg/CRmgTemplateZone.cpp +++ b/lib/rmg/CRmgTemplateZone.cpp @@ -700,6 +700,12 @@ bool CRmgTemplateZone::createTreasurePile (CMapGenerator* gen, int3 &pos) } else { + //remove from possible objects + auto oiptr = std::find(possibleObjects.begin(), possibleObjects.end(), oi); + assert (oiptr != possibleObjects.end()); + oiptr->maxPerZone--; + //TODO + //update treasure pile area int3 visitablePos = info.nextTreasurePos; @@ -1230,7 +1236,7 @@ bool CRmgTemplateZone::canObstacleBePlacedHere(CMapGenerator* gen, ObjectTemplat return true; } -bool CRmgTemplateZone::isAccessibleFromAnywhere (CMapGenerator* gen, ObjectTemplate &appearance, int3 &tile, std::set &tilesBlockedByObject) const +bool CRmgTemplateZone::isAccessibleFromAnywhere (CMapGenerator* gen, ObjectTemplate &appearance, int3 &tile, const std::set &tilesBlockedByObject) const { bool accessible = false; for (int x = -1; x < 2; x++) @@ -1453,7 +1459,7 @@ ObjectInfo CRmgTemplateZone::getRandomObject (CMapGenerator* gen, CTreasurePileI //roulette wheel for (auto oi : possibleObjects) { - if (oi.value >= minValue && oi.value <= value) + if (oi.value >= minValue && oi.value <= value && oi.maxPerZone > 0) { int3 newVisitableOffset = oi.templ.getVisitableOffset(); //visitablePos assumes object will be shifter by visitableOffset int3 newVisitablePos = info.nextTreasurePos; @@ -1592,6 +1598,7 @@ ObjectInfo CRmgTemplateZone::getRandomObject (CMapGenerator* gen, CTreasurePileI void CRmgTemplateZone::addAllPossibleObjects (CMapGenerator* gen) { ObjectInfo oi; + oi.maxPerMap = std::numeric_limits().max(); for (auto primaryID : VLC->objtypeh->knownObjects()) { @@ -1611,6 +1618,7 @@ void CRmgTemplateZone::addAllPossibleObjects (CMapGenerator* gen) oi.value = handler->getRMGInfo().value; oi.probability = handler->getRMGInfo().rarity; oi.templ = temp; + oi.maxPerZone = handler->getRMGInfo().zoneLimit; possibleObjects.push_back (oi); } } @@ -1618,6 +1626,9 @@ void CRmgTemplateZone::addAllPossibleObjects (CMapGenerator* gen) } } + //all following objects are unlimited + oi.maxPerZone = std::numeric_limits().max(); + //dwellings auto subObjects = VLC->objtypeh->knownSubObjects(Obj::CREATURE_GENERATOR1); diff --git a/lib/rmg/CRmgTemplateZone.h b/lib/rmg/CRmgTemplateZone.h index 39987a442..d35d7f4e8 100644 --- a/lib/rmg/CRmgTemplateZone.h +++ b/lib/rmg/CRmgTemplateZone.h @@ -71,9 +71,13 @@ struct DLL_LINKAGE ObjectInfo ObjectTemplate templ; ui32 value; ui16 probability; + ui32 maxPerZone; + ui32 maxPerMap; std::function generateObject; void setTemplate (si32 type, si32 subtype, ETerrainType terrain); + + bool operator==(const ObjectInfo& oi) const { return (templ == oi.templ); } }; struct DLL_LINKAGE CTreasurePileInfo @@ -207,7 +211,7 @@ private: bool pointIsIn(int x, int y); void addAllPossibleObjects (CMapGenerator* gen); //add objects, including zone-specific, to possibleObjects - bool isAccessibleFromAnywhere (CMapGenerator* gen, ObjectTemplate &appearance, int3 &tile, std::set &tilesBlockedByObject) const; + bool isAccessibleFromAnywhere (CMapGenerator* gen, ObjectTemplate &appearance, int3 &tile, const std::set &tilesBlockedByObject) const; bool findPlaceForObject(CMapGenerator* gen, CGObjectInstance* obj, si32 min_dist, int3 &pos); bool findPlaceForTreasurePile(CMapGenerator* gen, si32 min_dist, int3 &pos); bool canObstacleBePlacedHere(CMapGenerator* gen, ObjectTemplate &temp, int3 &pos);