From b56f862094edeae66f93857f8c9e4893646a0c75 Mon Sep 17 00:00:00 2001 From: yupinov Date: Sat, 11 Aug 2018 17:25:09 +0200 Subject: [PATCH] Yog is not able to buy a spellbook in his campaign anymore, as intended (#472) * Yog is not able to buy a spellbook in his campaign anymore, as intended --- client/windows/CCastleInterface.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index 3733a20ee..60fab310a 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -37,6 +37,8 @@ #include "../../lib/spells/CSpellHandler.h" #include "../../lib/CTownHandler.h" #include "../../lib/GameConstants.h" +#include "../../lib/StartInfo.h" +#include "../../lib/mapping/CCampaignHandler.h" #include "../../lib/mapObjects/CGHeroInstance.h" #include "../../lib/mapObjects/CGTownInstance.h" @@ -874,7 +876,16 @@ void CCastleBuildings::enterMagesGuild() if(hero && !hero->hasSpellbook()) //hero doesn't have spellbok { - if(LOCPLINT->cb->getResourceAmount(Res::GOLD) < 500) //not enough gold to buy spellbook + const StartInfo *si = LOCPLINT->cb->getStartInfo(); + // it would be nice to find a way to move this hack to config/mapOverrides.json + if(si && si->campState && si->campState->camp && // We're in campaign, + (si->campState->camp->header.filename == "DATA/YOG.H3C") && // which is "Birth of a Barbarian", + (hero->subID == 45)) // and the hero is Yog (based on Solmyr) + { + // "Yog has given up magic in all its forms..." + LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[736]); + } + else if(LOCPLINT->cb->getResourceAmount(Res::GOLD) < 500) //not enough gold to buy spellbook { openMagesGuild(); LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[213]);