1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Remove limitations for amount of skills

This commit is contained in:
nordsoft 2023-04-29 16:24:53 +04:00 committed by Nordsoft91
parent a4fd6c1c92
commit 68fa7aaf35
4 changed files with 8 additions and 19 deletions

View File

@ -1317,7 +1317,6 @@ CUniversityWindow::CUniversityWindow(const CGHeroInstance * _hero, const IMarket
title = std::make_shared<CLabel>(231, 26, FONT_MEDIUM, ETextAlignment::CENTER, Colors::YELLOW, titleStr);
std::vector<int> goods = market->availableItemsIds(EMarketMode::RESOURCE_SKILL);
assert(goods.size() == 4);
for(int i=0; i<goods.size(); i++)//prepare clickable items
items.push_back(std::make_shared<CItem>(this, goods[i], 54+i*104, 234));

View File

@ -562,7 +562,14 @@
},
"modes" : ["resource-skill"],
"title" : "core.genrltxt.602",
"speech" : "core.genrltxt.603"
"speech" : "core.genrltxt.603",
"offer":
[
{ "noneOf" : ["necromancy"] },
{ "noneOf" : ["necromancy"] },
{ "noneOf" : ["necromancy"] },
{ "noneOf" : ["necromancy"] }
]
}
}
},

View File

@ -257,7 +257,6 @@ void CGUniversity::initObj(CRandomGenerator & rand)
CGMarket::initObj(rand);
std::vector<int> toChoose;
int skillsNeeded = skillsTotal - skills.size();
for(int i = 0; i < VLC->skillh->size(); ++i)
{
if(!vstd::contains(skills, i) && cb->isAllowed(2, i))
@ -265,21 +264,6 @@ void CGUniversity::initObj(CRandomGenerator & rand)
toChoose.push_back(i);
}
}
if(toChoose.size() < skillsNeeded)
{
logGlobal->warn("Warning: less then %d available skills was found by University initializer!", skillsTotal);
return;
}
// get 4 skills, excluding predefined
for(int i = 0; i < skillsNeeded; ++i)
{
// move randomly one skill to selected and remove from list
auto it = RandomGeneratorUtil::nextItem(toChoose, rand);
skills.push_back(*it);
toChoose.erase(it);
}
}
std::vector<int> CGUniversity::availableItemsIds(EMarketMode::EMarketMode mode) const

View File

@ -80,7 +80,6 @@ public:
class DLL_LINKAGE CGUniversity : public CGMarket
{
public:
int skillsTotal = 4;
std::vector<int> skills; //available skills
std::vector<int> availableItemsIds(EMarketMode::EMarketMode mode) const override;