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

Allow learning secondary skills in ally towns

This commit is contained in:
Dydzio 2019-03-24 19:20:08 +01:00 committed by Alexander Shishkin
parent 94040ea8af
commit c310a05ee0

View File

@ -199,10 +199,14 @@ bool TradeOnMarketplace::applyGh(CGameHandler * gh)
if(player >= PlayerColor::PLAYER_LIMIT)
throwAndComplain(gh, "No player can use this market!");
if(hero && (player != hero->tempOwner || hero->visitablePos() != market->visitablePos()))
bool allyTownSkillTrade = (mode == EMarketMode::RESOURCE_SKILL && gh->getPlayerRelations(player, hero->tempOwner) == PlayerRelations::ALLIES);
if(hero && (!(player == hero->tempOwner || allyTownSkillTrade)
|| hero->visitablePos() != market->visitablePos()))
throwAndComplain(gh, "This hero can't use this marketplace!");
throwOnWrongPlayer(gh, player);
if(!allyTownSkillTrade)
throwOnWrongPlayer(gh, player);
bool result = true;