|
@@ -33,6 +33,7 @@ void Unit::loadUnitName(QString unit_folder) {
|
|
|
QFile file(unit_folder + "unitname.txt");
|
|
|
file.open(QIODevice::ReadOnly);
|
|
|
QTextStream in(&file);
|
|
|
+ in.setCodec("UTF-8");
|
|
|
unit_name_ = in.readLine();
|
|
|
}
|
|
|
|
|
@@ -40,6 +41,7 @@ void Unit::loadUnitDescr(QString unit_folder) {
|
|
|
QFile file(unit_folder + "descr.txt");
|
|
|
file.open(QIODevice::ReadOnly);
|
|
|
QTextStream in(&file);
|
|
|
+ in.setCodec("UTF-8");
|
|
|
unit_descr_ = in.readAll();
|
|
|
}
|
|
|
|
|
@@ -47,6 +49,7 @@ void Unit::loadUnitBaseClass(QString unit_folder) {
|
|
|
QFile file(unit_folder + "baseclass.txt");
|
|
|
file.open(QIODevice::ReadOnly);
|
|
|
QTextStream in(&file);
|
|
|
+ in.setCodec("UTF-8");
|
|
|
base_class_id_ = in.readLine();
|
|
|
}
|
|
|
|
|
@@ -66,6 +69,7 @@ void Unit::loadUnitPrevSpecs(QString unit_folder) {
|
|
|
QFile file(unit_folder + "prevgrades.txt");
|
|
|
file.open(QIODevice::ReadOnly);
|
|
|
QTextStream in(&file);
|
|
|
+ in.setCodec("UTF-8");
|
|
|
QString line = in.readLine();
|
|
|
while (!in.atEnd()) {
|
|
|
parent_specs_.push_back(line);
|
|
@@ -80,6 +84,7 @@ void Unit::loadUnitUpgradeSpecs(QString unit_folder) {
|
|
|
QFile file(unit_folder + "nextgrades.txt");
|
|
|
file.open(QIODevice::ReadOnly);
|
|
|
QTextStream in(&file);
|
|
|
+ in.setCodec("UTF-8");
|
|
|
QString line = in.readLine();
|
|
|
while (!in.atEnd()) {
|
|
|
upgrade_specs_.push_back(line);
|
|
@@ -195,7 +200,7 @@ void Unit::calculateDamagePerHit() {
|
|
|
|
|
|
double Unit::reduceIncomingDamage(std::string damageType, int damage) { //returns damage after reducing by defence
|
|
|
assert("Incorrect damage type in call reduceIncomingDamage(), expected" &&
|
|
|
- damageType[0] == 'p' || damageType[0] == 'P' || damageType[0] == 'm' || damageType[0] == 'M');
|
|
|
+ (damageType[0] == 'p' || damageType[0] == 'P' || damageType[0] == 'm' || damageType[0] == 'M'));
|
|
|
assert("Magic defence of unit is incorrectly high (>40), but must be" && magic_defence_ <= 40);
|
|
|
assert("Physic defence of unit is incorrectly high (>40), but must be" && physic_defence_ <= 40);
|
|
|
if (damageType[0] == 'p' || damageType[0] == 'P') {
|