Skip to content

Commit

Permalink
Fix various compilation warnings.
Browse files Browse the repository at this point in the history
- constructor re-ordering
- deprecated QString::SkipEmptyParts
- deprecated QTimer methods
- unused method args
- missing handling enum value
  • Loading branch information
timhul committed Nov 22, 2020
1 parent 8fa9730 commit 18d801f
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 20 deletions.
6 changes: 3 additions & 3 deletions Class/Warrior/Buffs/DefensiveStanceBuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@

DefensiveStanceBuff::DefensiveStanceBuff(Warrior* warrior) :
SelfBuff(warrior, "Defensive Stance", NO_ICON, BuffDuration::PERMANENT, 1),
warrior(warrior),
TalentRequirer(QVector<TalentRequirerInfo*> {new TalentRequirerInfo("Defiance", 5, DisabledAtZero::No)}),
warrior(warrior),
current_threat_mod(30) {
this->hidden = true;
}

void DefensiveStanceBuff::increase_talent_rank_effect(const QString& talent_name, const int curr) {
void DefensiveStanceBuff::increase_talent_rank_effect(const QString& /* talent_name */, const int curr) {
if (warrior->in_defensive_stance())
warrior->get_stats()->decrease_total_threat_mod(std::round(current_threat_mod));
current_threat_mod = (130 * (1 + 0.03 * curr)) - 100;
if (warrior->in_defensive_stance())
warrior->get_stats()->increase_total_threat_mod(std::round(current_threat_mod));
}

void DefensiveStanceBuff::decrease_talent_rank_effect(const QString& talent_name, const int curr) {
void DefensiveStanceBuff::decrease_talent_rank_effect(const QString& /* talent_name */, const int curr) {
if (warrior->in_defensive_stance())
warrior->get_stats()->decrease_total_threat_mod(std::round(current_threat_mod));
current_threat_mod = (130 * (1 + 0.03 * curr)) - 100;
Expand Down
4 changes: 2 additions & 2 deletions Engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "StatisticsEngine.h"
#include "Utils/Check.h"

Engine::Engine() : queue(new Queue()), timer(new QTime()), current_prio(0) {}
Engine::Engine() : queue(new Queue()), timer(new QElapsedTimer()), current_prio(0) {}

Engine::~Engine() {
delete queue;
Expand Down Expand Up @@ -37,7 +37,7 @@ void Engine::prepare_iteration(const double start_at) {
void Engine::reset() {
engine_statistics->set_elapsed(static_cast<unsigned>(timer->elapsed()));
delete timer;
timer = new QTime();
timer = new QElapsedTimer();
}

void Engine::end_combat() {
Expand Down
4 changes: 2 additions & 2 deletions Engine/Engine.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <QElapsedTimer>
#include <QMap>
#include <QTime>

class Event;
class Queue;
Expand All @@ -26,7 +26,7 @@ class Engine {
private:
Queue* queue;
StatisticsEngine* engine_statistics {nullptr};
QTime* timer;
QElapsedTimer* timer;

double current_prio;
};
2 changes: 2 additions & 0 deletions Event/Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ QString Event::get_name_for_event_type(const EventType event_type) {
return "RangedHit";
case EventType::SpellCallback:
return "SpellCallback";
case EventType::IncomingDamage:
return "IncomingDamage";
}

return "<missing name for event>";
Expand Down
2 changes: 1 addition & 1 deletion Event/Events/IncomingDamageEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "PhysicalAttackResult.h"

IncomingDamageEvent::IncomingDamageEvent(Character* character, Engine* engine, const int timestamp) :
character(character), roll(new CombatRoll(character)), Event(EventType::IncomingDamage, static_cast<double>(timestamp)), engine(engine) {}
Event(EventType::IncomingDamage, static_cast<double>(timestamp)), character(character), roll(new CombatRoll(character)), engine(engine) {}

void IncomingDamageEvent::act() {
engine->add_event(new IncomingDamageEvent(character, engine, engine->get_current_priority() + 1.5));
Expand Down
11 changes: 5 additions & 6 deletions Event/Events/IncomingDamageEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ class Engine;

class IncomingDamageEvent : public Event {
public:
IncomingDamageEvent(Character *character, Engine *engine,
const int timestamp);
IncomingDamageEvent(Character* character, Engine* engine, const int timestamp);

void act() override;
void act() override;

private:
Engine *engine;
Character *character;
CombatRoll *roll;
Character* character;
CombatRoll* roll;
Engine* engine;
};
2 changes: 1 addition & 1 deletion GUI/Models/Statistics/ScaleResultModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class ScaleResultModel : public QAbstractListModel {
QHash<int, QByteArray> roleNames() const;

private:
bool for_dps;
NumberCruncher* statistics_source;
bool for_dps;
QMap<ScaleResultSorting::Methods, SortDirection> sorting_methods;
QList<ScaleResult*> scale_results;
ScaleResultSorting::Methods current_sorting_method;
Expand Down
10 changes: 5 additions & 5 deletions Rotation/RotationFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void RotationFileReader::rotation_file_handler(QXmlStreamReader& reader, Rotatio
}

bool RotationFileReader::rotation_executor_handler(QXmlStreamReader& reader, RotationExecutor* executor) {
QStringList expressions = reader.readElementText().trimmed().split('\n', QString::SkipEmptyParts);
QStringList expressions = reader.readElementText().trimmed().split('\n', Qt::SkipEmptyParts);

for (auto& str : expressions)
str = str.trimmed();
Expand All @@ -142,7 +142,7 @@ bool RotationFileReader::rotation_executor_handler(QXmlStreamReader& reader, Rot
// First sentence does not have logical connective at start.
// [TYPE] "[TYPE_VALUE]" [COMPARE_OPERATION]
// Split into [TYPE, TYPE_VALUE, COMPARE_OPERATION]
QStringList quotation_split = expressions.takeFirst().split('"', QString::SkipEmptyParts);
QStringList quotation_split = expressions.takeFirst().split('"', Qt::SkipEmptyParts);
for (auto& str : quotation_split)
str = str.trimmed();

Expand Down Expand Up @@ -175,7 +175,7 @@ bool RotationFileReader::rotation_executor_handler(QXmlStreamReader& reader, Rot
executor->add_sentence(sentence);

for (int i = 0; i < expressions.size(); ++i) {
quotation_split = expressions[i].split('"', QString::SkipEmptyParts);
quotation_split = expressions[i].split('"', Qt::SkipEmptyParts);
for (auto& str : quotation_split)
str = str.trimmed();

Expand All @@ -187,7 +187,7 @@ bool RotationFileReader::rotation_executor_handler(QXmlStreamReader& reader, Rot

sentence = new Sentence();

QStringList logical_connective_split = quotation_split.takeFirst().split(' ', QString::SkipEmptyParts);
QStringList logical_connective_split = quotation_split.takeFirst().split(' ', Qt::SkipEmptyParts);
// Else LOGICAL CONNECTIVE
if (logical_connective_split.size() != 2) {
qDebug() << "Expected logical operator split size of 2, got:" << logical_connective_split;
Expand Down Expand Up @@ -258,7 +258,7 @@ bool RotationFileReader::add_compare_operation(Sentence* sentence, QString& comp
QSet<QString> cmp_by_float = {"greater", "geq", "eq", "leq", "less"};
QSet<QString> cmp_by_bool = {"is"};

QStringList cmp_operation_split = compare_operation.split(' ', QString::SkipEmptyParts);
QStringList cmp_operation_split = compare_operation.split(' ', Qt::SkipEmptyParts);
if (cmp_operation_split.empty()) {
qDebug() << "Compare operation split returned empty split";
return false;
Expand Down

0 comments on commit 18d801f

Please sign in to comment.