mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Threat level texts are now stored in separate config file.
This commit is contained in:
parent
125f39275d
commit
f96b394b01
14
config/threatlevel.txt
Normal file
14
config/threatlevel.txt
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
Threat:
|
||||
Effortless
|
||||
Very Weak
|
||||
Weak
|
||||
A bit weaker
|
||||
Equal
|
||||
A bit stronger
|
||||
Strong
|
||||
Very Strong
|
||||
Challenging
|
||||
Overpowering
|
||||
Deadly
|
||||
Impossible
|
@ -533,6 +533,15 @@ void CGeneralTextHandler::load()
|
||||
}
|
||||
} while (nameBuf.size());
|
||||
}
|
||||
|
||||
std::ifstream ifs(DATA_DIR "/config/threatlevel.txt", std::ios::in | std::ios::binary);
|
||||
getline(ifs, buf); //skip 1st line
|
||||
for (int i = 0; i < 13; ++i)
|
||||
{
|
||||
getline(ifs, buf);
|
||||
threat.push_back(buf);
|
||||
tlog1 << buf << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
std::vector <std::vector <std::vector <std::string> > > quests; //[quest][type][index]
|
||||
//type: quest, progress, complete, rollover, log OR time limit //index: 0-2 seer hut, 3-5 border guard
|
||||
std::vector<std::string> seerNames;
|
||||
std::vector<std::string> threat; //power rating for neutral stacks
|
||||
|
||||
//sec skills
|
||||
std::vector <std::string> skillName;
|
||||
|
@ -2825,20 +2825,24 @@ const std::string & CGCreature::getHoverText() const
|
||||
|
||||
if(const CGHeroInstance *selHero = cb->getSelectedHero(cb->getCurrentPlayer()))
|
||||
{
|
||||
hoverName += "\n\n Threat: ";
|
||||
std::vector<std::string> * texts = &VLC->generaltexth->threat;
|
||||
hoverName += "\n\n ";
|
||||
hoverName += (*texts)[0];
|
||||
int choice;
|
||||
float ratio = ((float)getArmyStrength() / selHero->getTotalStrength());
|
||||
if (ratio < 0.1) hoverName += "Effortless";
|
||||
else if (ratio < 0.25) hoverName += "Very Weak";
|
||||
else if (ratio < 0.6) hoverName += "Weak";
|
||||
else if (ratio < 0.9) hoverName += "A bit weaker";
|
||||
else if (ratio < 1.1) hoverName += "Equal";
|
||||
else if (ratio < 1.3) hoverName += "A bit stronger";
|
||||
else if (ratio < 1.8) hoverName += "Strong";
|
||||
else if (ratio < 2.5) hoverName += "Very Strong";
|
||||
else if (ratio < 4) hoverName += "Challenging";
|
||||
else if (ratio < 8) hoverName += "Overpowering";
|
||||
else if (ratio < 20) hoverName += "Deadly";
|
||||
else hoverName += "Impossible";
|
||||
if (ratio < 0.1) choice = 1;
|
||||
else if (ratio < 0.25) choice = 2;
|
||||
else if (ratio < 0.6) choice = 3;
|
||||
else if (ratio < 0.9) choice = 4;
|
||||
else if (ratio < 1.1) choice = 5;
|
||||
else if (ratio < 1.3) choice = 6;
|
||||
else if (ratio < 1.8) choice = 7;
|
||||
else if (ratio < 2.5) choice = 8;
|
||||
else if (ratio < 4) choice = 9;
|
||||
else if (ratio < 8) choice = 10;
|
||||
else if (ratio < 20) choice = 11;
|
||||
else choice = 12;
|
||||
hoverName += (*texts)[choice];
|
||||
}
|
||||
return hoverName;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user