Skip to content

Commit d9512d7

Browse files
committed
Use fmt instead of string_formatter
1 parent d4fab50 commit d9512d7

39 files changed

+17020
-429
lines changed

msvc-full-features/Cataclysm-lib-vcpkg-static.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@
181181
<Project>{8a533a64-435d-4d4f-9ff0-1e97aace9374}</Project>
182182
<LinkLibraryDependencies>false</LinkLibraryDependencies>
183183
</ProjectReference>
184+
<ProjectReference Include="fmt.vcxproj">
185+
<Project>{f2098959-aad9-4210-a64c-fc4a09a45556}</Project>
186+
<LinkLibraryDependencies>false</LinkLibraryDependencies>
187+
</ProjectReference>
184188
<ProjectReference Include="zstd.vcxproj">
185189
<Project>{f49f14c6-b046-41c7-b707-03366f4b1578}</Project>
186190
<LinkLibraryDependencies>false</LinkLibraryDependencies>

msvc-full-features/Cataclysm-vcpkg-static.sln

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 17
4-
VisualStudioVersion = 17.1.32104.313
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.3.11312.210 d18.3
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{04F55049-F0DE-4AE6-9D10-3DB97DFF2E2F}"
77
ProjectSection(SolutionItems) = preProject
@@ -32,6 +32,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zstd", "zstd.vcxproj", "{F4
3232
EndProject
3333
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zzip", "zzip.vcxproj", "{1232212E-8B83-40E9-B502-F25DBC4DB6CF}"
3434
EndProject
35+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmt", "fmt.vcxproj", "{F2098959-AAD9-4210-A64C-FC4A09A45556}"
36+
EndProject
3537
Global
3638
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3739
Debug|ARM64EC = Debug|ARM64EC
@@ -352,6 +354,42 @@ Global
352354
{1232212E-8B83-40E9-B502-F25DBC4DB6CF}.Release-NoTiles|x64.Build.0 = Release|x64
353355
{1232212E-8B83-40E9-B502-F25DBC4DB6CF}.Release-NoTiles|x86.ActiveCfg = Release|Win32
354356
{1232212E-8B83-40E9-B502-F25DBC4DB6CF}.Release-NoTiles|x86.Build.0 = Release|Win32
357+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug|ARM64EC.ActiveCfg = Debug|ARM64EC
358+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug|ARM64EC.Build.0 = Debug|ARM64EC
359+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug|x64.ActiveCfg = Debug|x64
360+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug|x64.Build.0 = Debug|x64
361+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug|x86.ActiveCfg = Debug|Win32
362+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug|x86.Build.0 = Debug|Win32
363+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug-NoTiles|ARM64EC.ActiveCfg = Debug|ARM64EC
364+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug-NoTiles|ARM64EC.Build.0 = Debug|ARM64EC
365+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug-NoTiles|x64.ActiveCfg = Debug|x64
366+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug-NoTiles|x64.Build.0 = Debug|x64
367+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug-NoTiles|x86.ActiveCfg = Debug|Win32
368+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Debug-NoTiles|x86.Build.0 = Debug|Win32
369+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick|ARM64EC.ActiveCfg = Release|ARM64EC
370+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick|ARM64EC.Build.0 = Release|ARM64EC
371+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick|x64.ActiveCfg = Release|x64
372+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick|x64.Build.0 = Release|x64
373+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick|x86.ActiveCfg = Debug|Win32
374+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick|x86.Build.0 = Debug|Win32
375+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick-NoTiles|ARM64EC.ActiveCfg = Release|ARM64EC
376+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick-NoTiles|ARM64EC.Build.0 = Release|ARM64EC
377+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick-NoTiles|x64.ActiveCfg = Release|x64
378+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick-NoTiles|x64.Build.0 = Release|x64
379+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick-NoTiles|x86.ActiveCfg = Release|Win32
380+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Quick-NoTiles|x86.Build.0 = Release|Win32
381+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release|ARM64EC.ActiveCfg = Release|ARM64EC
382+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release|ARM64EC.Build.0 = Release|ARM64EC
383+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release|x64.ActiveCfg = Release|x64
384+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release|x64.Build.0 = Release|x64
385+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release|x86.ActiveCfg = Release|Win32
386+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release|x86.Build.0 = Release|Win32
387+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release-NoTiles|ARM64EC.ActiveCfg = Release|ARM64EC
388+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release-NoTiles|ARM64EC.Build.0 = Release|ARM64EC
389+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release-NoTiles|x64.ActiveCfg = Release|x64
390+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release-NoTiles|x64.Build.0 = Release|x64
391+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release-NoTiles|x86.ActiveCfg = Release|Win32
392+
{F2098959-AAD9-4210-A64C-FC4A09A45556}.Release-NoTiles|x86.Build.0 = Release|Win32
355393
EndGlobalSection
356394
GlobalSection(SolutionProperties) = preSolution
357395
HideSolutionNode = FALSE

src/bionics.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,8 @@ bool Character::can_uninstall_bionic( const bionic &bio, Character &installer, b
20812081
}
20822082

20832083
if( bio.id->cant_remove_reason.has_value() ) {
2084-
popup( string_format( bio.id->cant_remove_reason.value(), disp_name( true ), disp_name() ) );
2084+
popup( string_format( bio.id->cant_remove_reason.value().translated(), disp_name( true ),
2085+
disp_name() ) );
20852086
return false;
20862087
}
20872088

src/bodypart.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ enum body_part : int {
6464
num_bp
6565
};
6666

67+
inline auto format_as( body_part bp )
68+
{
69+
return static_cast<std::underlying_type_t<body_part>>( bp );
70+
}
71+
6772
template<>
6873
struct enum_traits<body_part> {
6974
static constexpr body_part last = body_part::num_bp;

src/calendar.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ enum moon_phase {
5454
MOON_PHASE_MAX
5555
};
5656

57+
inline auto format_as( moon_phase mp )
58+
{
59+
return static_cast<std::underlying_type_t<moon_phase>>( mp );
60+
}
61+
5762
enum class time_accuracy {
5863
/** No accuracy, no idea what time it is **/
5964
NONE = 0,

src/cata_path.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include <filesystem>
99

10+
#include "string_formatter.h"
11+
1012
/**
1113
* One of the problems of filesystem paths is they lack contextual awareness
1214
* of 'where' they are. They're just a list of segments pointing into the
@@ -162,4 +164,12 @@ class cata_path
162164
}
163165
};
164166

167+
template<>
168+
struct fmt::formatter<cata_path> : formatter<const char *> {
169+
template<typename Ctx>
170+
auto format( const cata_path &p, Ctx &ctx ) const {
171+
return formatter<const char *>::format( p.generic_u8string().c_str(), ctx );
172+
}
173+
};
174+
165175
#endif // CATA_SRC_CATA_PATH_H

src/clothing_mod.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ enum clothing_mod_type : int {
2828
num_clothing_mod_types
2929
};
3030

31+
inline auto format_as( clothing_mod_type cmt )
32+
{
33+
return static_cast<std::underlying_type_t<clothing_mod_type>>( cmt );
34+
}
35+
3136
template<>
3237
struct enum_traits<clothing_mod_type> {
3338
static constexpr clothing_mod_type last = clothing_mod_type::num_clothing_mod_types;

src/color.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,11 @@ enum color_id {
335335
num_colors
336336
};
337337

338+
inline auto format_as( color_id cid )
339+
{
340+
return static_cast<std::underlying_type_t<color_id>>( cid );
341+
}
342+
338343
class cata_path;
339344
class JsonArray;
340345
class JsonOut;

src/coords_fwd.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ enum class scale {
2828
vehicle
2929
};
3030

31+
inline auto format_as( origin o )
32+
{
33+
return static_cast<std::underlying_type_t<origin>>( o );
34+
}
35+
inline auto format_as( scale s )
36+
{
37+
return static_cast<std::underlying_type_t<scale>>( s );
38+
}
39+
3140
constexpr scale ms = scale::map_square;
3241
constexpr scale sm = scale::submap;
3342
constexpr scale omt = scale::overmap_terrain;

src/debug.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ enum debug_filter : int {
286286
DF_LAST // This is always the last entry
287287
};
288288

289+
inline auto format_as( debug_filter df )
290+
{
291+
return static_cast<std::underlying_type_t<debug_filter>>( df );
292+
}
293+
289294
extern std::unordered_set<debug_filter> enabled_filters;
290295
std::string filter_name( debug_filter value );
291296
} // namespace debugmode

0 commit comments

Comments
 (0)