From d024f79b0e12e179e21100910957bf6ba809621d Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 21 Apr 2021 12:08:11 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20performance-unnecessary-value-pa?= =?UTF-8?q?ram?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/DiabloUI/art_draw.cpp | 2 +- Source/DiabloUI/art_draw.h | 2 +- Source/DiabloUI/diabloui.cpp | 6 ++--- Source/DiabloUI/diabloui.h | 6 ++--- Source/DiabloUI/dialogs.cpp | 10 +++++--- Source/DiabloUI/dialogs.h | 2 +- Source/controls/modifier_hints.cpp | 8 +++--- Source/controls/modifier_hints.h | 2 +- Source/doom.cpp | 2 +- Source/doom.h | 2 +- Source/dvlnet/tcp_server.cpp | 25 ++++++++++--------- Source/dvlnet/tcp_server.h | 22 ++++++++-------- Source/engine.cpp | 24 +++++++++--------- Source/engine.h | 24 +++++++++--------- Source/error.cpp | 2 +- Source/error.h | 2 +- Source/gmenu.cpp | 8 +++--- Source/gmenu.h | 4 +-- Source/help.cpp | 4 +-- Source/help.h | 2 +- Source/inv.cpp | 4 +-- Source/inv.h | 4 +-- Source/items.cpp | 6 ++--- Source/items.h | 2 +- Source/minitext.cpp | 4 +-- Source/minitext.h | 4 +-- Source/plrmsg.cpp | 4 +-- Source/plrmsg.h | 2 +- Source/qol.cpp | 2 +- Source/qol.h | 2 +- Source/quests.cpp | 4 +-- Source/quests.h | 2 +- Source/scrollrt.cpp | 40 +++++++++++++++--------------- Source/scrollrt.h | 2 +- Source/stores.cpp | 8 +++--- Source/stores.h | 4 +-- Source/storm/storm_net.cpp | 3 ++- 37 files changed, 130 insertions(+), 126 deletions(-) diff --git a/Source/DiabloUI/art_draw.cpp b/Source/DiabloUI/art_draw.cpp index fc3cf4f7c..9e411b378 100644 --- a/Source/DiabloUI/art_draw.cpp +++ b/Source/DiabloUI/art_draw.cpp @@ -37,7 +37,7 @@ void DrawArt(Sint16 screenX, Sint16 screenY, Art *art, int nFrame, Uint16 srcW, ErrSdl(); } -void DrawArt(CelOutputBuffer out, Sint16 screenX, Sint16 screenY, Art *art, int nFrame, Uint16 srcW, Uint16 srcH) +void DrawArt(const CelOutputBuffer &out, Sint16 screenX, Sint16 screenY, Art *art, int nFrame, Uint16 srcW, Uint16 srcH) { if (screenY >= gnScreenHeight || screenX >= gnScreenWidth || art->surface == nullptr) return; diff --git a/Source/DiabloUI/art_draw.h b/Source/DiabloUI/art_draw.h index 7fc69571e..cc894cdfc 100644 --- a/Source/DiabloUI/art_draw.h +++ b/Source/DiabloUI/art_draw.h @@ -6,7 +6,7 @@ namespace devilution { void DrawArt(Sint16 screenX, Sint16 screenY, Art *art, int nFrame = 0, Uint16 srcW = 0, Uint16 srcH = 0); -void DrawArt(CelOutputBuffer out, Sint16 screenX, Sint16 screenY, Art *art, int nFrame = 0, Uint16 srcW = 0, Uint16 srcH = 0); +void DrawArt(const CelOutputBuffer &out, Sint16 screenX, Sint16 screenY, Art *art, int nFrame = 0, Uint16 srcW = 0, Uint16 srcH = 0); void DrawAnimatedArt(Art *art, int screenX, int screenY); diff --git a/Source/DiabloUI/diabloui.cpp b/Source/DiabloUI/diabloui.cpp index 75c2f93c3..b90e264ec 100644 --- a/Source/DiabloUI/diabloui.cpp +++ b/Source/DiabloUI/diabloui.cpp @@ -74,7 +74,7 @@ struct scrollBarState { } // namespace -void UiInitList(int count, void (*fnFocus)(int value), void (*fnSelect)(int value), void (*fnEsc)(), std::vector items, bool itemsWraps, bool (*fnYesNo)()) +void UiInitList(int count, void (*fnFocus)(int value), void (*fnSelect)(int value), void (*fnEsc)(), const std::vector &items, bool itemsWraps, bool (*fnYesNo)()) { SelectedItem = 0; SelectedItemMax = std::max(count - 1, 0); @@ -916,13 +916,13 @@ void LoadPalInMem(const SDL_Color *pPal) } } -void UiRenderItems(std::vector items) +void UiRenderItems(const std::vector &items) { for (auto &item : items) RenderItem(item); } -bool UiItemMouseEvents(SDL_Event *event, std::vector items) +bool UiItemMouseEvents(SDL_Event *event, const std::vector &items) { if (items.size() == 0) { return false; diff --git a/Source/DiabloUI/diabloui.h b/Source/DiabloUI/diabloui.h index f874def68..fdc1ea58f 100644 --- a/Source/DiabloUI/diabloui.h +++ b/Source/DiabloUI/diabloui.h @@ -119,7 +119,7 @@ int UiSelectProvider(GameData *gameData); void UiSetupPlayerInfo(char *infostr, _uiheroinfo *pInfo, Uint32 type); void UiFadeIn(); void UiHandleEvents(SDL_Event *event); -bool UiItemMouseEvents(SDL_Event *event, std::vector items); +bool UiItemMouseEvents(SDL_Event *event, const std::vector &items); Sint16 GetCenterOffset(Sint16 w, Sint16 bw = 0); void LoadPalInMem(const SDL_Color *pPal); void DrawMouse(); @@ -129,11 +129,11 @@ void UiAddLogo(std::vector *vecDialog, int size = LOGO_MED, int y void UiFocusNavigationSelect(); void UiFocusNavigationEsc(); void UiFocusNavigationYesNo(); -void UiInitList(int count, void (*fnFocus)(int value), void (*fnSelect)(int value), void (*fnEsc)(), std::vector items, bool wraps = false, bool (*fnYesNo)() = NULL); +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 UiClearScreen(); void UiPollAndRender(); -void UiRenderItems(std::vector items); +void UiRenderItems(const std::vector &items); void UiInitList_clear(); void mainmenu_restart_repintro(); diff --git a/Source/DiabloUI/dialogs.cpp b/Source/DiabloUI/dialogs.cpp index aaff61a36..062dae8e7 100644 --- a/Source/DiabloUI/dialogs.cpp +++ b/Source/DiabloUI/dialogs.cpp @@ -1,5 +1,7 @@ #include "DiabloUI/dialogs.h" +#include + #include "DiabloUI/button.h" #include "DiabloUI/diabloui.h" #include "DiabloUI/errorart.h" @@ -216,7 +218,7 @@ void Deinit() vecOkDialog.clear(); } -void DialogLoop(std::vector items, std::vector renderBehind) +void DialogLoop(const std::vector &items, const std::vector &renderBehind) { SDL_Event event; dialogEnd = false; @@ -254,7 +256,7 @@ void DialogLoop(std::vector items, std::vector rende } // namespace -void UiOkDialog(const char *text, const char *caption, bool error, std::vector renderBehind) +void UiOkDialog(const char *text, const char *caption, bool error, const std::vector &renderBehind) { static bool inDialog = false; @@ -283,7 +285,7 @@ void UiOkDialog(const char *text, const char *caption, bool error, std::vector renderBehind) { - UiOkDialog(text, caption, /*error=*/true, renderBehind); + UiOkDialog(text, caption, /*error=*/true, std::move(renderBehind)); } void UiErrorOkDialog(const char *text, const char *caption, bool error) @@ -293,7 +295,7 @@ void UiErrorOkDialog(const char *text, const char *caption, bool error) void UiErrorOkDialog(const char *text, std::vector renderBehind) { - UiErrorOkDialog(text, nullptr, renderBehind); + UiErrorOkDialog(text, nullptr, std::move(renderBehind)); } } // namespace devilution diff --git a/Source/DiabloUI/dialogs.h b/Source/DiabloUI/dialogs.h index b0400decd..b5a3df012 100644 --- a/Source/DiabloUI/dialogs.h +++ b/Source/DiabloUI/dialogs.h @@ -8,6 +8,6 @@ namespace devilution { void UiErrorOkDialog(const char *text, std::vector renderBehind); void UiErrorOkDialog(const char *text, const char *caption, std::vector renderBehind); -void UiOkDialog(const char *text, const char *caption, bool error, std::vector renderBehind); +void UiOkDialog(const char *text, const char *caption, bool error, const std::vector &renderBehind); } // namespace devilution diff --git a/Source/controls/modifier_hints.cpp b/Source/controls/modifier_hints.cpp index a79ab64ef..8f9c2aa1f 100644 --- a/Source/controls/modifier_hints.cpp +++ b/Source/controls/modifier_hints.cpp @@ -93,7 +93,7 @@ text_color CircleMenuHintTextColor(bool active) return active ? COL_BLUE : COL_GOLD; } -void DrawCircleMenuHint(CelOutputBuffer out, const CircleMenuHint &hint, int x, int y) +void DrawCircleMenuHint(const CelOutputBuffer &out, const CircleMenuHint &hint, int x, int y) { const int kLineHeight = 25; PrintGameStr(out, x + hint.x_mid - hint.top_w / 2, y, hint.top, CircleMenuHintTextColor(IsTopActive(hint))); @@ -109,7 +109,7 @@ void DrawCircleMenuHint(CelOutputBuffer out, const CircleMenuHint &hint, int x, const int kCircleMarginX = 16; const int kCirclesTop = 76; -void DrawStartModifierMenu(CelOutputBuffer out) +void DrawStartModifierMenu(const CelOutputBuffer &out) { if (!start_modifier_active) return; @@ -119,7 +119,7 @@ void DrawStartModifierMenu(CelOutputBuffer out) DrawCircleMenuHint(out, kButtons, PANEL_LEFT + PANEL_WIDTH - kButtons.width() - kCircleMarginX, PANEL_TOP - kCirclesTop); } -void DrawSelectModifierMenu(CelOutputBuffer out) +void DrawSelectModifierMenu(const CelOutputBuffer &out) { if (!select_modifier_active) return; @@ -133,7 +133,7 @@ void DrawSelectModifierMenu(CelOutputBuffer out) } // namespace -void DrawControllerModifierHints(CelOutputBuffer out) +void DrawControllerModifierHints(const CelOutputBuffer &out) { DrawStartModifierMenu(out); DrawSelectModifierMenu(out); diff --git a/Source/controls/modifier_hints.h b/Source/controls/modifier_hints.h index a5815f5cd..bf9376834 100644 --- a/Source/controls/modifier_hints.h +++ b/Source/controls/modifier_hints.h @@ -4,6 +4,6 @@ namespace devilution { -void DrawControllerModifierHints(CelOutputBuffer out); +void DrawControllerModifierHints(const CelOutputBuffer &out); } // namespace devilution diff --git a/Source/doom.cpp b/Source/doom.cpp index d0ec778cc..0755f7d5d 100644 --- a/Source/doom.cpp +++ b/Source/doom.cpp @@ -88,7 +88,7 @@ void doom_close() doom_cleanup(); } -void doom_draw(CelOutputBuffer out) +void doom_draw(const CelOutputBuffer &out) { if (!doomflag) { return; diff --git a/Source/doom.h b/Source/doom.h index 1a0e41cc7..e1d41cf66 100644 --- a/Source/doom.h +++ b/Source/doom.h @@ -15,6 +15,6 @@ extern int DoomQuestState; int doom_get_frame_from_time(); void doom_init(); void doom_close(); -void doom_draw(CelOutputBuffer out); +void doom_draw(const CelOutputBuffer &out); } // namespace devilution diff --git a/Source/dvlnet/tcp_server.cpp b/Source/dvlnet/tcp_server.cpp index b81246e2c..9b46fb6cf 100644 --- a/Source/dvlnet/tcp_server.cpp +++ b/Source/dvlnet/tcp_server.cpp @@ -3,15 +3,16 @@ #include #include #include +#include #include "dvlnet/base.h" namespace devilution::net { -tcp_server::tcp_server(asio::io_context &ioc, std::string bindaddr, +tcp_server::tcp_server(asio::io_context &ioc, const std::string &bindaddr, unsigned short port, std::string pw) : ioc(ioc) - , pktfty(pw) + , pktfty(std::move(pw)) { auto addr = asio::ip::address::from_string(bindaddr); auto ep = asio::ip::tcp::endpoint(addr, port); @@ -54,7 +55,7 @@ bool tcp_server::empty() return true; } -void tcp_server::start_recv(scc con) +void tcp_server::start_recv(const scc &con) { con->socket.async_receive(asio::buffer(con->recv_buffer), std::bind(&tcp_server::handle_recv, this, con, @@ -62,7 +63,7 @@ void tcp_server::start_recv(scc con) std::placeholders::_2)); } -void tcp_server::handle_recv(scc con, const asio::error_code &ec, +void tcp_server::handle_recv(const scc &con, const asio::error_code &ec, size_t bytes_read) { if (ec || bytes_read == 0) { @@ -90,14 +91,14 @@ void tcp_server::handle_recv(scc con, const asio::error_code &ec, start_recv(con); } -void tcp_server::send_connect(scc con) +void tcp_server::send_connect(const scc &con) { auto pkt = pktfty.make_packet(PLR_MASTER, PLR_BROADCAST, con->plr); send_packet(*pkt); } -void tcp_server::handle_recv_newplr(scc con, packet &pkt) +void tcp_server::handle_recv_newplr(const scc &con, packet &pkt) { auto newplr = next_free(); if (newplr == PLR_BROADCAST) @@ -133,7 +134,7 @@ void tcp_server::send_packet(packet &pkt) } } -void tcp_server::start_send(scc con, packet &pkt) +void tcp_server::start_send(const scc &con, packet &pkt) { const auto *frame = new buffer_t(frame_queue::make_frame(pkt.data())); auto buf = asio::buffer(*frame); @@ -144,7 +145,7 @@ void tcp_server::start_send(scc con, packet &pkt) }); } -void tcp_server::handle_send(scc con, const asio::error_code &ec, +void tcp_server::handle_send(const scc &con, const asio::error_code &ec, size_t bytes_sent) { // empty for now @@ -159,7 +160,7 @@ void tcp_server::start_accept() std::placeholders::_1)); } -void tcp_server::handle_accept(scc con, const asio::error_code &ec) +void tcp_server::handle_accept(const scc &con, const asio::error_code &ec) { if (ec) return; @@ -175,14 +176,14 @@ void tcp_server::handle_accept(scc con, const asio::error_code &ec) start_accept(); } -void tcp_server::start_timeout(scc con) +void tcp_server::start_timeout(const scc &con) { con->timer.expires_after(std::chrono::seconds(1)); con->timer.async_wait(std::bind(&tcp_server::handle_timeout, this, con, std::placeholders::_1)); } -void tcp_server::handle_timeout(scc con, const asio::error_code &ec) +void tcp_server::handle_timeout(const scc &con, const asio::error_code &ec) { if (ec) { drop_connection(con); @@ -199,7 +200,7 @@ void tcp_server::handle_timeout(scc con, const asio::error_code &ec) start_timeout(con); } -void tcp_server::drop_connection(scc con) +void tcp_server::drop_connection(const scc &con) { if (con->plr != PLR_BROADCAST) { auto pkt = pktfty.make_packet(PLR_MASTER, PLR_BROADCAST, diff --git a/Source/dvlnet/tcp_server.h b/Source/dvlnet/tcp_server.h index b9a355860..470657908 100644 --- a/Source/dvlnet/tcp_server.h +++ b/Source/dvlnet/tcp_server.h @@ -25,7 +25,7 @@ public: class tcp_server { public: - tcp_server(asio::io_context &ioc, std::string bindaddr, + tcp_server(asio::io_context &ioc, const std::string &bindaddr, unsigned short port, std::string pw); std::string localhost_self(); void close(); @@ -61,18 +61,18 @@ private: plr_t next_free(); bool empty(); void start_accept(); - void handle_accept(scc con, const asio::error_code &ec); - void start_recv(scc con); - void handle_recv(scc con, const asio::error_code &ec, size_t bytes_read); - void handle_recv_newplr(scc con, packet &pkt); + 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_newplr(const scc &con, packet &pkt); void handle_recv_packet(packet &pkt); - void send_connect(scc con); + void send_connect(const scc &con); void send_packet(packet &pkt); - void start_send(scc con, packet &pkt); - void handle_send(scc con, const asio::error_code &ec, size_t bytes_sent); - void start_timeout(scc con); - void handle_timeout(scc con, const asio::error_code &ec); - void drop_connection(scc con); + void start_send(const scc &con, packet &pkt); + void handle_send(const scc &con, const asio::error_code &ec, size_t bytes_sent); + void start_timeout(const scc &con); + void handle_timeout(const scc &con, const asio::error_code &ec); + void drop_connection(const scc &con); }; } //namespace net diff --git a/Source/engine.cpp b/Source/engine.cpp index d9056ba7d..22c06d68f 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -33,7 +33,7 @@ const Uint32 RndInc = 1; */ const Uint32 RndMult = 0x015A4E35; -void CelDrawTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) +void CelDrawTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) { int nDataSize; BYTE *pRLEBytes; @@ -43,7 +43,7 @@ void CelDrawTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, in CelBlitSafeTo(out, sx, sy, pRLEBytes, nDataSize, nWidth); } -void CelClippedDrawTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) +void CelClippedDrawTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) { BYTE *pRLEBytes; int nDataSize; @@ -55,7 +55,7 @@ void CelClippedDrawTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int n CelBlitSafeTo(out, sx, sy, pRLEBytes, nDataSize, nWidth); } -void CelDrawLightTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, BYTE *tbl) +void CelDrawLightTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, BYTE *tbl) { int nDataSize; BYTE *pRLEBytes; @@ -70,7 +70,7 @@ void CelDrawLightTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCe CelBlitSafeTo(out, sx, sy, pRLEBytes, nDataSize, nWidth); } -void CelClippedDrawLightTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) +void CelClippedDrawLightTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) { int nDataSize; BYTE *pRLEBytes; @@ -158,7 +158,7 @@ void CelBlitSafeTo(CelOutputBuffer out, int sx, int sy, BYTE *pRLEBytes, int nDa } } -void CelClippedDrawSafeTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) +void CelClippedDrawSafeTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) { BYTE *pRLEBytes; int nDataSize; @@ -365,7 +365,7 @@ static void CelBlitLightBlendedSafeTo(CelOutputBuffer out, int sx, int sy, BYTE } } -void CelClippedBlitLightTransTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) +void CelClippedBlitLightTransTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) { int nDataSize; BYTE *pRLEBytes; @@ -516,14 +516,14 @@ void CelBlitOutlineTo(CelOutputBuffer out, BYTE col, int sx, int sy, BYTE *pCelB } } -void SetPixel(CelOutputBuffer out, int sx, int sy, BYTE col) +void SetPixel(const CelOutputBuffer &out, int sx, int sy, BYTE col) { if (!out.in_bounds(sx, sy)) return; *out.at(sx, sy) = col; } -void DrawLineTo(CelOutputBuffer out, int x0, int y0, int x1, int y1, BYTE color_index) +void DrawLineTo(const CelOutputBuffer &out, int x0, int y0, int x1, int y1, BYTE color_index) { int i, dx, dy, steps; float ix, iy, sx, sy; @@ -566,7 +566,7 @@ static void DrawHalfTransparentStippledRectTo(CelOutputBuffer out, int sx, int s } } -void DrawHalfTransparentRectTo(CelOutputBuffer out, int sx, int sy, int width, int height) +void DrawHalfTransparentRectTo(const CelOutputBuffer &out, int sx, int sy, int width, int height) { if (sgOptions.Graphics.bBlendedTransparancy) { DrawHalfTransparentBlendedRectTo(out, sx, sy, width, height); @@ -1009,7 +1009,7 @@ static void Cl2BlitLightSafe(CelOutputBuffer out, int sx, int sy, BYTE *pRLEByte } } -void Cl2Draw(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) +void Cl2Draw(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) { BYTE *pRLEBytes; int nDataSize; @@ -1036,7 +1036,7 @@ void Cl2DrawOutline(CelOutputBuffer out, BYTE col, int sx, int sy, BYTE *pCelBuf Cl2BlitOutlineSafe(out, sx, sy, pRLEBytes, nDataSize, nWidth, col); } -void Cl2DrawLightTbl(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, char light) +void Cl2DrawLightTbl(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, char light) { int nDataSize, idx; BYTE *pRLEBytes; @@ -1055,7 +1055,7 @@ void Cl2DrawLightTbl(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nC Cl2BlitLightSafe(out, sx, sy, pRLEBytes, nDataSize, nWidth, &pLightTbl[idx]); } -void Cl2DrawLight(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) +void Cl2DrawLight(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) { int nDataSize; BYTE *pRLEBytes; diff --git a/Source/engine.h b/Source/engine.h index 195c0af15..8c4f9e27c 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -223,7 +223,7 @@ struct CelOutputBuffer { * @param nCel CEL frame number * @param nWidth Width of sprite */ -void CelDrawTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); +void CelDrawTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); /** * @briefBlit CEL sprite to the given buffer, does not perform bounds-checking. @@ -245,7 +245,7 @@ void CelDrawUnsafeTo(CelOutputBuffer out, int x, int y, BYTE *pCelBuff, int nCel * @param nCel CEL frame number * @param nWidth Width of sprite */ -void CelClippedDrawTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); +void CelClippedDrawTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); /** * @brief Blit CEL sprite, and apply lighting, to the back buffer at the given coordinates @@ -256,7 +256,7 @@ void CelClippedDrawTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int n * @param nCel CEL frame number * @param nWidth Width of sprite */ -void CelDrawLightTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, BYTE *tbl); +void CelDrawLightTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, BYTE *tbl); /** * @brief Same as CelDrawLightTo but with the option to skip parts of the top and bottom of the sprite @@ -267,7 +267,7 @@ void CelDrawLightTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCe * @param nCel CEL frame number * @param nWidth Width of sprite */ -void CelClippedDrawLightTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); +void CelClippedDrawLightTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); /** * @brief Same as CelBlitLightTransSafeTo @@ -278,7 +278,7 @@ void CelClippedDrawLightTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, * @param nCel CEL frame number * @param nWidth Width of sprite */ -void CelClippedBlitLightTransTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); +void CelClippedBlitLightTransTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); /** * @brief Blit CEL sprite, and apply lighting, to the back buffer at the given coordinates, translated to a red hue @@ -312,7 +312,7 @@ void CelBlitSafeTo(CelOutputBuffer out, int sx, int sy, BYTE *pRLEBytes, int nDa * @param nCel CEL frame number * @param nWidth Width of sprite */ -void CelClippedDrawSafeTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); +void CelClippedDrawSafeTo(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); /** * @brief Blit CEL sprite, and apply lighting, to the given buffer, checks for drawing outside the buffer @@ -369,7 +369,7 @@ void CelBlitOutlineTo(CelOutputBuffer out, BYTE col, int sx, int sy, BYTE *pCelB * @param sy Target buffer coordinate * @param col Color index from current palette */ -void SetPixel(CelOutputBuffer out, int sx, int sy, BYTE col); +void SetPixel(const CelOutputBuffer &out, int sx, int sy, BYTE col); /** * @brief Blit CL2 sprite, to the back buffer at the given coordianates @@ -380,7 +380,7 @@ void SetPixel(CelOutputBuffer out, int sx, int sy, BYTE col); * @param nCel CL2 frame number * @param nWidth Width of sprite */ -void Cl2Draw(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); +void Cl2Draw(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); /** * @brief Blit a solid colder shape one pixel larger then the given sprite shape, to the given buffer at the given coordianates @@ -404,7 +404,7 @@ void Cl2DrawOutline(CelOutputBuffer out, BYTE col, int sx, int sy, BYTE *pCelBuf * @param nWidth Width of sprite * @param light Light shade to use */ -void Cl2DrawLightTbl(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, char light); +void Cl2DrawLightTbl(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, char light); /** * @brief Blit CL2 sprite, and apply lighting, to the given buffer at the given coordinates @@ -415,7 +415,7 @@ void Cl2DrawLightTbl(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nC * @param nCel CL2 frame number * @param nWidth Width of sprite */ -void Cl2DrawLight(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); +void Cl2DrawLight(const CelOutputBuffer &out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth); /** * @brief Draw a line in the target buffer @@ -426,7 +426,7 @@ void Cl2DrawLight(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, * @param y1 Back buffer coordinate * @param color_index Color index from current palette */ -void DrawLineTo(CelOutputBuffer out, int x0, int y0, int x1, int y1, BYTE color_index); +void DrawLineTo(const CelOutputBuffer &out, int x0, int y0, int x1, int y1, BYTE color_index); /** * Draws a half-transparent rectangle by blacking out odd pixels on odd lines, @@ -439,7 +439,7 @@ void DrawLineTo(CelOutputBuffer out, int x0, int y0, int x1, int y1, BYTE color_ * @param width Rectangle width * @param height Rectangle height */ -void DrawHalfTransparentRectTo(CelOutputBuffer out, int sx, int sy, int width, int height); +void DrawHalfTransparentRectTo(const CelOutputBuffer &out, int sx, int sy, int width, int height); /** * @brief Calculate the best fit direction between two points diff --git a/Source/error.cpp b/Source/error.cpp index 4c7bcfb46..51e6cec0c 100644 --- a/Source/error.cpp +++ b/Source/error.cpp @@ -104,7 +104,7 @@ void ClrDiabloMsg() #define DIALOG_Y ((gnScreenHeight - PANEL_HEIGHT) / 2 - 18) -void DrawDiabloMsg(CelOutputBuffer out) +void DrawDiabloMsg(const CelOutputBuffer &out) { int i, len, width, sx, sy; BYTE c; diff --git a/Source/error.h b/Source/error.h index a21f296bc..3c267ca9c 100644 --- a/Source/error.h +++ b/Source/error.h @@ -74,6 +74,6 @@ extern diablo_message msgflag; void InitDiabloMsg(diablo_message e); void ClrDiabloMsg(); -void DrawDiabloMsg(CelOutputBuffer out); +void DrawDiabloMsg(const CelOutputBuffer &out); } // namespace devilution diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 41cdd3a1f..95a62695d 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -54,7 +54,7 @@ const BYTE lfontkern[] = { 11, 10, 12, 11, 21, 23 }; -static void gmenu_print_text(CelOutputBuffer out, int x, int y, const char *pszStr) +static void gmenu_print_text(const CelOutputBuffer &out, int x, int y, const char *pszStr) { BYTE c; @@ -67,7 +67,7 @@ static void gmenu_print_text(CelOutputBuffer out, int x, int y, const char *pszS } } -void gmenu_draw_pause(CelOutputBuffer out) +void gmenu_draw_pause(const CelOutputBuffer &out) { if (currlevel != 0) RedBack(out); @@ -211,7 +211,7 @@ static int gmenu_get_lfont(TMenuItem *pItem) return i - 2; } -static void gmenu_draw_menu_item(CelOutputBuffer out, TMenuItem *pItem, int y) +static void gmenu_draw_menu_item(const CelOutputBuffer &out, TMenuItem *pItem, int y) { DWORD w, x, nSteps, step, pos; w = gmenu_get_lfont(pItem); @@ -245,7 +245,7 @@ static void GameMenuMove() gmenu_up_down(move_dir.y == AxisDirectionY_DOWN); } -void gmenu_draw(CelOutputBuffer out) +void gmenu_draw(const CelOutputBuffer &out) { int y; TMenuItem *i; diff --git a/Source/gmenu.h b/Source/gmenu.h index 31d484644..b4dc81b29 100644 --- a/Source/gmenu.h +++ b/Source/gmenu.h @@ -20,12 +20,12 @@ struct TMenuItem { extern TMenuItem *sgpCurrentMenu; -void gmenu_draw_pause(CelOutputBuffer out); +void gmenu_draw_pause(const CelOutputBuffer &out); void FreeGMenu(); void gmenu_init_menu(); bool gmenu_is_active(); void gmenu_set_items(TMenuItem *pItem, void (*gmFunc)(TMenuItem *)); -void gmenu_draw(CelOutputBuffer out); +void gmenu_draw(const CelOutputBuffer &out); bool gmenu_presskeys(int vkey); bool gmenu_on_mouse_move(); bool gmenu_left_mouse(bool isDown); diff --git a/Source/help.cpp b/Source/help.cpp index 9f5b0bb53..5a82eb6d6 100644 --- a/Source/help.cpp +++ b/Source/help.cpp @@ -457,7 +457,7 @@ void InitHelp() helpflag = false; } -static void DrawHelpLine(CelOutputBuffer out, int x, int y, char *text, text_color color) +static void DrawHelpLine(const CelOutputBuffer &out, int x, int y, char *text, text_color color) { int sx, sy, width; BYTE c; @@ -478,7 +478,7 @@ static void DrawHelpLine(CelOutputBuffer out, int x, int y, char *text, text_col } } -void DrawHelp(CelOutputBuffer out) +void DrawHelp(const CelOutputBuffer &out) { int i, c, w; const char *s; diff --git a/Source/help.h b/Source/help.h index 19a51c09c..cf2b4c569 100644 --- a/Source/help.h +++ b/Source/help.h @@ -12,7 +12,7 @@ namespace devilution { extern bool helpflag; void InitHelp(); -void DrawHelp(CelOutputBuffer out); +void DrawHelp(const CelOutputBuffer &out); void DisplayHelp(); void HelpScrollUp(); void HelpScrollDown(); diff --git a/Source/inv.cpp b/Source/inv.cpp index f273b9204..97a75a16c 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -168,7 +168,7 @@ static void InvDrawSlotBack(CelOutputBuffer out, int X, int Y, int W, int H) } } -void DrawInv(CelOutputBuffer out) +void DrawInv(const CelOutputBuffer &out) { int frame, frame_width, i, j, ii; BYTE *cels; @@ -300,7 +300,7 @@ void DrawInv(CelOutputBuffer out) } } -void DrawInvBelt(CelOutputBuffer out) +void DrawInvBelt(const CelOutputBuffer &out) { int i, frame, frame_width; BYTE fi, ff; diff --git a/Source/inv.h b/Source/inv.h index e444684fb..d4f622862 100644 --- a/Source/inv.h +++ b/Source/inv.h @@ -84,9 +84,9 @@ void InitInv(); /** * @brief Render the inventory panel to the given buffer. */ -void DrawInv(CelOutputBuffer out); +void DrawInv(const CelOutputBuffer &out); -void DrawInvBelt(CelOutputBuffer out); +void DrawInvBelt(const CelOutputBuffer &out); bool AutoEquipEnabled(const PlayerStruct &player, const ItemStruct &item); bool AutoEquip(int playerNumber, const ItemStruct &item, bool persistItem = true); bool AutoPlaceItemInInventory(int playerNumber, const ItemStruct &item, bool persistItem = false); diff --git a/Source/items.cpp b/Source/items.cpp index d2aa04c5f..d14c85d50 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -3823,13 +3823,13 @@ void PrintItemPower(char plidx, ItemStruct *x) } } -static void DrawUTextBack(CelOutputBuffer out) +static void DrawUTextBack(const CelOutputBuffer &out) { CelDrawTo(out, RIGHT_PANEL_X - SPANEL_WIDTH + 24, 327, pSTextBoxCels, 1, 271); DrawHalfTransparentRectTo(out, RIGHT_PANEL_X - SPANEL_WIDTH + 27, 28, 265, 297); } -void PrintUString(CelOutputBuffer out, int x, int y, bool cjustflag, const char *str, text_color col) +void PrintUString(const CelOutputBuffer &out, int x, int y, bool cjustflag, const char *str, text_color col) { int len, width, sx, sy, i, k; BYTE c; @@ -3866,7 +3866,7 @@ static void DrawULine(CelOutputBuffer out, int y) memcpy(dst, src, 267); // BUGFIX: should be 267 (fixed) } -void DrawUniqueInfo(CelOutputBuffer out) +void DrawUniqueInfo(const CelOutputBuffer &out) { int uid, y; diff --git a/Source/items.h b/Source/items.h index 90b5d1d86..660aa25b7 100644 --- a/Source/items.h +++ b/Source/items.h @@ -420,7 +420,7 @@ void DoRepair(int pnum, int cii); void DoRecharge(int pnum, int cii); void DoOil(int pnum, int cii); void PrintItemPower(char plidx, ItemStruct *x); -void DrawUniqueInfo(CelOutputBuffer out); +void DrawUniqueInfo(const CelOutputBuffer &out); void PrintItemDetails(ItemStruct *x); void PrintItemDur(ItemStruct *x); void UseItem(int p, item_misc_id Mid, spell_id spl); diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 13c95363e..94dd11dca 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -250,13 +250,13 @@ void InitQTextMsg(int m) PlaySFX(alltext[m].sfxnr); } -void DrawQTextBack(CelOutputBuffer out) +void DrawQTextBack(const CelOutputBuffer &out) { CelDrawTo(out, PANEL_X + 24, 327 + UI_OFFSET_Y, pTextBoxCels, 1, 591); DrawHalfTransparentRectTo(out, PANEL_X + 27, UI_OFFSET_Y + 28, 585, 297); } -void DrawQText(CelOutputBuffer out) +void DrawQText(const CelOutputBuffer &out) { DrawQTextBack(out); DrawQTextContent(); diff --git a/Source/minitext.h b/Source/minitext.h index 35fedb2a0..a06a8923f 100644 --- a/Source/minitext.h +++ b/Source/minitext.h @@ -18,11 +18,11 @@ void InitQTextMsg(int m); /** * @brief Draw the quest dialog window decoration and background. */ -void DrawQTextBack(CelOutputBuffer out); +void DrawQTextBack(const CelOutputBuffer &out); /** * @brief Draw the quest dialog window text. */ -void DrawQText(CelOutputBuffer out); +void DrawQText(const CelOutputBuffer &out); } // namespace devilution diff --git a/Source/plrmsg.cpp b/Source/plrmsg.cpp index ab1b5ce0e..7376573ce 100644 --- a/Source/plrmsg.cpp +++ b/Source/plrmsg.cpp @@ -89,7 +89,7 @@ void InitPlrMsg() plr_msg_slot = 0; } -static void PrintPlrMsg(CelOutputBuffer out, DWORD x, DWORD y, DWORD width, const char *str, text_color col) +static void PrintPlrMsg(const CelOutputBuffer &out, DWORD x, DWORD y, DWORD width, const char *str, text_color col) { int line = 0; @@ -130,7 +130,7 @@ static void PrintPlrMsg(CelOutputBuffer out, DWORD x, DWORD y, DWORD width, cons } } -void DrawPlrMsg(CelOutputBuffer out) +void DrawPlrMsg(const CelOutputBuffer &out) { int i; DWORD x = 10; diff --git a/Source/plrmsg.h b/Source/plrmsg.h index 2e086458d..dd76a513b 100644 --- a/Source/plrmsg.h +++ b/Source/plrmsg.h @@ -21,6 +21,6 @@ size_t EventPlrMsg(const char *pszFmt, ...); void SendPlrMsg(int pnum, const char *pszStr); void ClearPlrMsg(); void InitPlrMsg(); -void DrawPlrMsg(CelOutputBuffer out); +void DrawPlrMsg(const CelOutputBuffer &out); } // namespace devilution diff --git a/Source/qol.cpp b/Source/qol.cpp index 126e665a4..8b3d30898 100644 --- a/Source/qol.cpp +++ b/Source/qol.cpp @@ -68,7 +68,7 @@ void InitQol() InitXPBar(); } -void DrawMonsterHealthBar(CelOutputBuffer out) +void DrawMonsterHealthBar(const CelOutputBuffer &out) { if (!sgOptions.Gameplay.bEnemyHealthBar) return; diff --git a/Source/qol.h b/Source/qol.h index 64736bd42..c8617bec5 100644 --- a/Source/qol.h +++ b/Source/qol.h @@ -11,7 +11,7 @@ namespace devilution { void FreeQol(); void InitQol(); -void DrawMonsterHealthBar(CelOutputBuffer out); +void DrawMonsterHealthBar(const CelOutputBuffer &out); void AutoGoldPickup(int pnum); } // namespace devilution diff --git a/Source/quests.cpp b/Source/quests.cpp index a98e3fb36..3ebfdba3e 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -728,7 +728,7 @@ void ResyncQuests() } } -static void PrintQLString(CelOutputBuffer out, int x, int y, bool cjustflag, const char *str, text_color col) +static void PrintQLString(const CelOutputBuffer &out, int x, int y, bool cjustflag, const char *str, text_color col) { int len, width, i, k, sx, sy; BYTE c; @@ -761,7 +761,7 @@ static void PrintQLString(CelOutputBuffer out, int x, int y, bool cjustflag, con } } -void DrawQuestLog(CelOutputBuffer out) +void DrawQuestLog(const CelOutputBuffer &out) { int y, i; diff --git a/Source/quests.h b/Source/quests.h index f7e698a2f..2258f1f10 100644 --- a/Source/quests.h +++ b/Source/quests.h @@ -85,7 +85,7 @@ void GetReturnLvlPos(); void LoadPWaterPalette(); void ResyncMPQuests(); void ResyncQuests(); -void DrawQuestLog(CelOutputBuffer out); +void DrawQuestLog(const CelOutputBuffer &out); void StartQuestlog(); void QuestlogUp(); void QuestlogDown(); diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 3bc6a5e62..c22f99c45 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -248,7 +248,7 @@ static void scrollrt_draw_cursor_item(CelOutputBuffer out) * @param sy Output buffer coordinate * @param pre Is the sprite in the background */ -void DrawMissilePrivate(CelOutputBuffer out, MissileStruct *m, int sx, int sy, bool pre) +void DrawMissilePrivate(const CelOutputBuffer &out, MissileStruct *m, int sx, int sy, bool pre) { if (m->_miPreFlag != pre || !m->_miDrawFlag) return; @@ -283,7 +283,7 @@ void DrawMissilePrivate(CelOutputBuffer out, MissileStruct *m, int sx, int sy, b * @param sy Output buffer coordinate * @param pre Is the sprite in the background */ -void DrawMissile(CelOutputBuffer out, int x, int y, int sx, int sy, bool pre) +void DrawMissile(const CelOutputBuffer &out, int x, int y, int sx, int sy, bool pre) { int i; MissileStruct *m; @@ -315,7 +315,7 @@ void DrawMissile(CelOutputBuffer out, int x, int y, int sx, int sy, bool pre) * @param my Output buffer coordinate * @param m Id of monster */ -static void DrawMonster(CelOutputBuffer out, int x, int y, int mx, int my, int m) +static void DrawMonster(const CelOutputBuffer &out, int x, int y, int mx, int my, int m) { if (m < 0 || m >= MAXMONSTERS) { SDL_Log("Draw Monster: tried to draw illegal monster %d", m); @@ -370,7 +370,7 @@ static void DrawMonster(CelOutputBuffer out, int x, int y, int mx, int my, int m * @param sy Output buffer coordinate * @param lighting Should lighting be applied */ -static void DrawManaShield(CelOutputBuffer out, int pnum, int x, int y, bool lighting) +static void DrawManaShield(const CelOutputBuffer &out, int pnum, int x, int y, bool lighting) { if (!plr[pnum].pManaShield) return; @@ -405,7 +405,7 @@ static void DrawManaShield(CelOutputBuffer out, int pnum, int x, int y, bool lig * @param nCel frame * @param nWidth width */ -static void DrawPlayer(CelOutputBuffer out, int pnum, int x, int y, int px, int py) +static void DrawPlayer(const CelOutputBuffer &out, int pnum, int x, int y, int px, int py) { if ((dFlags[x][y] & BFLAG_LIT) == 0 && !plr[myplr]._pInfraFlag && leveltype != DTYPE_TOWN) { return; @@ -473,7 +473,7 @@ static void DrawPlayer(CelOutputBuffer out, int pnum, int x, int y, int px, int * @param sx Output buffer coordinate * @param sy Output buffer coordinate */ -void DrawDeadPlayer(CelOutputBuffer out, int x, int y, int sx, int sy) +void DrawDeadPlayer(const CelOutputBuffer &out, int x, int y, int sx, int sy) { int i, px, py; PlayerStruct *p; @@ -500,7 +500,7 @@ void DrawDeadPlayer(CelOutputBuffer out, int x, int y, int sx, int sy) * @param oy Output buffer coordinate * @param pre Is the sprite in the background */ -static void DrawObject(CelOutputBuffer out, int x, int y, int ox, int oy, bool pre) +static void DrawObject(const CelOutputBuffer &out, int x, int y, int ox, int oy, bool pre) { if (dObject[x][y] == 0 || light_table_index >= lightmax) return; @@ -547,7 +547,7 @@ static void DrawObject(CelOutputBuffer out, int x, int y, int ox, int oy, bool p } } -static void scrollrt_draw_dungeon(CelOutputBuffer, int, int, int, int); +static void scrollrt_draw_dungeon(const CelOutputBuffer &, int, int, int, int); /** * @brief Render a cell @@ -557,7 +557,7 @@ static void scrollrt_draw_dungeon(CelOutputBuffer, int, int, int, int); * @param sx Target buffer coordinate * @param sy Target buffer coordinate */ -static void drawCell(CelOutputBuffer out, int x, int y, int sx, int sy) +static void drawCell(const CelOutputBuffer &out, int x, int y, int sx, int sy) { MICROS *pMap = &dpiece_defs_map_2[x][y]; level_piece_id = dPiece[x][y]; @@ -587,7 +587,7 @@ static void drawCell(CelOutputBuffer out, int x, int y, int sx, int sy) * @param sx Target buffer coordinate * @param sy Target buffer coordinate */ -static void drawFloor(CelOutputBuffer out, int x, int y, int sx, int sy) +static void drawFloor(const CelOutputBuffer &out, int x, int y, int sx, int sy) { cel_transparency_active = 0; light_table_index = dLight[x][y]; @@ -613,7 +613,7 @@ static void drawFloor(CelOutputBuffer out, int x, int y, int sx, int sy) * @param sy Output buffer coordinate * @param pre Is the sprite in the background */ -static void DrawItem(CelOutputBuffer out, int x, int y, int sx, int sy, bool pre) +static void DrawItem(const CelOutputBuffer &out, int x, int y, int sx, int sy, bool pre) { int8_t bItem = dItem[x][y]; @@ -653,7 +653,7 @@ static void DrawItem(CelOutputBuffer out, int x, int y, int sx, int sy, bool pre * @param sx Output buffer coordinate * @param sy Output buffer coordinate */ -static void DrawMonsterHelper(CelOutputBuffer out, int x, int y, int oy, int sx, int sy) +static void DrawMonsterHelper(const CelOutputBuffer &out, int x, int y, int oy, int sx, int sy) { int mi, px, py; MonsterStruct *pMonster; @@ -705,7 +705,7 @@ static void DrawMonsterHelper(CelOutputBuffer out, int x, int y, int oy, int sx, * @param sx Output buffer coordinate * @param sy Output buffer coordinate */ -static void DrawPlayerHelper(CelOutputBuffer out, int x, int y, int sx, int sy) +static void DrawPlayerHelper(const CelOutputBuffer &out, int x, int y, int sx, int sy) { int p = dPlayer[x][y]; p = p > 0 ? p - 1 : -(p + 1); @@ -730,7 +730,7 @@ static void DrawPlayerHelper(CelOutputBuffer out, int x, int y, int sx, int sy) * @param dx Target buffer coordinate * @param dy Target buffer coordinate */ -static void scrollrt_draw_dungeon(CelOutputBuffer out, int sx, int sy, int dx, int dy) +static void scrollrt_draw_dungeon(const CelOutputBuffer &out, int sx, int sy, int dx, int dy) { assert((DWORD)sx < MAXDUNX); assert((DWORD)sy < MAXDUNY); @@ -844,7 +844,7 @@ static void scrollrt_draw_dungeon(CelOutputBuffer out, int sx, int sy, int dx, i * @param rows Number of rows * @param columns Tile in a row */ -static void scrollrt_drawFloor(CelOutputBuffer out, int x, int y, int sx, int sy, int rows, int columns) +static void scrollrt_drawFloor(const CelOutputBuffer &out, int x, int y, int sx, int sy, int rows, int columns) { for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { @@ -893,7 +893,7 @@ static void scrollrt_drawFloor(CelOutputBuffer out, int x, int y, int sx, int sy * @param rows Number of rows * @param columns Tile in a row */ -static void scrollrt_draw(CelOutputBuffer out, int x, int y, int sx, int sy, int rows, int columns) +static void scrollrt_draw(const CelOutputBuffer &out, int x, int y, int sx, int sy, int rows, int columns) { // Keep evaluating until MicroTiles can't affect screen rows += MicroTileLen; @@ -1137,7 +1137,7 @@ void CalcViewportGeometry() * @param x Center of view in dPiece coordinate * @param y Center of view in dPiece coordinate */ -static void DrawGame(CelOutputBuffer full_out, int x, int y) +static void DrawGame(const CelOutputBuffer &full_out, int x, int y) { int sx, sy, columns, rows; @@ -1237,9 +1237,9 @@ static void DrawGame(CelOutputBuffer full_out, int x, int y) } // DevilutionX extension. -extern void DrawControllerModifierHints(CelOutputBuffer out); +extern void DrawControllerModifierHints(const CelOutputBuffer &out); -void DrawView(CelOutputBuffer out, int StartX, int StartY) +void DrawView(const CelOutputBuffer &out, int StartX, int StartY) { DrawGame(out, StartX, StartY); if (automapflag) { @@ -1416,7 +1416,7 @@ void EnableFrameCount() /** * @brief Display the current average FPS over 1 sec */ -static void DrawFPS(CelOutputBuffer out) +static void DrawFPS(const CelOutputBuffer &out) { DWORD tc, frames; char String[12]; diff --git a/Source/scrollrt.h b/Source/scrollrt.h index 9eb86b2fc..9ad2e072f 100644 --- a/Source/scrollrt.h +++ b/Source/scrollrt.h @@ -51,7 +51,7 @@ void CalcViewportGeometry(); * @param StartX Center of view in dPiece coordinate * @param StartY Center of view in dPiece coordinate */ -void DrawView(CelOutputBuffer out, int StartX, int StartY); +void DrawView(const CelOutputBuffer &out, int StartX, int StartY); void ClearScreenBuffer(); #ifdef _DEBUG diff --git a/Source/stores.cpp b/Source/stores.cpp index 6979dc2d8..6c65bed70 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -79,13 +79,13 @@ text_color GetItemTextColor(ItemStruct &item) return text_color::COL_WHITE; } -void DrawSTextBack(CelOutputBuffer out) +void DrawSTextBack(const CelOutputBuffer &out) { CelDrawTo(out, PANEL_X + 344, 327 + UI_OFFSET_Y, pSTextBoxCels, 1, 271); DrawHalfTransparentRectTo(out, PANEL_X + 347, UI_OFFSET_Y + 28, 265, 297); } -void DrawSSlider(CelOutputBuffer out, int y1, int y2) +void DrawSSlider(const CelOutputBuffer &out, int y1, int y2) { int yd1, yd2, yd3; @@ -2160,7 +2160,7 @@ void FreeStoreMem() MemFreeDbg(pSTextSlidCels); } -void PrintSString(CelOutputBuffer out, int x, int y, bool cjustflag, const char *str, text_color col, int val) +void PrintSString(const CelOutputBuffer &out, int x, int y, bool cjustflag, const char *str, text_color col, int val) { int len, width, sx, sy, i, k, s; int xx, yy; @@ -2357,7 +2357,7 @@ void StartStore(talk_id s) stextflag = s; } -void DrawSText(CelOutputBuffer out) +void DrawSText(const CelOutputBuffer &out) { int i; diff --git a/Source/stores.h b/Source/stores.h index 90ca6e210..37d588061 100644 --- a/Source/stores.h +++ b/Source/stores.h @@ -98,12 +98,12 @@ void InitStores(); int PentSpn2Spin(); void SetupTownStores(); void FreeStoreMem(); -void PrintSString(CelOutputBuffer out, int x, int y, bool cjustflag, const char *str, text_color col, int val); +void PrintSString(const CelOutputBuffer &out, int x, int y, bool cjustflag, const char *str, text_color col, int val); void DrawSLine(CelOutputBuffer out, int y); void DrawSTextHelp(); void ClearSText(int s, int e); void StartStore(talk_id s); -void DrawSText(CelOutputBuffer out); +void DrawSText(const CelOutputBuffer &out); void STextESC(); void STextUp(); void STextDown(); diff --git a/Source/storm/storm_net.cpp b/Source/storm/storm_net.cpp index 3a59dc8c9..475c8dc22 100644 --- a/Source/storm/storm_net.cpp +++ b/Source/storm/storm_net.cpp @@ -2,6 +2,7 @@ #ifndef NONET #include #include +#include #endif #include "dvlnet/abstract_net.h" @@ -239,7 +240,7 @@ std::vector DvlNet_GetGamelist() void DvlNet_SetPassword(std::string pw) { - dvlnet_inst->setup_password(pw); + dvlnet_inst->setup_password(std::move(pw)); } } // namespace devilution