6 changed files with 30 additions and 89 deletions
@ -1,18 +1,23 @@
|
||||
if(NOT DEVILUTIONX_SYSTEM_LIBFMT) |
||||
include(FetchContent_MakeAvailableExcludeFromAll) |
||||
include(FetchContent_MakeAvailableExcludeFromAll) |
||||
|
||||
if(NOT WIN32 AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) |
||||
# Enable POSIX extensions such as `readlink` and `ftruncate`. |
||||
add_definitions(-D_POSIX_C_SOURCE=200809L) |
||||
# Defining _POSIX_C_SOURCE should be enough for the compiler not to define __STRICT_ANSI__ |
||||
# but some still do, so we also have to explicitly undefine it. |
||||
add_compile_options(-U__STRICT_ANSI__) |
||||
endif() |
||||
|
||||
if(DEVILUTIONX_STATIC_LIBFMT) |
||||
set(BUILD_SHARED_LIBS OFF) |
||||
else() |
||||
set(BUILD_SHARED_LIBS ON) |
||||
endif() |
||||
include(FetchContent) |
||||
FetchContent_Declare(fmt |
||||
URL https://github.com/fmtlib/fmt/archive/7bdf0628b1276379886c7f6dda2cef2b3b374f0b.zip |
||||
URL_HASH MD5=70e0a0beda4bdac7debe60d380e1d802 |
||||
) |
||||
FetchContent_MakeAvailableExcludeFromAll(fmt) |
||||
set(fmt_SOURCE_DIR ${fmt_SOURCE_DIR} PARENT_SCOPE) |
||||
if(DEVILUTIONX_STATIC_LIBFMT) |
||||
set(BUILD_SHARED_LIBS OFF) |
||||
else() |
||||
set(BUILD_SHARED_LIBS ON) |
||||
endif() |
||||
include(FetchContent) |
||||
FetchContent_Declare(fmt |
||||
URL https://github.com/fmtlib/fmt/archive/7bdf0628b1276379886c7f6dda2cef2b3b374f0b.zip |
||||
URL_HASH MD5=70e0a0beda4bdac7debe60d380e1d802 |
||||
) |
||||
FetchContent_MakeAvailableExcludeFromAll(fmt) |
||||
|
||||
set(fmt_INCLUDE_DIR ${fmt_SOURCE_DIR} PARENT_SCOPE) |
||||
|
||||
@ -1,57 +0,0 @@
|
||||
#pragma once |
||||
|
||||
#include "../player.h" |
||||
|
||||
#include <fmt/format.h> |
||||
|
||||
namespace fmt { |
||||
|
||||
template <> |
||||
struct formatter<devilution::PLR_MODE> : formatter<string_view> { |
||||
template <typename FormatContext> |
||||
auto format(devilution::PLR_MODE mode, FormatContext &ctx) |
||||
{ |
||||
string_view name = "unknown"; |
||||
switch (mode) { |
||||
case devilution::PM_STAND: |
||||
name = "stand"; |
||||
break; |
||||
case devilution::PM_WALK: |
||||
name = "walk (N, NW, or NE)"; |
||||
break; |
||||
case devilution::PM_WALK2: |
||||
name = "walk (S, SW, or SE)"; |
||||
break; |
||||
case devilution::PM_WALK3: |
||||
name = "walk (W or E)"; |
||||
break; |
||||
case devilution::PM_ATTACK: |
||||
name = "attack"; |
||||
break; |
||||
case devilution::PM_RATTACK: |
||||
name = "ranged attack"; |
||||
break; |
||||
case devilution::PM_BLOCK: |
||||
name = "block"; |
||||
break; |
||||
case devilution::PM_GOTHIT: |
||||
name = "got hit"; |
||||
break; |
||||
case devilution::PM_DEATH: |
||||
name = "death"; |
||||
break; |
||||
case devilution::PM_SPELL: |
||||
name = "spell"; |
||||
break; |
||||
case devilution::PM_NEWLVL: |
||||
name = "new level"; |
||||
break; |
||||
case devilution::PM_QUIT: |
||||
name = "quit"; |
||||
break; |
||||
} |
||||
return formatter<string_view>::format(name, ctx); |
||||
} |
||||
}; |
||||
|
||||
} |
||||
Loading…
Reference in new issue