From 55b142a8c90a98cb9e18186bb3261a41737648d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zieli=C5=84ski?= Date: Wed, 14 Sep 2022 11:37:12 +0200 Subject: [PATCH] Suggested tweaks --- lib/HeroBonus.cpp | 6 +++--- lib/int3.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/HeroBonus.cpp b/lib/HeroBonus.cpp index 1b24804ed..081d874f7 100644 --- a/lib/HeroBonus.cpp +++ b/lib/HeroBonus.cpp @@ -663,7 +663,7 @@ int IBonusBearer::valOfBonuses(Bonus::BonusType type, int subtype) const //This part is performance-critical char cachingStr[20] = {}; - sprintf(cachingStr, "type_%ds_%d", (int)type, subtype); + std::sprintf(cachingStr, "type_%ds_%d", (int)type, subtype); CSelector s = Selector::type()(type); if(subtype != -1) @@ -693,7 +693,7 @@ bool IBonusBearer::hasBonusOfType(Bonus::BonusType type, int subtype) const { //This part is performance-ciritcal char cachingStr[20] = {}; - sprintf(cachingStr, "type_%ds_%d", (int)type, subtype); + std::sprintf(cachingStr, "type_%ds_%d", (int)type, subtype); CSelector s = Selector::type()(type); if(subtype != -1) @@ -975,7 +975,7 @@ void CBonusSystemNode::getAllBonusesRec(BonusList &out) const } bonuses.getAllBonuses(beforeUpdate); - for(auto & b : beforeUpdate) + for(const auto & b : beforeUpdate) { auto updated = b->updater ? getUpdatedBonus(b, b->updater) diff --git a/lib/int3.h b/lib/int3.h index 0894892fe..d8861e314 100644 --- a/lib/int3.h +++ b/lib/int3.h @@ -160,7 +160,7 @@ public: { //Performance is important here char str[16] = {}; - sprintf(str, "(%d %d %d)", x, y, z); + std::sprintf(str, "(%d %d %d)", x, y, z); return std::string(str); }