Skip to content

Commit f15c40d

Browse files
committedSep 16, 2024·
Header includes cleanup + more std::format
1 parent 475df22 commit f15c40d

File tree

13 files changed

+9
-13
lines changed

13 files changed

+9
-13
lines changed
 

‎game_patch/bmpman/bmpman.h

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include <cassert>
43
#include <xlog/xlog.h>
54
#include "../rf/bmpman.h"
65
#include "../rf/gr/gr.h"

‎game_patch/graphics/d3d11/gr_d3d11_texture.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <cstring>
2+
#include <cassert>
23
#include "gr_d3d11.h"
34
#include "gr_d3d11_texture.h"
45
#include "../../bmpman/bmpman.h"

‎game_patch/graphics/gr.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <algorithm>
22
#include <common/error/d3d-error.h>
3-
#include <common/utils/string-utils.h>
43
#include <common/utils/list-utils.h>
54
#include <common/utils/os-utils.h>
65
#include <common/config/BuildConfig.h>

‎game_patch/hud/hud_status.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "../rf/localize.h"
99
#include <patch_common/FunHook.h>
1010
#include <patch_common/MemUtils.h>
11+
#include <algorithm>
1112

1213
bool g_big_health_armor_hud = false;
1314

‎game_patch/misc/player.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "../multi/multi.h"
1414
#include "../hud/multi_spectate.h"
1515
#include <common/utils/list-utils.h>
16-
#include <common/utils/string-utils.h>
1716
#include <common/config/GameConfig.h>
1817
#include <patch_common/FunHook.h>
1918
#include <patch_common/CallHook.h>

‎game_patch/misc/ui.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <patch_common/FunHook.h>
44
#include <patch_common/CallHook.h>
55
#include <format>
6+
#include <algorithm>
67
#include "../rf/ui.h"
78
#include "../rf/input.h"
89
#include "../rf/misc.h"

‎game_patch/multi/faction_files.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <functional>
77
#include <stdexcept>
88
#include <xlog/xlog.h>
9-
#include <common/utils/string-utils.h>
109
#include "faction_files.h"
1110

1211
static const char level_download_agent_name[] = "Dash Faction";
@@ -55,7 +54,7 @@ std::optional<FactionFilesClient::LevelInfo> FactionFilesClient::parse_level_inf
5554

5655
std::optional<FactionFilesClient::LevelInfo> FactionFilesClient::find_map(const char* file_name)
5756
{
58-
auto url = std::string{level_download_base_url} + "/findmap.php?rflName=" + encode_uri_component(file_name);
57+
auto url = std::format("{}/findmap.php?rflName={}", level_download_base_url, encode_uri_component(file_name));
5958

6059
xlog::trace("Fetching level info: %s", file_name);
6160
HttpRequest req{url, "GET", session_};

‎game_patch/multi/level_download.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -549,15 +549,15 @@ void multi_level_download_do_frame()
549549
unsigned bytes_received = operation.get_bytes_received();
550550
float bytes_per_sec = operation.get_bytes_per_sec();
551551

552-
auto level_name_str = std::string{"Level name: "} + info.name;
552+
auto level_name_str = std::format("Level name: {}", info.name);
553553
int str_w, str_h;
554554
rf::gr::get_string_size(&str_w, &str_h, level_name_str.c_str(), -1, medium_font);
555555
int info_x = center_x - str_w / 2;
556556
int info_spacing = medium_font_h * 3 / 2;
557557
rf::gr::string(info_x, y, level_name_str.c_str(), medium_font);
558558
y += info_spacing;
559559

560-
auto created_by_str = std::string{"Created by: "} + info.author;
560+
auto created_by_str = std::format("Created by: {}", info.author);
561561
rf::gr::string(info_x, y, created_by_str.c_str(), medium_font);
562562
y += info_spacing;
563563

@@ -570,7 +570,7 @@ void multi_level_download_do_frame()
570570
if (bytes_per_sec > 0) {
571571
int remaining_size = info.size_in_bytes - bytes_received;
572572
int secs_left = static_cast<int>(remaining_size / bytes_per_sec);
573-
auto time_left_str = std::to_string(secs_left) + " seconds left";
573+
auto time_left_str = std::format("{} seconds left", secs_left);
574574
rf::gr::string(info_x, y, time_left_str.c_str(), medium_font);
575575
}
576576

‎game_patch/multi/votes.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ struct VoteLevel : public Vote
245245

246246
bool process_vote_arg([[maybe_unused]] std::string_view arg, rf::Player* source) override
247247
{
248-
m_level_name = std::string{arg} + ".rfl";
248+
m_level_name = std::format("{}.rfl", arg);
249249
if (!rf::get_file_checksum(m_level_name.c_str())) {
250250
send_chat_line_packet("Cannot find specified level!", source);
251251
return false;

‎game_patch/purefaction/pf.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <cstddef>
22
#include <cstring>
3-
#include <sstream>
43
#include <cassert>
54
#include <common/config/BuildConfig.h>
65
#include <common/utils/list-utils.h>

‎game_patch/rf/os/console.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22

3+
#include <common/utils/string-utils.h>
34
#include <patch_common/MemUtils.h>
45
#include <memory>
5-
#include <common/utils/string-utils.h>
66
#include "string.h" // NOLINT(modernize-deprecated-headers)
77
#include "../gr/gr.h"
88

‎game_patch/rf/os/string.h

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <cstring>
44
#include <format>
55
#include <utility>
6-
#include <common/utils/string-utils.h>
76

87
namespace rf
98
{

‎launcher/stdafx.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
#include <string>
2020
#include <set>
2121
#include <vector>
22-
#include <sstream>
2322
#include <thread>

0 commit comments

Comments
 (0)
Please sign in to comment.