From 34744c068f675ae70e26c98bf9d37639d1d2131e Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 15 May 2021 14:16:28 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8FConsitantly=20use=20%i=20and?= =?UTF-8?q?=20not=20%d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/DiabloUI/selconn.cpp | 2 +- Source/DiabloUI/selgame.cpp | 3 +- Source/DiabloUI/selhero.cpp | 10 +-- Source/appfat.cpp | 4 +- Source/control.cpp | 2 +- Source/inv.cpp | 2 +- Source/monster.cpp | 2 +- Source/msg.cpp | 4 +- Source/multi.cpp | 6 +- Source/pfile.cpp | 2 +- Source/player.cpp | 110 +++++++++++++-------------- Source/plrmsg.cpp | 2 +- Source/qol/xpbar.cpp | 4 +- Source/scrollrt.cpp | 2 +- Source/setmaps.cpp | 2 +- Source/stores.cpp | 2 +- Source/storm/storm.cpp | 2 +- Source/themes.cpp | 2 +- Source/utils/sdl2_to_1_2_backports.h | 4 +- Source/utils/stubs.h | 6 +- test/lighting_test.cpp | 4 +- 21 files changed, 88 insertions(+), 89 deletions(-) diff --git a/Source/DiabloUI/selconn.cpp b/Source/DiabloUI/selconn.cpp index 81c6787ff..a84e30d27 100644 --- a/Source/DiabloUI/selconn.cpp +++ b/Source/DiabloUI/selconn.cpp @@ -112,7 +112,7 @@ void SelconnFocus(int value) break; } - snprintf(selconn_MaxPlayers, sizeof(selconn_MaxPlayers), _("Players Supported: %d"), players); + snprintf(selconn_MaxPlayers, sizeof(selconn_MaxPlayers), _("Players Supported: %i"), players); WordWrapArtStr(selconn_Description, DESCRIPTION_WIDTH); } diff --git a/Source/DiabloUI/selgame.cpp b/Source/DiabloUI/selgame.cpp index 536d8aa45..ce7a40cd5 100644 --- a/Source/DiabloUI/selgame.cpp +++ b/Source/DiabloUI/selgame.cpp @@ -412,8 +412,7 @@ static bool IsGameCompatible(GameData *data) UiSelOkDialog(title, _("The host is running a different game than you."), false); } else { char msg[64]; - sprintf(msg, _( /* TRANSLATORS: Error message when somebody tries to join a game running another version. */ "Your version %s does not match the host %d.%d.%d."), PROJECT_VERSION, PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR, PROJECT_VERSION_PATCH); - + sprintf(msg, _( /* TRANSLATORS: Error message when somebody tries to join a game running another version. */ "Your version %s does not match the host %i.%i.%i."), PROJECT_VERSION, PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR, PROJECT_VERSION_PATCH); UiSelOkDialog(title, msg, false); } diff --git a/Source/DiabloUI/selhero.cpp b/Source/DiabloUI/selhero.cpp index 930a74611..1c76b4359 100644 --- a/Source/DiabloUI/selhero.cpp +++ b/Source/DiabloUI/selhero.cpp @@ -101,11 +101,11 @@ void SelheroFree() void SelheroSetStats() { SELHERO_DIALOG_HERO_IMG->m_frame = static_cast(selhero_heroInfo.heroclass); - snprintf(textStats[0], sizeof(textStats[0]), "%d", selhero_heroInfo.level); - snprintf(textStats[1], sizeof(textStats[1]), "%d", selhero_heroInfo.strength); - snprintf(textStats[2], sizeof(textStats[2]), "%d", selhero_heroInfo.magic); - snprintf(textStats[3], sizeof(textStats[3]), "%d", selhero_heroInfo.dexterity); - snprintf(textStats[4], sizeof(textStats[4]), "%d", selhero_heroInfo.vitality); + snprintf(textStats[0], sizeof(textStats[0]), "%i", selhero_heroInfo.level); + snprintf(textStats[1], sizeof(textStats[1]), "%i", selhero_heroInfo.strength); + snprintf(textStats[2], sizeof(textStats[2]), "%i", selhero_heroInfo.magic); + snprintf(textStats[3], sizeof(textStats[3]), "%i", selhero_heroInfo.dexterity); + snprintf(textStats[4], sizeof(textStats[4]), "%i", selhero_heroInfo.vitality); } std::size_t listOffset = 0; diff --git a/Source/appfat.cpp b/Source/appfat.cpp index 06b9ff5f6..f65113d0a 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -101,7 +101,7 @@ void DrawDlg(const char *pszFmt, ...) */ void assert_fail(int nLineNo, const char *pszFile, const char *pszFail) { - app_fatal("assertion failed (%s:%d)\n%s", pszFile, nLineNo, pszFail); + app_fatal("assertion failed (%s:%i)\n%s", pszFile, nLineNo, pszFail); } #endif @@ -114,7 +114,7 @@ void ErrDlg(const char *title, const char *error, const char *logFilePath, int l FreeDlg(); - snprintf(text, sizeof(text), _( /* TRANSLATORS: Error message that displays relevant information for bug report */ "%s\n\nThe error occurred at: %s line %d"), error, logFilePath, logLineNr); + snprintf(text, sizeof(text), _( /* TRANSLATORS: Error message that displays relevant information for bug report */ "%s\n\nThe error occurred at: %s line %i"), error, logFilePath, logLineNr); UiErrorOkDialog(title, text); app_fatal(nullptr); diff --git a/Source/control.cpp b/Source/control.cpp index e8dd9bb33..9fc00eeba 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1729,7 +1729,7 @@ void control_drop_gold(char vkey) } memset(input, 0, sizeof(input)); - snprintf(input, sizeof(input), "%d", dropGoldValue); + snprintf(input, sizeof(input), "%i", dropGoldValue); if (vkey == DVL_VK_RETURN) { if (dropGoldValue > 0) control_remove_gold(myplr, initialDropGoldIndex); diff --git a/Source/inv.cpp b/Source/inv.cpp index 66579c7ba..abfa4a225 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -320,7 +320,7 @@ void DrawInvBelt(const CelOutputBuffer &out) if (AllItemsList[plr[myplr].SpdList[i].IDidx].iUsable && plr[myplr].SpdList[i]._iStatFlag && plr[myplr].SpdList[i]._itype != ITYPE_GOLD) { - sprintf(tempstr, "%d", i + 1); + sprintf(tempstr, "%i", i + 1); SDL_Rect rect { InvRect[i + SLOTXY_BELT_FIRST].X + PANEL_X + INV_SLOT_SIZE_PX - GetLineWidth(tempstr), InvRect[i + SLOTXY_BELT_FIRST].Y + PANEL_Y - 1, diff --git a/Source/monster.cpp b/Source/monster.cpp index 404e23859..31ea98008 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -4955,7 +4955,7 @@ const char *GetMonsterTypeText(const MonsterData &monsterData) return _("Undead"); } - app_fatal("Unknown mMonstClass %d", monsterData.mMonstClass); + app_fatal("Unknown mMonstClass %i", monsterData.mMonstClass); } void PrintMonstHistory(int mt) diff --git a/Source/msg.cpp b/Source/msg.cpp index e1a7cf63a..c8a2934e4 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -386,7 +386,7 @@ static void DeltaImportData(BYTE cmd, DWORD recv_offset) src = DeltaImportObject(src, sgLevels[i].object); DeltaImportMonster(src, sgLevels[i].monster); } else { - app_fatal("Unkown network message type: %d", cmd); + app_fatal("Unkown network message type: %i", cmd); } sgbDeltaChunks++; @@ -2225,7 +2225,7 @@ static DWORD On_PLAYER_JOINLEVEL(TCmd *pCmd, int pnum) InitPlrGFXMem(plr[pnum]); plr[pnum].plractive = true; gbActivePlayers++; - EventPlrMsg(_("Player '%s' (level %d) just joined the game"), plr[pnum]._pName, plr[pnum]._pLevel); + EventPlrMsg(_("Player '%s' (level %i) just joined the game"), plr[pnum]._pName, plr[pnum]._pLevel); } if (plr[pnum].plractive && myplr != pnum) { diff --git a/Source/multi.cpp b/Source/multi.cpp index 43956e4a2..53e661244 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -637,7 +637,7 @@ static void multi_handle_events(_SNETEVENT *pEvt) case EVENT_TYPE_PLAYER_CREATE_GAME: { auto *gameData = (GameData *)pEvt->data; if (gameData->size != sizeof(GameData)) - app_fatal("Invalid size of game data: %d", gameData->size); + app_fatal("Invalid size of game data: %i", gameData->size); sgGameInitInfo = *gameData; sgbPlayerTurnBitTbl[pEvt->playerid] = true; break; @@ -856,9 +856,9 @@ void recv_plrinfo(int pnum, TCmdPlrInfoHdr *p, bool recv) gbActivePlayers++; if (sgbPlayerTurnBitTbl[pnum]) { - szEvent = _("Player '%s' (level %d) just joined the game"); + szEvent = _("Player '%s' (level %i) just joined the game"); } else { - szEvent = _("Player '%s' (level %d) is already in the game"); + szEvent = _("Player '%s' (level %i) is already in the game"); } EventPlrMsg(szEvent, plr[pnum]._pName, plr[pnum]._pLevel); diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 427cd89e7..6d8aa6578 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -50,7 +50,7 @@ std::string GetSavePath(uint32_t save_num) } char save_num_str[21]; - snprintf(save_num_str, sizeof(save_num_str) / sizeof(char), "%d", save_num); + snprintf(save_num_str, sizeof(save_num_str) / sizeof(char), "%i", save_num); path.append(save_num_str); path.append(ext); return path; diff --git a/Source/player.cpp b/Source/player.cpp index d1f1809b2..19d7e710a 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -373,7 +373,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) byte **pAnim; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("LoadPlrGFX: illegal player %d", pnum); + app_fatal("LoadPlrGFX: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -483,7 +483,7 @@ void LoadPlrGFX(int pnum, player_graphic gfxflag) void InitPlayerGFX(int pnum) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("InitPlayerGFX: illegal player %d", pnum); + app_fatal("InitPlayerGFX: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -756,7 +756,7 @@ void SetPlrAnims(PlayerStruct &player) void CreatePlayer(int pnum, HeroClass c) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("CreatePlayer: illegal player %d", pnum); + app_fatal("CreatePlayer: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -935,7 +935,7 @@ void NextPlrLevel(int pnum) int hp, mana; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("NextPlrLevel: illegal player %d", pnum); + app_fatal("NextPlrLevel: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1004,7 +1004,7 @@ void AddPlrExperience(int pnum, int lvl, int exp) } if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("AddPlrExperience: illegal player %d", pnum); + app_fatal("AddPlrExperience: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1086,7 +1086,7 @@ void InitPlayer(int pnum, bool FirstTime) DWORD i; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("InitPlayer: illegal player %d", pnum); + app_fatal("InitPlayer: illegal player %i", pnum); } auto &player = plr[pnum]; auto &myPlayer = plr[myplr]; @@ -1193,7 +1193,7 @@ void InitPlayer(int pnum, bool FirstTime) void InitMultiView() { if ((DWORD)myplr >= MAX_PLRS) { - app_fatal("InitPlayer: illegal player %d", myplr); + app_fatal("InitPlayer: illegal player %i", myplr); } auto &myPlayer = plr[myplr]; @@ -1216,7 +1216,7 @@ bool PlrDirOK(int pnum, int dir) bool isOk; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PlrDirOK: illegal player %d", pnum); + app_fatal("PlrDirOK: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1275,7 +1275,7 @@ void SetPlayerOld(PlayerStruct &player) void FixPlayerLocation(int pnum, direction bDir) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("FixPlayerLocation: illegal player %d", pnum); + app_fatal("FixPlayerLocation: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1295,7 +1295,7 @@ void FixPlayerLocation(int pnum, direction bDir) void StartStand(int pnum, direction dir) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("StartStand: illegal player %d", pnum); + app_fatal("StartStand: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1318,7 +1318,7 @@ void StartStand(int pnum, direction dir) void StartWalkStand(int pnum) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("StartWalkStand: illegal player %d", pnum); + app_fatal("StartWalkStand: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1359,7 +1359,7 @@ static void PM_ChangeLightOff(PlayerStruct &player) void PM_ChangeOffset(int pnum) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PM_ChangeOffset: illegal player %d", pnum); + app_fatal("PM_ChangeOffset: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1499,7 +1499,7 @@ void StartWalk(int pnum, int xvel, int yvel, int xoff, int yoff, int xadd, int y void StartAttack(int pnum, direction d) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("StartAttack: illegal player %d", pnum); + app_fatal("StartAttack: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1535,7 +1535,7 @@ void StartAttack(int pnum, direction d) void StartRangeAttack(int pnum, direction d, int cx, int cy) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("StartRangeAttack: illegal player %d", pnum); + app_fatal("StartRangeAttack: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1569,7 +1569,7 @@ void StartRangeAttack(int pnum, direction d, int cx, int cy) void StartPlrBlock(int pnum, direction dir) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("StartPlrBlock: illegal player %d", pnum); + app_fatal("StartPlrBlock: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1599,7 +1599,7 @@ void StartPlrBlock(int pnum, direction dir) void StartSpell(int pnum, direction d, int cx, int cy) { if ((DWORD)pnum >= MAX_PLRS) - app_fatal("StartSpell: illegal player %d", pnum); + app_fatal("StartSpell: illegal player %i", pnum); auto &player = plr[pnum]; if (player._pInvincible && player._pHitPoints == 0 && pnum == myplr) { @@ -1651,7 +1651,7 @@ void FixPlrWalkTags(int pnum) int dx, dy, y, x; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("FixPlrWalkTags: illegal player %d", pnum); + app_fatal("FixPlrWalkTags: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1701,7 +1701,7 @@ void RemovePlrFromMap(int pnum) void StartPlrHit(int pnum, int dam, bool forcehit) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("StartPlrHit: illegal player %d", pnum); + app_fatal("StartPlrHit: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1810,7 +1810,7 @@ StartPlayerKill(int pnum, int earflag) ItemStruct *pi; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("StartPlayerKill: illegal player %d", pnum); + app_fatal("StartPlayerKill: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -1912,7 +1912,7 @@ void DropHalfPlayersGold(int pnum) int i, hGold; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("DropHalfPlayersGold: illegal player %d", pnum); + app_fatal("DropHalfPlayersGold: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -2025,7 +2025,7 @@ void StripTopGold(int pnum) int i, val; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("StripTopGold: illegal player %d", pnum); + app_fatal("StripTopGold: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -2182,7 +2182,7 @@ StartNewLvl(int pnum, interface_mode fom, int lvl) InitLevelChange(pnum); if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("StartNewLvl: illegal player %d", pnum); + app_fatal("StartNewLvl: illegal player %i", pnum); } auto &player = plr[pnum]; auto &myPlayer = plr[myplr]; @@ -2223,7 +2223,7 @@ void RestartTownLvl(int pnum) { InitLevelChange(pnum); if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("RestartTownLvl: illegal player %d", pnum); + app_fatal("RestartTownLvl: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -2272,7 +2272,7 @@ void StartWarpLvl(int pnum, int pidx) bool PM_DoWalk(int pnum, int variant) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PM_DoWalk: illegal player %d", pnum); + app_fatal("PM_DoWalk: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -2370,7 +2370,7 @@ bool WeaponDur(int pnum, int durrnd) } if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("WeaponDur: illegal player %d", pnum); + app_fatal("WeaponDur: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -2442,7 +2442,7 @@ bool PlrHitMonst(int pnum, int m) bool adjacentDamage = false; if ((DWORD)m >= MAXMONSTERS) { - app_fatal("PlrHitMonst: illegal monster %d", m); + app_fatal("PlrHitMonst: illegal monster %i", m); } auto &player = plr[pnum]; @@ -2468,7 +2468,7 @@ bool PlrHitMonst(int pnum, int m) } if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PlrHitMonst: illegal player %d", pnum); + app_fatal("PlrHitMonst: illegal player %i", pnum); } rv = false; @@ -2678,7 +2678,7 @@ bool PlrHitPlr(int pnum, int8_t p) int hit, hper, blk, blkper, mind, maxd, dam, lvl, skdam, tac; if ((DWORD)p >= MAX_PLRS) { - app_fatal("PlrHitPlr: illegal target player %d", p); + app_fatal("PlrHitPlr: illegal target player %i", p); } auto &target = plr[p]; @@ -2693,7 +2693,7 @@ bool PlrHitPlr(int pnum, int8_t p) } if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PlrHitPlr: illegal attacking player %d", pnum); + app_fatal("PlrHitPlr: illegal attacking player %i", pnum); } auto &attacker = plr[pnum]; @@ -2792,7 +2792,7 @@ bool PM_DoAttack(int pnum) bool didhit = false; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PM_DoAttack: illegal player %d", pnum); + app_fatal("PM_DoAttack: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -2888,7 +2888,7 @@ bool PM_DoAttack(int pnum) bool PM_DoRangeAttack(int pnum) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PM_DoRangeAttack: illegal player %d", pnum); + app_fatal("PM_DoRangeAttack: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -2964,7 +2964,7 @@ void ShieldDur(int pnum) } if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("ShieldDur: illegal player %d", pnum); + app_fatal("ShieldDur: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -2996,7 +2996,7 @@ void ShieldDur(int pnum) bool PM_DoBlock(int pnum) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PM_DoBlock: illegal player %d", pnum); + app_fatal("PM_DoBlock: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -3023,7 +3023,7 @@ static void ArmorDur(int pnum) } if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("ArmorDur: illegal player %d", pnum); + app_fatal("ArmorDur: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -3065,7 +3065,7 @@ static void ArmorDur(int pnum) bool PM_DoSpell(int pnum) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PM_DoSpell: illegal player %d", pnum); + app_fatal("PM_DoSpell: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -3102,7 +3102,7 @@ bool PM_DoSpell(int pnum) bool PM_DoGotHit(int pnum) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PM_DoGotHit: illegal player %d", pnum); + app_fatal("PM_DoGotHit: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -3122,7 +3122,7 @@ bool PM_DoGotHit(int pnum) bool PM_DoDeath(int pnum) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("PM_DoDeath: illegal player %d", pnum); + app_fatal("PM_DoDeath: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -3155,7 +3155,7 @@ void CheckNewPath(int pnum, bool pmWillBeCalled) int xvel3, xvel, yvel; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("CheckNewPath: illegal player %d", pnum); + app_fatal("CheckNewPath: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -3484,7 +3484,7 @@ bool PlrDeathModeOK(int p) } if ((DWORD)p >= MAX_PLRS) { - app_fatal("PlrDeathModeOK: illegal player %d", p); + app_fatal("PlrDeathModeOK: illegal player %i", p); } auto &player = plr[p]; @@ -3505,7 +3505,7 @@ void ValidatePlayer() int gt, i, b; if ((DWORD)myplr >= MAX_PLRS) { - app_fatal("ValidatePlayer: illegal player %d", myplr); + app_fatal("ValidatePlayer: illegal player %i", myplr); } auto &myPlayer = plr[myplr]; @@ -3589,7 +3589,7 @@ static void CheckCheatStats(PlayerStruct &player) void ProcessPlayers() { if ((DWORD)myplr >= MAX_PLRS) { - app_fatal("ProcessPlayers: illegal player %d", myplr); + app_fatal("ProcessPlayers: illegal player %i", myplr); } auto &myPlayer = plr[myplr]; @@ -3741,7 +3741,7 @@ void MakePlrPath(int pnum, int xx, int yy, bool endspace) int path; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("MakePlrPath: illegal player %d", pnum); + app_fatal("MakePlrPath: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -3798,7 +3798,7 @@ void CheckPlrSpell() int sl; if ((DWORD)myplr >= MAX_PLRS) { - app_fatal("CheckPlrSpell: illegal player %d", myplr); + app_fatal("CheckPlrSpell: illegal player %i", myplr); } auto &myPlayer = plr[myplr]; @@ -3876,7 +3876,7 @@ void SyncPlrAnim(int pnum) int dir, sType; if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("SyncPlrAnim: illegal player %d", pnum); + app_fatal("SyncPlrAnim: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -3976,7 +3976,7 @@ void SyncInitPlrPos(int pnum) void SyncInitPlr(int pnum) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("SyncInitPlr: illegal player %d", pnum); + app_fatal("SyncInitPlr: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -4024,7 +4024,7 @@ void CheckStats(PlayerStruct &player) void ModifyPlrStr(int p, int l) { if ((DWORD)p >= MAX_PLRS) { - app_fatal("ModifyPlrStr: illegal player %d", p); + app_fatal("ModifyPlrStr: illegal player %i", p); } auto &player = plr[p]; @@ -4052,7 +4052,7 @@ void ModifyPlrStr(int p, int l) void ModifyPlrMag(int p, int l) { if ((DWORD)p >= MAX_PLRS) { - app_fatal("ModifyPlrMag: illegal player %d", p); + app_fatal("ModifyPlrMag: illegal player %i", p); } auto &player = plr[p]; @@ -4088,7 +4088,7 @@ void ModifyPlrMag(int p, int l) void ModifyPlrDex(int p, int l) { if ((DWORD)p >= MAX_PLRS) { - app_fatal("ModifyPlrDex: illegal player %d", p); + app_fatal("ModifyPlrDex: illegal player %i", p); } auto &player = plr[p]; @@ -4113,7 +4113,7 @@ void ModifyPlrDex(int p, int l) void ModifyPlrVit(int p, int l) { if ((DWORD)p >= MAX_PLRS) { - app_fatal("ModifyPlrVit: illegal player %d", p); + app_fatal("ModifyPlrVit: illegal player %i", p); } auto &player = plr[p]; @@ -4147,7 +4147,7 @@ void ModifyPlrVit(int p, int l) void SetPlayerHitPoints(int pnum, int val) { if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("SetPlayerHitPoints: illegal player %d", pnum); + app_fatal("SetPlayerHitPoints: illegal player %i", pnum); } auto &player = plr[pnum]; @@ -4164,7 +4164,7 @@ void SetPlrStr(int p, int v) int dm; if ((DWORD)p >= MAX_PLRS) { - app_fatal("SetPlrStr: illegal player %d", p); + app_fatal("SetPlrStr: illegal player %i", p); } auto &player = plr[p]; @@ -4185,7 +4185,7 @@ void SetPlrMag(int p, int v) int m; if ((DWORD)p >= MAX_PLRS) { - app_fatal("SetPlrMag: illegal player %d", p); + app_fatal("SetPlrMag: illegal player %i", p); } auto &player = plr[p]; @@ -4208,7 +4208,7 @@ void SetPlrDex(int p, int v) int dm; if ((DWORD)p >= MAX_PLRS) { - app_fatal("SetPlrDex: illegal player %d", p); + app_fatal("SetPlrDex: illegal player %i", p); } auto &player = plr[p]; @@ -4229,7 +4229,7 @@ void SetPlrVit(int p, int v) int hp; if ((DWORD)p >= MAX_PLRS) { - app_fatal("SetPlrVit: illegal player %d", p); + app_fatal("SetPlrVit: illegal player %i", p); } auto &player = plr[p]; @@ -4266,7 +4266,7 @@ enum { void PlayDungMsgs() { if ((DWORD)myplr >= MAX_PLRS) { - app_fatal("PlayDungMsgs: illegal player %d", myplr); + app_fatal("PlayDungMsgs: illegal player %i", myplr); } auto &myPlayer = plr[myplr]; diff --git a/Source/plrmsg.cpp b/Source/plrmsg.cpp index 06dc7002a..238797132 100644 --- a/Source/plrmsg.cpp +++ b/Source/plrmsg.cpp @@ -70,7 +70,7 @@ void SendPlrMsg(int pnum, const char *pszStr) pMsg->time = SDL_GetTicks(); assert(strlen(plr[pnum]._pName) < PLR_NAME_LEN); assert(strlen(pszStr) < MAX_SEND_STR_LEN); - sprintf(pMsg->str, _( /* TRANSLATORS: Shown if player presses "v" button. %s is player name, %d is level, %s is location */ "%s (lvl %d): %s"), plr[pnum]._pName, plr[pnum]._pLevel, pszStr); + sprintf(pMsg->str, _( /* TRANSLATORS: Shown if player presses "v" button. %s is player name, %i is level, %s is location */ "%s (lvl %i): %s"), plr[pnum]._pName, plr[pnum]._pLevel, pszStr); } void ClearPlrMsg() diff --git a/Source/qol/xpbar.cpp b/Source/qol/xpbar.cpp index b4b47874c..8c178867a 100644 --- a/Source/qol/xpbar.cpp +++ b/Source/qol/xpbar.cpp @@ -121,7 +121,7 @@ bool CheckXPBarInfo() const int charLevel = player._pLevel; - sprintf(tempstr, _("Level %d"), charLevel); + sprintf(tempstr, _("Level %i"), charLevel); AddPanelString(tempstr); if (charLevel == MAXCHARLEVEL - 1) { @@ -147,7 +147,7 @@ bool CheckXPBarInfo() PrintWithSeparator(tempstr + SDL_arraysize("Next Level: ") - 1, ExpLvlsTbl[charLevel]); AddPanelString(tempstr); - sprintf(PrintWithSeparator(tempstr, ExpLvlsTbl[charLevel] - player._pExperience), _(" to Level %d"), charLevel + 1); + sprintf(PrintWithSeparator(tempstr, ExpLvlsTbl[charLevel] - player._pExperience), _(" to Level %i"), charLevel + 1); AddPanelString(tempstr); return true; diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 0ec81f90a..8ffe21e8a 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -1383,7 +1383,7 @@ static void DrawFPS(const CelOutputBuffer &out) framerate = 1000 * frameend / frames; frameend = 0; } - snprintf(String, 12, "%d FPS", framerate); + snprintf(String, 12, "%i FPS", framerate); DrawString(out, String, { 8, 65, 0, 0 }, UIS_RED); } } diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index d25de28e0..1ac22904c 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -91,7 +91,7 @@ int ObjIndex(int x, int y) if (object[oi].position.x == x && object[oi].position.y == y) return oi; } - app_fatal("ObjIndex: Active object not found at (%d,%d)", x, y); + app_fatal("ObjIndex: Active object not found at (%i,%i)", x, y); } void AddSKingObjs() diff --git a/Source/stores.cpp b/Source/stores.cpp index 7ec807170..08845fe45 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -883,7 +883,7 @@ void S_StartConfirm() strcpy(tempstr, _("Are you sure you want to repair this item?")); break; default: - app_fatal("Unknown store dialog %d", stextshold); + app_fatal("Unknown store dialog %i", stextshold); } AddSText(0, 15, tempstr, UIS_SILVER | UIS_CENTER, false); AddSText(0, 18, _("Yes"), UIS_SILVER | UIS_CENTER, true); diff --git a/Source/storm/storm.cpp b/Source/storm/storm.cpp index 001b4057c..1b3fd34ab 100644 --- a/Source/storm/storm.cpp +++ b/Source/storm/storm.cpp @@ -227,7 +227,7 @@ int getIniInt(const char *keyname, const char *valuename, int defaultValue) void setIniInt(const char *keyname, const char *valuename, int value) { char str[10]; - sprintf(str, "%d", value); + sprintf(str, "%i", value); setIniValue(keyname, valuename, str); } diff --git a/Source/themes.cpp b/Source/themes.cpp index 0b6f035f4..44c7232de 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -1063,7 +1063,7 @@ void CreateThemeRooms() Theme_WeaponRack(i); break; case THEME_NONE: - app_fatal("Unknown theme type: %d", themes[i].ttype); + app_fatal("Unknown theme type: %i", themes[i].ttype); } } InitObjFlag = false; diff --git a/Source/utils/sdl2_to_1_2_backports.h b/Source/utils/sdl2_to_1_2_backports.h index 60360135e..d07961cf2 100644 --- a/Source/utils/sdl2_to_1_2_backports.h +++ b/Source/utils/sdl2_to_1_2_backports.h @@ -149,14 +149,14 @@ inline void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y) { *x = window->clip_rect.x; *y = window->clip_rect.x; - SDL_Log("SDL_GetWindowPosition %d %d", *x, *y); + SDL_Log("SDL_GetWindowPosition %i %i", *x, *y); } inline void SDL_GetWindowSize(SDL_Window *window, int *w, int *h) { *w = window->clip_rect.w; *h = window->clip_rect.h; - SDL_Log("SDL_GetWindowSize %d %d", *w, *h); + SDL_Log("SDL_GetWindowSize %i %i", *w, *h); } inline void SDL_DestroyWindow(SDL_Window *window) diff --git a/Source/utils/stubs.h b/Source/utils/stubs.h index b0ec5780b..624d946ac 100644 --- a/Source/utils/stubs.h +++ b/Source/utils/stubs.h @@ -6,18 +6,18 @@ #define UNIMPLEMENTED() \ do { \ - SDL_Log("UNIMPLEMENTED: %s @ %s:%d", __FUNCTION__, __FILE__, __LINE__); \ + SDL_Log("UNIMPLEMENTED: %s @ %s:%i", __FUNCTION__, __FILE__, __LINE__); \ abort(); \ } while (0) #define ABORT() \ do { \ - SDL_Log("ABORT: %s @ %s:%d", __FUNCTION__, __FILE__, __LINE__); \ + SDL_Log("ABORT: %s @ %s:%i", __FUNCTION__, __FILE__, __LINE__); \ abort(); \ } while (0) #define ASSERT(x) \ if (!(x)) { \ - SDL_Log("Assertion failed in %s:%d: %s", __FILE__, __LINE__, #x); \ + SDL_Log("Assertion failed in %s:%i: %s", __FILE__, __LINE__, #x); \ abort(); \ } diff --git a/test/lighting_test.cpp b/test/lighting_test.cpp index d778f6aa5..38aef6266 100644 --- a/test/lighting_test.cpp +++ b/test/lighting_test.cpp @@ -19,7 +19,7 @@ TEST(Lighting, CrawlTables) for (unsigned i = (uint8_t)CrawlTable[cr - 1]; i > 0; i--, cr += 2) { int dx = x + CrawlTable[cr]; int dy = y + CrawlTable[cr + 1]; - sprintf(tempstr, "location %d:%d added twice.", dx - 20, dy - 20); + sprintf(tempstr, "location %i:%i added twice.", dx - 20, dy - 20); EXPECT_EQ(added[dx][dy], false) << tempstr; added[dx][dy] = true; } @@ -31,7 +31,7 @@ TEST(Lighting, CrawlTables) continue; if ((i == -18 && j == -18) || (i == -18 && j == 18) || (i == 18 && j == -18) || (i == 18 && j == 18)) continue; // Limit of the crawl table rage - sprintf(tempstr, "while checking location %d:%d.", i, j); + sprintf(tempstr, "while checking location %i:%i.", i, j); EXPECT_EQ(false, true) << tempstr; } }