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

Added "tavernVideo","guildBackground" to "faction" JSON config and schema. If "primaryResource" is set to "gold", silo will generate 500 gold per day

This commit is contained in:
Macron1Robot 2014-04-24 23:36:10 +04:00
parent fe4704157c
commit b7b890acff
20 changed files with 4786 additions and 4742 deletions

View File

@ -2355,7 +2355,8 @@ TResources VCAI::estimateIncome() const
}
else
{
ret[t->town->primaryRes] ++;
if (t->town->primaryRes != Res::GOLD)
ret[t->town->primaryRes]++;
}
}
}

View File

@ -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()
@ -1636,9 +1638,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

@ -3742,8 +3742,8 @@ CTavernWindow::CTavernWindow(const CGObjectInstance *TavernObj):
if(selected == -1)
recruit->block(true);
}
CCS->videoh->open(LOCPLINT->castleInt->town->town->clientInfo.tavernVideo);
CCS->videoh->open("TAVERN.BIK");
}
void CTavernWindow::recruitb()

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",

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",

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",

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",

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",

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",

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",

View File

@ -114,7 +114,8 @@
"musicTheme" : "music/Stronghold",
"defaultTavern" : 5,
"tavernVideo" : "TAVERN.BIK",
"guildBackground" : "TPMAGE.bmp",
"townBackground": "TBSTBACK.bmp",
"guildWindow": "TPMAGEST.bmp",
"buildingsIcons": "HALLSTRN.DEF",

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",

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,10 @@
"minimum" : 0
}
},
"tavernVideo" : {
"type" : "string",
"description" : "Video for tavern window"
},
"names" : {
"type" : "array",
"description" : "Names for towns on adventure map",
@ -199,6 +202,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

@ -2283,6 +2283,8 @@ int CGTownInstance::dailyIncome() const
ret+=1000;
else if (hasBuilt(BuildingID::VILLAGE_HALL))
ret+=500;
if (hasBuilt(BuildingID::RESOURCE_SILO)&&(town->primaryRes==Res::GOLD))
ret += 500;
return ret;
}
bool CGTownInstance::hasFort() const

View File

@ -510,6 +510,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 +546,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 +661,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());

View File

@ -117,6 +117,8 @@ public:
std::string creatureBg120;
std::string creatureBg130;
std::vector<SPuzzleInfo> puzzleMap;
template <typename Handler> void serialize(Handler &h, const int version)
@ -170,9 +172,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 +196,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

@ -1339,7 +1339,8 @@ void CGameHandler::newTurn()
}
else
{
n.res[player][t->town->primaryRes] ++;
if (t->town->primaryRes != Res::GOLD)
n.res[player][t->town->primaryRes] ++;
}
}