From 790f42d0785b3522f98a55e1d7fdd97c2eeb883a Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 27 Jun 2021 01:06:00 +0200 Subject: [PATCH] Clang-tidy: readability-inconsistent-declaration-parameter-name --- Source/DiabloUI/diabloui.h | 2 +- Source/DiabloUI/text_draw.h | 4 ++-- Source/DiabloUI/ttf_render_wrapped.h | 2 +- Source/controls/axis_direction.h | 2 +- Source/controls/controller_motion.h | 2 +- Source/controls/devices/game_controller.h | 6 +++--- Source/controls/devices/joystick.h | 6 +++--- Source/controls/touch.h | 2 +- Source/drlg_l1.h | 2 +- Source/drlg_l2.h | 4 ++-- Source/dvlnet/base.cpp | 12 ++++++------ Source/dvlnet/base.h | 2 +- Source/dvlnet/packet.h | 4 ++-- Source/dvlnet/tcp_client.h | 2 +- Source/dvlnet/tcp_server.h | 2 +- Source/inv.cpp | 6 +++--- Source/items.h | 2 +- Source/miniwin/miniwin.h | 2 +- Source/msg.h | 2 +- Source/objects.h | 2 +- Source/player.cpp | 10 +++++----- Source/utils/soundsample.h | 2 +- 22 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Source/DiabloUI/diabloui.h b/Source/DiabloUI/diabloui.h index e18d91796..d7af23600 100644 --- a/Source/DiabloUI/diabloui.h +++ b/Source/DiabloUI/diabloui.h @@ -118,7 +118,7 @@ void UiFocusNavigationSelect(); void UiFocusNavigationEsc(); void UiFocusNavigationYesNo(); void UiInitList(int count, void (*fnFocus)(int value), void (*fnSelect)(int value), void (*fnEsc)(), const std::vector &items, bool wraps = false, bool (*fnYesNo)() = NULL); -void UiInitScrollBar(UiScrollBar *ui_sb, std::size_t viewport_size, const std::size_t *current_offset); +void UiInitScrollBar(UiScrollBar *uiSb, std::size_t viewportSize, const std::size_t *currentOffset); void UiClearScreen(); void UiPollAndRender(); void UiRenderItems(const std::vector &items); diff --git a/Source/DiabloUI/text_draw.h b/Source/DiabloUI/text_draw.h index a437628d4..40e26b581 100644 --- a/Source/DiabloUI/text_draw.h +++ b/Source/DiabloUI/text_draw.h @@ -12,8 +12,8 @@ struct TtfSurfaceCache { }; void DrawTTF(const char *text, const SDL_Rect &rect, int flags, - const SDL_Color &text_color, const SDL_Color &shadow_color, - TtfSurfaceCache &render_cache); + const SDL_Color &textColor, const SDL_Color &shadowColor, + TtfSurfaceCache &renderCache); void DrawArtStr(const char *text, const SDL_Rect &rect, int flags, bool drawTextCursor = false); diff --git a/Source/DiabloUI/ttf_render_wrapped.h b/Source/DiabloUI/ttf_render_wrapped.h index 71f2a36a1..023c69e7c 100644 --- a/Source/DiabloUI/ttf_render_wrapped.h +++ b/Source/DiabloUI/ttf_render_wrapped.h @@ -18,6 +18,6 @@ enum TextAlignment : uint8_t { * This method is slow. Caching the result is recommended. */ SDL_Surface *RenderUTF8_Solid_Wrapped( - TTF_Font *font, const char *text, SDL_Color fg, Uint32 wrapLength, const int x_align = TextAlignment_BEGIN); + TTF_Font *font, const char *text, SDL_Color fg, Uint32 wrapLength, const int xAlign = TextAlignment_BEGIN); } // namespace devilution diff --git a/Source/controls/axis_direction.h b/Source/controls/axis_direction.h index f73f64d32..296d592ed 100644 --- a/Source/controls/axis_direction.h +++ b/Source/controls/axis_direction.h @@ -37,7 +37,7 @@ public: { } - AxisDirection Get(AxisDirection axis_direction); + AxisDirection Get(AxisDirection axisDirection); private: int last_left_; diff --git a/Source/controls/controller_motion.h b/Source/controls/controller_motion.h index 67010e75e..46748a554 100644 --- a/Source/controls/controller_motion.h +++ b/Source/controls/controller_motion.h @@ -22,6 +22,6 @@ extern bool leftStickNeedsScaling, rightStickNeedsScaling; bool ProcessControllerMotion(const SDL_Event &event, ControllerButtonEvent ctrlEvent); // Returns direction of the left thumb stick or DPad (if allow_dpad = true). -AxisDirection GetLeftStickOrDpadDirection(bool allow_dpad = true); +AxisDirection GetLeftStickOrDpadDirection(bool allowDpad = true); } // namespace devilution diff --git a/Source/controls/devices/game_controller.h b/Source/controls/devices/game_controller.h index 17340fc8e..7ccb48048 100644 --- a/Source/controls/devices/game_controller.h +++ b/Source/controls/devices/game_controller.h @@ -14,9 +14,9 @@ class GameController { static std::vector *const controllers_; public: - static void Add(int joystick_index); - static void Remove(SDL_JoystickID instance_id); - static GameController *Get(SDL_JoystickID instance_id); + static void Add(int joystickIndex); + static void Remove(SDL_JoystickID instanceId); + static GameController *Get(SDL_JoystickID instanceId); static GameController *Get(const SDL_Event &event); static const std::vector &All(); static bool IsPressedOnAnyController(ControllerButton button); diff --git a/Source/controls/devices/joystick.h b/Source/controls/devices/joystick.h index 7776525c9..ab8e3df6d 100644 --- a/Source/controls/devices/joystick.h +++ b/Source/controls/devices/joystick.h @@ -18,9 +18,9 @@ class Joystick { static std::vector *const joysticks_; public: - static void Add(int device_index); - static void Remove(SDL_JoystickID instance_id); - static Joystick *Get(SDL_JoystickID instance_id); + static void Add(int deviceIndex); + static void Remove(SDL_JoystickID instanceId); + static Joystick *Get(SDL_JoystickID instanceId); static Joystick *Get(const SDL_Event &event); static const std::vector &All(); static bool IsPressedOnAnyJoystick(ControllerButton button); diff --git a/Source/controls/touch.h b/Source/controls/touch.h index 1fe090e72..b621c5916 100644 --- a/Source/controls/touch.h +++ b/Source/controls/touch.h @@ -5,7 +5,7 @@ namespace devilution { #ifndef USE_SDL1 -void handle_touch(SDL_Event *event, int current_mouse_x, int current_mouse_y); +void handle_touch(SDL_Event *event, int currentMouseX, int currentMouseY); #endif } // namespace devilution diff --git a/Source/drlg_l1.h b/Source/drlg_l1.h index e72800015..72a43b91b 100644 --- a/Source/drlg_l1.h +++ b/Source/drlg_l1.h @@ -22,7 +22,7 @@ extern int UberDiabloMonsterIndex; void DRLG_LPass3(int lv); void DRLG_Init_Globals(); void LoadL1Dungeon(const char *path, int vx, int vy); -void LoadPreL1Dungeon(const char *sFileName); +void LoadPreL1Dungeon(const char *path); void CreateL5Dungeon(uint32_t rseed, lvl_entry entry); void drlg_l1_set_crypt_room(int rx1, int ry1); void drlg_l1_set_corner_room(int rx1, int ry1); diff --git a/Source/drlg_l2.h b/Source/drlg_l2.h index b12d31d7e..d77b33e10 100644 --- a/Source/drlg_l2.h +++ b/Source/drlg_l2.h @@ -28,8 +28,8 @@ struct ROOMNODE { extern BYTE predungeon[DMAXX][DMAXY]; void InitDungeon(); -void LoadL2Dungeon(const char *sFileName, int vx, int vy); -void LoadPreL2Dungeon(const char *sFileName); +void LoadL2Dungeon(const char *path, int vx, int vy); +void LoadPreL2Dungeon(const char *path); void CreateL2Dungeon(uint32_t rseed, lvl_entry entry); } // namespace devilution diff --git a/Source/dvlnet/base.cpp b/Source/dvlnet/base.cpp index a419356a0..e7e55c38e 100644 --- a/Source/dvlnet/base.cpp +++ b/Source/dvlnet/base.cpp @@ -119,20 +119,20 @@ bool base::SNetReceiveMessage(int *sender, char **data, int *size) return true; } -bool base::SNetSendMessage(int playerID, void *data, unsigned int size) +bool base::SNetSendMessage(int playerId, void *data, unsigned int size) { - if (playerID != SNPLAYER_ALL && playerID != SNPLAYER_OTHERS - && (playerID < 0 || playerID >= MAX_PLRS)) + if (playerId != SNPLAYER_ALL && playerId != SNPLAYER_OTHERS + && (playerId < 0 || playerId >= MAX_PLRS)) abort(); auto *rawMessage = reinterpret_cast(data); buffer_t message(rawMessage, rawMessage + size); - if (playerID == plr_self || playerID == SNPLAYER_ALL) + if (playerId == plr_self || playerId == SNPLAYER_ALL) message_queue.emplace_back(plr_self, message); plr_t dest; - if (playerID == SNPLAYER_ALL || playerID == SNPLAYER_OTHERS) + if (playerId == SNPLAYER_ALL || playerId == SNPLAYER_OTHERS) dest = PLR_BROADCAST; else - dest = playerID; + dest = playerId; if (dest != plr_self) { auto pkt = pktfty->make_packet(plr_self, dest, message); send(*pkt); diff --git a/Source/dvlnet/base.h b/Source/dvlnet/base.h index b61560ab1..cc0305696 100644 --- a/Source/dvlnet/base.h +++ b/Source/dvlnet/base.h @@ -18,7 +18,7 @@ public: virtual int join(std::string addrstr, std::string passwd) = 0; virtual bool SNetReceiveMessage(int *sender, char **data, int *size); - virtual bool SNetSendMessage(int dest, void *data, unsigned int size); + virtual bool SNetSendMessage(int playerId, void *data, unsigned int size); virtual bool SNetReceiveTurns(char **data, unsigned int *size, DWORD *status); virtual bool SNetSendTurn(char *data, unsigned int size); diff --git a/Source/dvlnet/packet.h b/Source/dvlnet/packet.h index 5e27eeabc..bae2522ab 100644 --- a/Source/dvlnet/packet.h +++ b/Source/dvlnet/packet.h @@ -29,7 +29,7 @@ enum packet_type : uint8_t { }; // Returns NULL for an invalid packet type. -const char *packet_type_to_string(uint8_t packet_type); +const char *packet_type_to_string(uint8_t packetType); typedef uint8_t plr_t; typedef uint32_t cookie_t; @@ -55,7 +55,7 @@ public: class wrong_packet_type_exception : public packet_exception { public: - wrong_packet_type_exception(std::initializer_list expected_types, std::uint8_t actual); + wrong_packet_type_exception(std::initializer_list expectedTypes, std::uint8_t actual); const char *what() const throw() override { diff --git a/Source/dvlnet/tcp_client.h b/Source/dvlnet/tcp_client.h index a5f8815b3..61ffbbd42 100644 --- a/Source/dvlnet/tcp_client.h +++ b/Source/dvlnet/tcp_client.h @@ -38,7 +38,7 @@ private: asio::ip::tcp::socket sock = asio::ip::tcp::socket(ioc); std::unique_ptr local_server; // must be declared *after* ioc - void handle_recv(const asio::error_code &error, size_t bytes_read); + void handle_recv(const asio::error_code &error, size_t bytesRead); void start_recv(); void handle_send(const asio::error_code &error, size_t bytes_sent); }; diff --git a/Source/dvlnet/tcp_server.h b/Source/dvlnet/tcp_server.h index 470657908..d6ee8b744 100644 --- a/Source/dvlnet/tcp_server.h +++ b/Source/dvlnet/tcp_server.h @@ -63,7 +63,7 @@ private: void start_accept(); void handle_accept(const scc &con, const asio::error_code &ec); void start_recv(const scc &con); - void handle_recv(const scc &con, const asio::error_code &ec, size_t bytes_read); + void handle_recv(const scc &con, const asio::error_code &ec, size_t bytesRead); void handle_recv_newplr(const scc &con, packet &pkt); void handle_recv_packet(packet &pkt); void send_connect(const scc &con); diff --git a/Source/inv.cpp b/Source/inv.cpp index aeaf58bf3..6bb7128bb 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -559,20 +559,20 @@ bool AutoEquip(int playerId, const ItemStruct &item, inv_body_loc bodyLocation, /** * @brief Automatically attempts to equip the specified item in the most appropriate location in the player's body. * @note On success, this will broadcast an equipment_change event to let other players know about the equipment change. - * @param playerNumber The player number whose inventory will be checked for compatibility with the item. + * @param playerId The player number whose inventory will be checked for compatibility with the item. * @param item The item to equip. * @param persistItem Indicates whether or not the item should be persisted in the player's body. Pass 'False' to check * whether the player can equip the item but you don't want the item to actually be equipped. 'True' by default. * @return 'True' if the item was equipped and 'False' otherwise. */ -bool AutoEquip(int playerNumber, const ItemStruct &item, bool persistItem) +bool AutoEquip(int playerId, const ItemStruct &item, bool persistItem) { if (!CanEquip(item)) { return false; } for (int bodyLocation = INVLOC_HEAD; bodyLocation < NUM_INVLOC; bodyLocation++) { - if (AutoEquip(playerNumber, item, (inv_body_loc)bodyLocation, persistItem)) { + if (AutoEquip(playerId, item, (inv_body_loc)bodyLocation, persistItem)) { return true; } } diff --git a/Source/items.h b/Source/items.h index a9b5ba8b6..28e37017f 100644 --- a/Source/items.h +++ b/Source/items.h @@ -465,7 +465,7 @@ void RecalcStoreStats(); int ItemNoFlippy(); void CreateSpellBook(Point position, spell_id ispell, bool sendmsg, bool delta); void CreateMagicArmor(Point position, int imisc, int icurs, bool sendmsg, bool delta); -void CreateAmulet(Point position, int curlv, bool sendmsg, bool delta); +void CreateAmulet(Point position, int lvl, bool sendmsg, bool delta); void CreateMagicWeapon(Point position, int imisc, int icurs, bool sendmsg, bool delta); bool GetItemRecord(int nSeed, uint16_t wCI, int nIndex); void SetItemRecord(int nSeed, uint16_t wCI, int nIndex); diff --git a/Source/miniwin/miniwin.h b/Source/miniwin/miniwin.h index d8d69fd20..223e483c9 100644 --- a/Source/miniwin/miniwin.h +++ b/Source/miniwin/miniwin.h @@ -45,7 +45,7 @@ bool FetchMessage(tagMSG *lpMsg); bool TranslateMessage(const tagMSG *lpMsg); void PushMessage(const tagMSG *lpMsg); -bool PostMessage(uint32_t Msg, int32_t wParam, int32_t lParam); +bool PostMessage(uint32_t type, int32_t wParam, int32_t lParam); #ifdef _MSC_VER #define strcasecmp _stricmp diff --git a/Source/msg.h b/Source/msg.h index b41e640b3..422148179 100644 --- a/Source/msg.h +++ b/Source/msg.h @@ -449,7 +449,7 @@ void NetSendCmdChItem(bool bHiPri, BYTE bLoc); void NetSendCmdDelItem(bool bHiPri, BYTE bLoc); void NetSendCmdDItem(bool bHiPri, int ii); void NetSendCmdDamage(bool bHiPri, uint8_t bPlr, DWORD dwDam); -void NetSendCmdMonDmg(bool bHiPri, uint16_t bMon, DWORD dwDam); +void NetSendCmdMonDmg(bool bHiPri, uint16_t wMon, DWORD dwDam); void NetSendCmdString(uint32_t pmask, const char *pszStr); void delta_close_portal(int pnum); DWORD ParseCmd(int pnum, TCmd *pCmd); diff --git a/Source/objects.h b/Source/objects.h index 59b34ff1e..cb822b2c4 100644 --- a/Source/objects.h +++ b/Source/objects.h @@ -66,7 +66,7 @@ void GetRndObjLoc(int randarea, int *xx, int *yy); void AddMushPatch(); void AddSlainHero(); void objects_44D8C5(_object_id ot, int v2, int ox, int oy); -void objects_44DA68(int a1, int a2); +void objects_44DA68(int i, int a2); void objects_454AF0(int a1, int a2, int a3); void AddObject(_object_id ot, int ox, int oy); void Obj_Trap(int i); diff --git a/Source/player.cpp b/Source/player.cpp index 29f4d6dde..e1db6112f 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -849,12 +849,12 @@ void SetPlrAnims(PlayerStruct &player) /** * @param c The hero class. */ -void CreatePlayer(int pnum, HeroClass c) +void CreatePlayer(int playerId, HeroClass c) { - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("CreatePlayer: illegal player %i", pnum); + if ((DWORD)playerId >= MAX_PLRS) { + app_fatal("CreatePlayer: illegal player %i", playerId); } - auto &player = plr[pnum]; + auto &player = plr[playerId]; player.Reset(); SetRndSeed(SDL_GetTicks()); @@ -1010,7 +1010,7 @@ void CreatePlayer(int pnum, HeroClass c) player.wReflections = 0; InitDungMsgs(player); - CreatePlrItems(pnum); + CreatePlrItems(playerId); SetRndSeed(0); } diff --git a/Source/utils/soundsample.h b/Source/utils/soundsample.h index 54571c4b9..f389977e7 100644 --- a/Source/utils/soundsample.h +++ b/Source/utils/soundsample.h @@ -43,7 +43,7 @@ public: * @param dwBytes Length of buffer * @return 0 on success, -1 otherwise */ - int SetChunk(ArraySharedPtr file_data, std::size_t dwBytes); + int SetChunk(ArraySharedPtr fileData, std::size_t dwBytes); #endif #ifndef STREAM_ALL_AUDIO