1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Merge branch 'develop' of git://github.com/Macron1Robot/vcmi into WarmysBackup

Conflicts:
	client/CKingdomInterface.cpp
This commit is contained in:
DjWarmonger 2014-05-02 12:03:02 +02:00
commit fb5152254d
31 changed files with 4972 additions and 4862 deletions

View File

@ -6,6 +6,7 @@
#include "../../lib/CConfigHandler.h"
#include "../../lib/CHeroHandler.h"
/*
* CCreatureHandler.h, part of VCMI engine
*
@ -1142,7 +1143,8 @@ void VCAI::buildStructure(const CGTownInstance * t)
//Possible - allow "locking" on specific building (build prerequisites and then building itself)
TResources currentRes = cb->getResourceAmount();
int townIncome = t->dailyIncome();
TResources currentIncome = t->dailyIncome();
int townIncome = currentIncome[Res::GOLD];
if (tryBuildAnyStructure(t, std::vector<BuildingID>(essential, essential + ARRAY_COUNT(essential))))
return;
@ -2343,23 +2345,11 @@ TResources VCAI::estimateIncome() const
TResources ret;
for(const CGTownInstance *t : cb->getTownsInfo())
{
ret[Res::GOLD] += t->dailyIncome();
//TODO duplikuje newturn
if(t->hasBuilt(BuildingID::RESOURCE_SILO)) //there is resource silo
{
if(t->town->primaryRes == Res::WOOD_AND_ORE) //we'll give wood and ore
{
ret[Res::WOOD] ++;
ret[Res::ORE] ++;
}
else
{
ret[t->town->primaryRes] ++;
}
}
ret += t->dailyIncome();
}
for(const CGObjectInstance *obj : getFlaggedObjects())
{
if(obj->ID == Obj::MINE)
@ -2883,7 +2873,7 @@ bool shouldVisit(HeroPtr h, const CGObjectInstance * obj)
case Obj::MAGIC_WELL:
return h->mana < h->manaLimit();
case Obj::PRISON:
return ai->myCb->getHeroesInfo().size() < GameConstants::MAX_HEROES_PER_PLAYER;
return ai->myCb->getHeroesInfo().size() < VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER;// GameConstants::MAX_HEROES_PER_PLAYER;
case Obj::BOAT:
return false;

View File

@ -1,4 +1,4 @@
VCMI PROJECT CODE CONTRIBUTORS:
VCMI PROJECT CODE CONTRIBUTORS:
Michał Urbańczyk aka Tow, <impono@gmail.com>
* project originator; programming, making releases, website
@ -46,5 +46,8 @@ Ivan Savenko, <saven.ivan@gmail.com>
Benjamin Gentner aka beegee, <>
* battle support, programming
Alexey aka Macron1Robot, <>
* minor modding changes
Alexander Shishkin aka alexvins,
* MinGW platform support, modding related programming

View File

@ -14,7 +14,11 @@ SPELLS:
MODS:
* Support for submods - mod may have their own "submods" located in <modname>/Mods directory
* Mods may provide their own changelogs and screenshots that will be visible in Launcher
* Mods cas now add new (offensive, buffs, debuffs) spells and change existing
* Mods can now add new (offensive, buffs, debuffs) spells and change existing
* Mods can use custom mage guild background pictures and videos for taverns, setting of resources daily income for buildings
GENERAL:
* Added configuring of heroes quantity per player allowed in game
0.94 -> 0.95 (Mar 01 2014)
GENERAL:

View File

@ -114,7 +114,6 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
#include <boost/range/algorithm.hpp>
#include <boost/thread.hpp>
#include <boost/variant.hpp>
#include <boost/math/special_functions/round.hpp>

View File

@ -22,11 +22,6 @@
"config/wog/heroClasses.json"
],
"spells" :
[
"config/wog/spells.json"
],
"filesystem":
{
"" :

View File

@ -358,7 +358,7 @@ void CHeroGSlot::clickLeft(tribool down, bool previousState)
bool allow = true;
if(upg) //moving hero out of town - check if it is allowed
{
if(!hero && LOCPLINT->cb->howManyHeroes(false) >= 8)
if(!hero && LOCPLINT->cb->howManyHeroes(false) >= VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER)
{
std::string tmp = CGI->generaltexth->allTexts[18]; //You already have %d adventuring heroes under your command.
boost::algorithm::replace_first(tmp,"%d",boost::lexical_cast<std::string>(LOCPLINT->cb->howManyHeroes(false)));
@ -847,7 +847,9 @@ void CCastleBuildings::enterTownHall()
void CCastleBuildings::openMagesGuild()
{
GH.pushInt(new CMageGuildScreen(LOCPLINT->castleInt));
std::string mageGuildBackground;
mageGuildBackground = LOCPLINT->castleInt->town->town->clientInfo.guildBackground;
GH.pushInt(new CMageGuildScreen(LOCPLINT->castleInt,mageGuildBackground));
}
void CCastleBuildings::openTownHall()
@ -964,7 +966,8 @@ void CCastleInterface::recreateIcons()
size_t iconIndex = town->town->clientInfo.icons[town->hasFort()][town->builded >= CGI->modh->settings.MAX_BUILDING_PER_TURN];
icon->setFrame(iconIndex);
income->setText(boost::lexical_cast<std::string>(town->dailyIncome()));
TResources townIncome = town->dailyIncome();
income->setText(boost::lexical_cast<std::string>(townIncome[Res::GOLD]));
hall = new CTownInfo( 80, 413, town, true);
fort = new CTownInfo(122, 413, town, false);
@ -1636,9 +1639,12 @@ void CFortScreen::RecruitArea::clickRight(tribool down, bool previousState)
clickLeft(down, false); //r-click does same as l-click - opens recr. window
}
CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner):
CWindowObject(BORDERED, "TPMAGE")
CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner,std::string imagem) :CWindowObject(BORDERED,imagem)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
window = new CPicture(owner->town->town->clientInfo.guildWindow , 332, 76);

View File

@ -360,7 +360,7 @@ class CMageGuildScreen : public CWindowObject
CGStatusBar *statusBar;
public:
CMageGuildScreen(CCastleInterface * owner);
CMageGuildScreen(CCastleInterface * owner,std::string image);
};
/// The blacksmith window where you can buy available in town war machine

View File

@ -953,4 +953,4 @@ void CHeroItem::onArtChange(int tabIndex)
//redraw item after background change
if (active)
redraw();
}
}

View File

@ -3726,10 +3726,16 @@ CTavernWindow::CTavernWindow(const CGObjectInstance *TavernObj):
recruit->hoverTexts[0] = CGI->generaltexth->tavernInfo[0]; //Cannot afford a Hero
recruit->block(true);
}
else if(LOCPLINT->cb->howManyHeroes(false) >= 8)
else if(LOCPLINT->castleInt && LOCPLINT->cb->howManyHeroes(true) >= VLC->modh->settings.MAX_HEROES_AVAILABLE_PER_PLAYER)
{
recruit->hoverTexts[0] = CGI->generaltexth->tavernInfo[1]; //Cannot recruit. You already have %d Heroes.
boost::algorithm::replace_first(recruit->hoverTexts[0],"%d",boost::lexical_cast<std::string>(LOCPLINT->cb->howManyHeroes()));
boost::algorithm::replace_first(recruit->hoverTexts[0],"%d",boost::lexical_cast<std::string>(LOCPLINT->cb->howManyHeroes(true)));
recruit->block(true);
}
else if((!LOCPLINT->castleInt) && LOCPLINT->cb->howManyHeroes(false) >= VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER)
{
recruit->hoverTexts[0] = CGI->generaltexth->tavernInfo[1]; //Cannot recruit. You already have %d Heroes.
boost::algorithm::replace_first(recruit->hoverTexts[0], "%d", boost::lexical_cast<std::string>(LOCPLINT->cb->howManyHeroes(false)));
recruit->block(true);
}
else if(LOCPLINT->castleInt && LOCPLINT->castleInt->town->visitingHero)
@ -3742,8 +3748,10 @@ CTavernWindow::CTavernWindow(const CGObjectInstance *TavernObj):
if(selected == -1)
recruit->block(true);
}
CCS->videoh->open("TAVERN.BIK");
if (LOCPLINT->castleInt)
CCS->videoh->open(LOCPLINT->castleInt->town->town->clientInfo.tavernVideo);
else
CCS->videoh->open("TAVERN.BIK");
}
void CTavernWindow::recruitb()

View File

@ -20,7 +20,10 @@
"MAX_BUILDING_PER_TURN" : 1,
"DWELLINGS_ACCUMULATE_CREATURES" : true,
"ALL_CREATURES_GET_DOUBLE_MONTHS" : false,
"NEGATIVE_LUCK" : false
"NEGATIVE_LUCK" : false,
"MAX_HEROES_AVAILABLE_PER_PLAYER" : 16,
"MAX_HEROES_ON_MAP_PER_PLAYER" : 8
},
"modules":
{

View File

@ -116,7 +116,8 @@
"musicTheme" : "music/CstleTown",
"defaultTavern" : 5,
"tavernVideo" : "TAVERN.BIK",
"guildBackground" : "TPMAGE.bmp",
"townBackground": "TBCSBACK.bmp",
"guildWindow": "TPMAGECS.bmp",
"buildingsIcons": "HALLCSTL.DEF",
@ -143,7 +144,7 @@
"mageGuild" : 4,
"warMachine" : "ballista",
"moatDamage" : 70,
"primaryResource": "ore",
"buildings" :
{
"mageGuild1": { "id" : 0 },
@ -155,12 +156,12 @@
"fort": { "id" : 7 },
"citadel": { "id" : 8, "upgrades" : "fort" },
"castle": { "id" : 9, "upgrades" : "citadel" },
"villageHall": { "id" : 10, "mode" : "auto" },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
"villageHall": { "id" : 10, "mode" : "auto", "produce": { "gold": 500 } },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ], "produce": { "gold": 1000 } },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ], "produce": { "gold": 2000 } },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ], "produce": { "gold": 4000 } },
"marketplace": { "id" : 14 },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ] },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ], "produce": { "ore": 1, "wood": 1 } },
"blacksmith": { "id" : 16 },
"special1": { "id" : 17, "requires" : [ "shipyard" ] },
@ -169,7 +170,7 @@
"ship": { "id" : 20, "upgrades" : "shipyard" },
"special2": { "id" : 21, "requires" : [ "dwellingLvl4" ] },
"special3": { "id" : 22, "upgrades" : "tavern" },
"grail": { "id" : 26, "mode" : "grail"},
"grail": { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 }},
"dwellingLvl1": { "id" : 30, "requires" : [ "fort" ] },
"dwellingLvl2": { "id" : 31, "requires" : [ "dwellingLvl1" ] },

View File

@ -120,7 +120,8 @@
"musicTheme" : "music/ElemTown",
"defaultTavern" : 5,
"tavernVideo" : "TAVERN.BIK",
"guildBackground" : "TPMAGE.bmp",
"townBackground": "TBELBACK.bmp",
"guildWindow": "TPMAGEEL.bmp",
"buildingsIcons": "HALLELEM.DEF",
@ -161,12 +162,12 @@
"fort": { "id" : 7 },
"citadel": { "id" : 8, "upgrades" : "fort" },
"castle": { "id" : 9, "upgrades" : "citadel" },
"villageHall": { "id" : 10, "mode" : "auto" },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
"villageHall": { "id" : 10, "mode" : "auto", "produce": { "gold": 500 } },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ], "produce": { "gold": 1000 } },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ], "produce": { "gold": 2000 } },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ], "produce": { "gold": 4000 } },
"marketplace": { "id" : 14 },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ] },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ], "produce": { "mercury": 1 } },
"blacksmith": { "id" : 16 },
"special1": { "id" : 17, "requires" : [ "marketplace" ] },
@ -174,7 +175,7 @@
"horde1Upgr": { "id" : 19, "upgrades" : "dwellingUpLvl1", "requires" : [ "horde1" ], "mode" : "auto" },
"ship": { "id" : 20, "upgrades" : "shipyard" },
"special2": { "id" : 21, "requires" : [ "mageGuild1" ] },
"grail": { "id" : 26, "mode" : "grail"},
"grail": { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 }},
"extraTownHall": { "id" : 27, "requires" : [ "townHall" ], "mode" : "auto" },
"extraCityHall": { "id" : 28, "requires" : [ "cityHall" ], "mode" : "auto" },
"extraCapitol": { "id" : 29, "requires" : [ "capitol" ], "mode" : "auto" },

View File

@ -115,7 +115,8 @@
"musicTheme" : "music/Dungeon",
"defaultTavern" : 5,
"tavernVideo" : "TAVERN.BIK",
"guildBackground" : "TPMAGE.bmp",
"townBackground": "TBDNBACK.bmp",
"guildWindow": "TPMAGEDN.bmp",
"buildingsIcons": "HALLDUNG.DEF",
@ -155,10 +156,10 @@
"fort": { "id" : 7 },
"citadel": { "id" : 8, "upgrades" : "fort" },
"castle": { "id" : 9, "upgrades" : "citadel" },
"villageHall": { "id" : 10, "mode" : "auto" },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
"villageHall": { "id" : 10, "mode" : "auto", "produce": { "gold": 500 } },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ], "produce": { "gold": 1000 } },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ], "produce": { "gold": 2000 } },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ], "produce": { "gold": 4000 } },
"marketplace": { "id" : 14 },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ] },
"blacksmith": { "id" : 16 },
@ -169,7 +170,7 @@
"special2": { "id" : 21, "requires" : [ "mageGuild1" ] },
"special3": { "id" : 22 },
"special4": { "id" : 23 },
"grail": { "id" : 26, "mode" : "grail"},
"grail": { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 }},
"dwellingLvl1": { "id" : 30, "requires" : [ "fort" ] },
"dwellingLvl2": { "id" : 31, "requires" : [ "dwellingLvl1" ] },

View File

@ -116,7 +116,8 @@
"musicTheme" : "music/FortressTown",
"defaultTavern" : 5,
"tavernVideo" : "TAVERN.BIK",
"guildBackground" : "TPMAGE.bmp",
"townBackground": "TBFRBACK.bmp",
"guildWindow": "TPMAGEFR.bmp",
"buildingsIcons": "HALLFORT.DEF",
@ -143,7 +144,7 @@
"mageGuild" : 3,
"warMachine" : "firstAidTent",
"moatDamage" : 90,
"primaryResource":"ore",
"buildings" :
{
"mageGuild1": { "id" : 0 },
@ -154,12 +155,12 @@
"fort": { "id" : 7 },
"citadel": { "id" : 8, "upgrades" : "fort" },
"castle": { "id" : 9, "upgrades" : "citadel" },
"villageHall": { "id" : 10, "mode" : "auto" },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
"villageHall": { "id" : 10, "mode" : "auto", "produce": { "gold": 500 } },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ], "produce": { "gold": 1000 } },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ], "produce": { "gold": 2000 } },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ], "produce": { "gold": 4000 } },
"marketplace": { "id" : 14 },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ] },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ], "produce": { "wood": 1, "ore": 1 } },
"blacksmith": { "id" : 16 },
"special1": { "id" : 17, "requires" : [ "allOf", [ "townHall" ], [ "special2" ] ] },
@ -168,7 +169,7 @@
"ship": { "id" : 20, "upgrades" : "shipyard" },
"special2": { "id" : 21, "requires" : [ "fort" ] },
"special3": { "id" : 22, "requires" : [ "special2" ] },
"grail": { "id" : 26, "mode" : "grail"},
"grail": { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 }},
"extraCapitol": { "id" : 29, "requires" : [ "capitol" ], "mode" : "auto" },
"dwellingLvl1": { "id" : 30, "requires" : [ "fort" ] },

View File

@ -116,7 +116,8 @@
"musicTheme" : "music/InfernoTown",
"defaultTavern" : 5,
"tavernVideo" : "TAVERN.BIK",
"guildBackground" : "TPMAGE.bmp",
"townBackground": "TBINBACK.bmp",
"guildWindow": "TPMAGEIN.bmp",
"buildingsIcons": "HALLINFR.DEF",
@ -156,12 +157,12 @@
"fort": { "id" : 7 },
"citadel": { "id" : 8, "upgrades" : "fort" },
"castle": { "id" : 9, "upgrades" : "citadel" },
"villageHall": { "id" : 10, "mode" : "auto" },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
"villageHall": { "id" : 10, "mode" : "auto", "produce": { "gold": 500 } },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ], "produce": { "gold": 1000 } },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ], "produce": { "gold": 2000 } },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ], "produce": { "gold": 4000 } },
"marketplace": { "id" : 14 },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ] },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ], "produce": { "mercury": 1 } },
"blacksmith": { "id" : 16 },
"horde1": { "id" : 18, "upgrades" : "dwellingLvl1" },
@ -171,7 +172,7 @@
"special4": { "id" : 23, "requires" : [ "mageGuild1" ] },
"horde2": { "id" : 24, "upgrades" : "dwellingLvl3" },
"horde2Upgr": { "id" : 25, "upgrades" : "dwellingUpLvl3", "requires" : [ "horde2" ], "mode" : "auto" },
"grail": { "id" : 26, "mode" : "grail"},
"grail": { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 }},
"dwellingLvl1": { "id" : 30, "requires" : [ "fort" ] },
"dwellingLvl2": { "id" : 31, "requires" : [ "dwellingLvl1" ] },

View File

@ -120,7 +120,8 @@
"musicTheme" : "music/NecroTown",
"defaultTavern" : 5,
"tavernVideo" : "TAVERN.BIK",
"guildBackground" : "TPMAGE.bmp",
"townBackground": "TBNCBACK.bmp",
"guildWindow": "TPMAGENC.bmp",
"buildingsIcons": "HALLNECR.DEF",
@ -147,6 +148,7 @@
"mageGuild" : 5,
"warMachine" : "firstAidTent",
"moatDamage" : 70,
"primaryResource": "ore",
"buildings" :
{
@ -160,12 +162,12 @@
"fort": { "id" : 7 },
"citadel": { "id" : 8, "upgrades" : "fort" },
"castle": { "id" : 9, "upgrades" : "citadel" },
"villageHall": { "id" : 10, "mode" : "auto" },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
"villageHall": { "id" : 10, "mode" : "auto", "produce": { "gold": 500 } },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ], "produce": { "gold": 1000 } },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ], "produce": { "gold": 2000 } },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ], "produce": { "gold": 4000 } },
"marketplace": { "id" : 14 },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ] },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ], "produce": { "ore": 1, "wood": 1 } },
"blacksmith": { "id" : 16 },
"special1": { "id" : 17, "requires" : [ "fort" ] },
@ -174,7 +176,7 @@
"ship": { "id" : 20, "upgrades" : "shipyard" },
"special2": { "id" : 21, "requires" : [ "mageGuild1" ] },
"special3": { "id" : 22, "requires" : [ "dwellingLvl1" ] },
"grail": { "id" : 26, "mode" : "grail"},
"grail": { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 }},
"extraTownHall": { "id" : 27, "requires" : [ "townHall" ], "mode" : "auto" },
"extraCityHall": { "id" : 28, "requires" : [ "cityHall" ], "mode" : "auto" },
"extraCapitol": { "id" : 29, "requires" : [ "capitol" ], "mode" : "auto" },

View File

@ -120,7 +120,8 @@
"musicTheme" : "music/Rampart",
"defaultTavern" : 5,
"tavernVideo" : "TAVERN.BIK",
"guildBackground" : "TPMAGE.bmp",
"townBackground": "TBRMBACK.bmp",
"guildWindow": "TPMAGERM.bmp",
"buildingsIcons": "HALLRAMP.DEF",
@ -160,12 +161,12 @@
"fort": { "id" : 7 },
"citadel": { "id" : 8, "upgrades" : "fort" },
"castle": { "id" : 9, "upgrades" : "citadel" },
"villageHall": { "id" : 10, "mode" : "auto" },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
"villageHall": { "id" : 10, "mode" : "auto", "produce": { "gold": 500 } },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ], "produce": { "gold": 1000 } },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ], "produce": { "gold": 2000 } },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ], "produce": { "gold": 4000 } },
"marketplace": { "id" : 14 },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ] },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ], "produce": { "crystal": 1 } },
"blacksmith": { "id" : 16 },
"special1": { "id" : 17 },
@ -175,7 +176,7 @@
"special3": { "id" : 22, "requires" : [ "horde1" ] },
"horde2": { "id" : 24, "upgrades" : "dwellingLvl5" },
"horde2Upgr": { "id" : 25, "upgrades" : "dwellingUpLvl5", "requires" : [ "horde2" ], "mode" : "auto" },
"grail": { "id" : 26, "mode" : "grail"},
"grail": { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 }},
"extraTownHall": { "id" : 27, "requires" : [ "townHall" ], "mode" : "auto" },
"extraCityHall": { "id" : 28, "requires" : [ "cityHall" ], "mode" : "auto" },
"extraCapitol": { "id" : 29, "requires" : [ "capitol" ], "mode" : "auto" },

View File

@ -114,7 +114,9 @@
"musicTheme" : "music/Stronghold",
"defaultTavern" : 5,
"tavernVideo" : "TAVERN.BIK",
"guildBackground" : "TPMAGE.bmp",
"primaryResource": "ore",
"townBackground": "TBSTBACK.bmp",
"guildWindow": "TPMAGEST.bmp",
"buildingsIcons": "HALLSTRN.DEF",
@ -151,12 +153,12 @@
"fort": { "id" : 7 },
"citadel": { "id" : 8, "upgrades" : "fort" },
"castle": { "id" : 9, "upgrades" : "citadel" },
"villageHall": { "id" : 10, "mode" : "auto" },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
"villageHall": { "id" : 10, "mode" : "auto", "produce": { "gold": 500 } },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ], "produce": { "gold": 1000 } },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ], "produce": { "gold": 2000 } },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ], "produce": { "gold": 4000 } },
"marketplace": { "id" : 14 },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ] },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ], "produce": { "ore": 1, "wood": 1 } },
"blacksmith": { "id" : 16 },
"special1": { "id" : 17, "requires" : [ "fort" ] },
@ -165,7 +167,7 @@
"special2": { "id" : 21, "requires" : [ "marketplace" ] },
"special3": { "id" : 22, "requires" : [ "blacksmith" ] },
"special4": { "id" : 23, "requires" : [ "fort" ] },
"grail": { "id" : 26, "mode" : "grail"},
"grail": { "id" : 26, "mode" : "grail", "produce": { "gold": 5000 }},
"dwellingLvl1": { "id" : 30, "requires" : [ "fort" ] },
"dwellingLvl2": { "id" : 31, "requires" : [ "dwellingLvl1" ] },

View File

@ -115,7 +115,8 @@
"musicTheme" : "music/TowerTown",
"defaultTavern" : 5,
"tavernVideo" : "TAVERN.BIK",
"guildBackground" : "TPMAGE.bmp",
"townBackground": "TBTWBACK.bmp",
"guildWindow": "TPMAGETW.bmp",
"buildingsIcons": "HALLTOWR.DEF",
@ -155,12 +156,12 @@
"fort": { "id" : 7 },
"citadel": { "id" : 8, "upgrades" : "fort" },
"castle": { "id" : 9, "upgrades" : "citadel" },
"villageHall": { "id" : 10, "mode" : "auto" },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ] },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ] },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ] },
"villageHall": { "id" : 10, "mode" : "auto", "produce" : { "gold": 500 } },
"townHall": { "id" : 11, "upgrades" : "villageHall", "requires" : [ "tavern" ], "produce" : { "gold": 1000 } },
"cityHall": { "id" : 12, "upgrades" : "townHall", "requires" : [ "allOf", [ "mageGuild1" ], [ "marketplace" ], [ "blacksmith" ] ], "produce": { "gold": 2000 } },
"capitol": { "id" : 13, "upgrades" : "cityHall", "requires" : [ "castle" ], "produce" : { "gold": 4000 } },
"marketplace": { "id" : 14 },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ] },
"resourceSilo": { "id" : 15, "requires" : [ "marketplace" ], "produce" : { "gems": 1 } },
"blacksmith": { "id" : 16 },
"special1": { "id" : 17, "requires" : [ "marketplace" ] },
@ -169,7 +170,7 @@
"special2": { "id" : 21, "requires" : [ "fort" ] },
"special3": { "id" : 22, "requires" : [ "mageGuild1" ] },
"special4": { "id" : 23, "requires" : [ "mageGuild1" ] },
"grail": { "id" : 26, "mode" : "grail"},
"grail": { "id" : 26, "mode" : "grail", "produce" : { "gold": 5000 } },
"dwellingLvl1": { "id" : 30, "requires" : [ "fort" ] },
"dwellingLvl2": { "id" : 31, "requires" : [ "dwellingLvl1" ] },

View File

@ -105,8 +105,7 @@
"additionalProperties" : false,
"required" : [
"adventureMap", "buildingsIcons", "buildings", "creatures", "guildWindow", "names",
"hallBackground", "hallSlots", "horde", "mageGuild", "moatDamage", "defaultTavern",
"musicTheme", "siege", "structures", "townBackground", "warMachine"
"hallBackground", "hallSlots", "horde", "mageGuild", "moatDamage", "defaultTavern", "tavernVideo", "guildBackground", "musicTheme", "siege", "structures", "townBackground", "warMachine"
],
"description": "town",
"properties":{
@ -168,6 +167,11 @@
"minimum" : 0
}
},
"tavernVideo" : {
"type" : "string",
"description" : "Video for tavern window",
"format" : "videoFile"
},
"names" : {
"type" : "array",
"description" : "Names for towns on adventure map",
@ -199,6 +203,12 @@
"type":"string",
"description": "Image with small view on town from mage guild"
},
"guildBackground": {
"type":"string",
"description": "Image with background of mage guild",
"format" : "imageFile"
},
"hallBackground": {
"type":"string",
"description": "background image for town hall",

View File

@ -63,6 +63,21 @@
"gems": { "type":"number"},
"gold": { "type":"number"}
}
},
"produce": {
"type":"object",
"additionalProperties" : false,
"description": "Resources this building produce each day",
"properties":{
"wood": { "type":"number"},
"mercury": { "type":"number"},
"ore": { "type":"number"},
"sulfur": { "type":"number"},
"crystal": { "type":"number"},
"gems": { "type":"number"},
"gold": { "type":"number"}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -510,14 +510,14 @@ void CModHandler::loadConfigFromFile (std::string name)
{
settings.data = JsonUtils::assembleFromFiles("config/" + name);
const JsonNode & hardcodedFeatures = settings.data["hardcodedFeatures"];
settings.MAX_HEROES_AVAILABLE_PER_PLAYER = hardcodedFeatures["MAX_HEROES_AVAILABLE_PER_PLAYER"].Float();
settings.MAX_HEROES_ON_MAP_PER_PLAYER = hardcodedFeatures["MAX_HEROES_ON_MAP_PER_PLAYER"].Float();
settings.CREEP_SIZE = hardcodedFeatures["CREEP_SIZE"].Float();
settings.WEEKLY_GROWTH = hardcodedFeatures["WEEKLY_GROWTH_PERCENT"].Float();
settings.NEUTRAL_STACK_EXP = hardcodedFeatures["NEUTRAL_STACK_EXP_DAILY"].Float();
settings.MAX_BUILDING_PER_TURN = hardcodedFeatures["MAX_BUILDING_PER_TURN"].Float();
settings.DWELLINGS_ACCUMULATE_CREATURES = hardcodedFeatures["DWELLINGS_ACCUMULATE_CREATURES"].Bool();
settings.ALL_CREATURES_GET_DOUBLE_MONTHS = hardcodedFeatures["ALL_CREATURES_GET_DOUBLE_MONTHS"].Bool();
const JsonNode & gameModules = settings.data["modules"];
modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool();
modules.STACK_ARTIFACT = gameModules["STACK_ARTIFACTS"].Bool();

View File

@ -244,11 +244,13 @@ public:
int MAX_BUILDING_PER_TURN;
bool DWELLINGS_ACCUMULATE_CREATURES;
bool ALL_CREATURES_GET_DOUBLE_MONTHS;
int MAX_HEROES_AVAILABLE_PER_PLAYER;
int MAX_HEROES_ON_MAP_PER_PLAYER;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & data & CREEP_SIZE & WEEKLY_GROWTH & NEUTRAL_STACK_EXP & MAX_BUILDING_PER_TURN;
h & DWELLINGS_ACCUMULATE_CREATURES & ALL_CREATURES_GET_DOUBLE_MONTHS;
h & DWELLINGS_ACCUMULATE_CREATURES & ALL_CREATURES_GET_DOUBLE_MONTHS & MAX_HEROES_AVAILABLE_PER_PLAYER & MAX_HEROES_ON_MAP_PER_PLAYER;
}
} settings;

View File

@ -876,7 +876,7 @@ void CGHeroInstance::onHeroVisit(const CGHeroInstance * h) const
{
int txt_id;
if(cb->getHeroCount(h->tempOwner,false) < GameConstants::MAX_HEROES_PER_PLAYER) //free hero slot
if (cb->getHeroCount(h->tempOwner, false) < VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER)//GameConstants::MAX_HEROES_PER_PLAYER) //free hero slot
{
cb->changeObjPos(id,pos+int3(1,0,0),0);
//update hero parameters
@ -2179,6 +2179,7 @@ CGTownInstance::EFortLevel CGTownInstance::fortLevel() const //0 - none, 1 - for
int CGTownInstance::hallLevel() const // -1 - none, 0 - village, 1 - town, 2 - city, 3 - capitol
{
if (hasBuilt(BuildingID::CAPITOL))
return 3;
if (hasBuilt(BuildingID::CITY_HALL))
@ -2269,20 +2270,29 @@ GrowthInfo CGTownInstance::getGrowthInfo(int level) const
return ret;
}
int CGTownInstance::dailyIncome() const
TResources CGTownInstance::dailyIncome() const
{
int ret = 0;
if (hasBuilt(BuildingID::GRAIL))
ret+=5000;
TResources ret;
for (auto & p : town->buildings)
{
BuildingID buildingUpgrade;
for (auto & p2 : town->buildings)
{
if (p2.second->upgrade == p.first)
{
buildingUpgrade = p2.first;
}
}
if (!hasBuilt(buildingUpgrade)&&(hasBuilt(p.first)))
{
ret += p.second->produce;
}
}
if (hasBuilt(BuildingID::CAPITOL))
ret+=4000;
else if (hasBuilt(BuildingID::CITY_HALL))
ret+=2000;
else if (hasBuilt(BuildingID::TOWN_HALL))
ret+=1000;
else if (hasBuilt(BuildingID::VILLAGE_HALL))
ret+=500;
return ret;
}
bool CGTownInstance::hasFort() const

View File

@ -748,7 +748,7 @@ public:
//checks if building is constructed and town has same subID
bool hasBuilt(BuildingID buildingID) const;
bool hasBuilt(BuildingID buildingID, int townID) const;
int dailyIncome() const; //calculates daily income of this town
TResources dailyIncome() const; //calculates daily income of this town
int spellsAtLevel(int level, bool checkGuild) const; //levels are counted from 1 (1 - 5)
bool armedGarrison() const; //true if town has creatures in garrison or garrisoned hero
int getTownLevel() const;

View File

@ -105,9 +105,12 @@ JsonNode readBuilding(CLegacyConfigParser & parser)
for(const std::string & resID : GameConstants::RESOURCE_NAMES)
cost[resID].Float() = parser.readNumber();
cost.Struct().erase("mithril"); // erase mithril to avoid confusing validator
parser.endLine();
return ret;
}
@ -303,6 +306,36 @@ void CTownHandler::loadBuilding(CTown &town, const std::string & stringID, const
ret->name = source["name"].String();
ret->description = source["description"].String();
ret->resources = TResources(source["cost"]);
ret->produce = TResources(source["produce"]);
//for compatibility with older town mods
if(!ret->produce.nonZero())
{
if (ret->bid == BuildingID::VILLAGE_HALL) ret->produce[Res::GOLD] = 500;
if (ret->bid == BuildingID::TOWN_HALL) ret->produce[Res::GOLD] = 1000;
if (ret->bid == BuildingID::CITY_HALL) ret->produce[Res::GOLD] = 2000;
if (ret->bid == BuildingID::CAPITOL) ret->produce[Res::GOLD] = 4000;
if (ret->bid == BuildingID::GRAIL) ret->produce[Res::GOLD] = 5000;
//
if (ret->bid == BuildingID::RESOURCE_SILO)
{
if ((ret->town->primaryRes != Res::WOOD) && (ret->town->primaryRes != Res::ORE) && (ret->town->primaryRes != Res::GOLD))
ret->produce[ret->town->primaryRes] = 1;
else
{
if (ret->town->primaryRes == Res::GOLD) ret->produce[ret->town->primaryRes] = 500;
else
{
ret->produce[Res::WOOD] = 1;
ret->produce[Res::ORE] = 1;
}
}
}
}
loadBuildingRequirements(town, *ret, source["requires"]);
@ -510,6 +543,17 @@ void CTownHandler::loadClientData(CTown &town, const JsonNode & source)
info.guildWindow = source["guildWindow"].String();
info.buildingsIcons = source["buildingsIcons"].String();
//left for back compatibility - will be removed later
if (source["guildBackground"].String() != "")
info.guildBackground = source["guildBackground"].String();
else
info.guildBackground = "TPMAGE.bmp";
if (source["tavernVideo"].String() != "")
info.tavernVideo = source["tavernVideo"].String();
else
info.tavernVideo = "TAVERN.BIK";
//end of legacy assignment
info.advMapVillage = source["adventureMap"]["village"].String();
info.advMapCastle = source["adventureMap"]["castle"].String();
info.advMapCapitol = source["adventureMap"]["capitol"].String();
@ -535,6 +579,8 @@ void CTownHandler::loadTown(CTown &town, const JsonNode & source)
town.moatDamage = source["moatDamage"].Float();
town.mageLevel = source["mageGuild"].Float();
town.names = source["names"].convertTo<std::vector<std::string> >();
@ -648,6 +694,7 @@ CFaction * CTownHandler::loadFromJson(const JsonNode &source, std::string identi
faction->creatureBg120 = source["creatureBackground"]["120px"].String();
faction->creatureBg130 = source["creatureBackground"]["130px"].String();
faction->nativeTerrain = ETerrainType(vstd::find_pos(GameConstants::TERRAIN_NAMES,
source["nativeTerrain"].String()));
int alignment = vstd::find_pos(EAlignment::names, source["alignment"].String());
@ -674,6 +721,7 @@ CFaction * CTownHandler::loadFromJson(const JsonNode &source, std::string identi
void CTownHandler::loadObject(std::string scope, std::string name, const JsonNode & data)
{
auto object = loadFromJson(data, name);
object->index = factions.size();
if (object->town)
{

View File

@ -25,6 +25,9 @@ class CFaction;
/// a typical building encountered in every castle ;]
/// this is structure available to both client and server
/// contains all mechanics-related data about town structures
class DLL_LINKAGE CBuilding
{
@ -36,6 +39,7 @@ public:
CTown * town; // town this building belongs to
TResources resources;
TResources produce;
TRequired requirements;
std::string identifier;
@ -61,7 +65,7 @@ public:
template <typename Handler> void serialize(Handler &h, const int version)
{
h & identifier & town & bid & resources & name & description & requirements & upgrade & mode;
h & identifier & town & bid & resources & produce & name & description & requirements & upgrade & mode;
}
friend class CTownHandler;
@ -116,6 +120,8 @@ public:
std::string creatureBg120;
std::string creatureBg130;
std::vector<SPuzzleInfo> puzzleMap;
@ -132,7 +138,7 @@ public:
~CTown();
CFaction * faction;
std::vector<std::string> names; //names of the town instances
/// level -> list of creatures on this tier
@ -170,9 +176,10 @@ public:
int icons[2][2];
std::string iconSmall[2][2]; /// icon names used during loading
std::string iconLarge[2][2];
std::string tavernVideo;
std::string musicTheme;
std::string townBackground;
std::string guildBackground;
std::string guildWindow;
std::string buildingsIcons;
std::string hallBackground;
@ -193,7 +200,7 @@ public:
template <typename Handler> void serialize(Handler &h, const int version)
{
h & icons & iconSmall & iconLarge & musicTheme & townBackground & guildWindow & buildingsIcons & hallBackground;
h & icons & iconSmall & iconLarge & tavernVideo & musicTheme & townBackground & guildBackground & guildWindow & buildingsIcons & hallBackground;
h & advMapVillage & advMapCastle & advMapCapitol & hallSlots & structures;
h & siegePrefix & siegePositions & siegeShooter;
}

View File

@ -14,7 +14,7 @@
namespace GameConstants
{
const std::string VCMI_VERSION = "VCMI 0.95";
const std::string VCMI_VERSION = "VCMI 0.95b";
const int BFIELD_WIDTH = 17;
const int BFIELD_HEIGHT = 11;

File diff suppressed because it is too large Load Diff

View File

@ -1330,20 +1330,7 @@ void CGameHandler::newTurn()
}
if(!firstTurn && player < PlayerColor::PLAYER_LIMIT)//not the first day and town not neutral
{
if(t->hasBuilt(BuildingID::RESOURCE_SILO)) //there is resource silo
{
if(t->town->primaryRes == Res::WOOD_AND_ORE) //we'll give wood and ore
{
n.res[player][Res::WOOD] ++;
n.res[player][Res::ORE] ++;
}
else
{
n.res[player][t->town->primaryRes] ++;
}
}
n.res[player][Res::GOLD] += t->dailyIncome();
n.res[player] = n.res[player] + t->dailyIncome();
}
if(t->hasBuilt(BuildingID::GRAIL, ETownType::TOWER))
{
@ -3173,9 +3160,13 @@ bool CGameHandler::hireHero(const CGObjectInstance *obj, ui8 hid, PlayerColor pl
static const int GOLD_NEEDED = 2500;
//common preconditions
// if( (p->resources.at(Res::GOLD)<GOLD_NEEDED && complain("Not enough gold for buying hero!"))
// || (getHeroCount(player, false) >= GameConstants::MAX_HEROES_PER_PLAYER && complain("Cannot hire hero, only 8 wandering heroes are allowed!")))
if( (p->resources.at(Res::GOLD)<GOLD_NEEDED && complain("Not enough gold for buying hero!"))
|| (getHeroCount(player, false) >= GameConstants::MAX_HEROES_PER_PLAYER && complain("Cannot hire hero, only 8 wandering heroes are allowed!")))
return false;
|| ((!t) && (getHeroCount(player, false) >= VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER && complain("Cannot hire hero, too many wandering heroes already!")))
|| ((t) && (getHeroCount(player, true) >= VLC->modh->settings.MAX_HEROES_AVAILABLE_PER_PLAYER && complain("Cannot hire hero, too many heroes garrizoned and wandering already!"))) )
return false;
if(t) //tavern in town
{