Skip to content

Commit

Permalink
Don't include fmt.h in text_types.h
Browse files Browse the repository at this point in the history
  • Loading branch information
edo9300 committed Sep 6, 2024
1 parent 958641d commit 7f03e20
Show file tree
Hide file tree
Showing 38 changed files with 64 additions and 13 deletions.
1 change: 1 addition & 0 deletions gframe/Android/COSAndroidOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ static inline int android_get_device_api_level() {
#endif
#include "COSAndroidOperator.h"
#include "porting_android.h"
#include "../fmt.h"

namespace irr {

Expand Down
9 changes: 5 additions & 4 deletions gframe/CGUISkinSystem/CGUISkinSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <string>
#include <set>
#include "../utils.h"
#include "../fmt.h"

using namespace irr;

Expand Down Expand Up @@ -119,7 +120,7 @@ gui::CImageGUISkin* CGUISkinSystem::loadSkinFromFile(const fschar_t *skinname) {
// is to make the registry write out the root node and see what comes out.
//registry->writeFile("Skin",".");

// To switch on the fly, we have to set the skin to the fallback skin first
// To switch on the fly, we have to set the skin to the fallback skin first
tmp = registry->getValueAsCStr(L"skin", L"Skin/Properties/Fallback");
// Always default to metalic
fallbackType = gui::EGST_WINDOWS_METALLIC;
Expand Down Expand Up @@ -156,7 +157,7 @@ gui::CImageGUISkin* CGUISkinSystem::loadSkinFromFile(const fschar_t *skinname) {
skinConfig.CheckBoxColor = registry->getValueAsColor(L"Skin/Global/CheckBoxColor");

// If there was no progress bar colors set, set them in the config to the defaults
// otherwise their 0,0,0,0. This is neccicary for the old klagui.
// otherwise their 0,0,0,0. This is neccicary for the old klagui.

if(skinConfig.ProgressBarFilled.Color == 0)
skinConfig.ProgressBarFilled.Color = video::SColor(255, 255, 0, 0);
Expand Down Expand Up @@ -380,10 +381,10 @@ bool CGUISkinSystem::applySkin(const fschar_t *skinname) {
}
device->getGUIEnvironment()->setSkin(skin);
loaded_skin = skin;
// If we're going to switch skin we need to find all the progress bars and overwrite their colors
// If we're going to switch skin we need to find all the progress bars and overwrite their colors
skin->drop();
registry = nullptr;
//fs->changeWorkingDirectoryTo(oldpath);

return true;
}
}
1 change: 1 addition & 0 deletions gframe/CGUITTFont/CGUITTFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <IMeshSceneNode.h>
#include <unordered_set>
#include <climits>
#include "../fmt.h"
#ifdef YGOPRO_USE_BUNDLED_FONT
extern const char* bundled_font_name;
extern const size_t bundled_font_len;
Expand Down
1 change: 1 addition & 0 deletions gframe/address.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "address.h"
#include "bufferio.h"
#include "config.h"
#include "fmt.h"
#if EDOPRO_ANDROID
#include <netinet/in.h>
#endif
Expand Down
1 change: 0 additions & 1 deletion gframe/address.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <cstdint>
#include <string>
#include "fmt.h"
#include "bufferio.h"
#include "text_types.h"

Expand Down
1 change: 1 addition & 0 deletions gframe/bufferio.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef BUFFERIO_H
#define BUFFERIO_H

#include <algorithm>
#include <string>
#include <vector>
#include <cstring>
Expand Down
1 change: 1 addition & 0 deletions gframe/client_card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "data_manager.h"
#include "common.h"
#include "client_card.h"
#include "fmt.h"

namespace ygo {

Expand Down
1 change: 1 addition & 0 deletions gframe/client_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "CGUIImageButton/CGUIImageButton.h"
#include "CGUITTFont/CGUITTFont.h"
#include "custom_skin_enum.h"
#include "fmt.h"

namespace ygo {

Expand Down
1 change: 1 addition & 0 deletions gframe/client_updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "utils.h"
#include "porting.h"
#include "game_config.h"
#include "fmt.h"

#define LOCKFILE EPRO_TEXT("./.edopro_lock")
#define UPDATES_FOLDER EPRO_TEXT("./updates/{}")
Expand Down
1 change: 1 addition & 0 deletions gframe/data_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "utils_gui.h"
#include "deck_manager.h"
#include "logging.h"
#include "fmt.h"
#include "utils.h"
#include "windbot.h"
#include "windbot_panel.h"
Expand Down
1 change: 1 addition & 0 deletions gframe/data_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "utils.h"
#include "common.h"
#include "file_stream.h"
#include "fmt.h"

namespace ygo {

Expand Down
1 change: 1 addition & 0 deletions gframe/deck_con.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "duelclient.h"
#include "single_mode.h"
#include "client_card.h"
#include "fmt.h"

namespace ygo {

Expand Down
1 change: 1 addition & 0 deletions gframe/deck_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "utils.h"
#include "client_card.h"
#include "file_stream.h"
#include "fmt.h"

namespace ygo {
const CardDataC* DeckManager::GetDummyOrMappedCardData(uint32_t code) const {
Expand Down
1 change: 1 addition & 0 deletions gframe/discord_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "logging.h"
#include "config.h"
#include "server_lobby.h"
#include "fmt.h"
#endif
#include "text_types.h"
#include "discord_wrapper.h"
Expand Down
1 change: 1 addition & 0 deletions gframe/drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "CGUIImageButton/CGUIImageButton.h"
#include "custom_skin_enum.h"
#include "image_manager.h"
#include "fmt.h"

namespace ygo {
void Game::DrawSelectionLine(const Materials::QuadVertex vec, bool strip, int width, irr::video::SColor color) {
Expand Down
1 change: 1 addition & 0 deletions gframe/duelclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "progressivebuffer.h"
#include "utils.h"
#include "porting.h"
#include "fmt.h"

#define DEFAULT_DUEL_RULE 5
namespace ygo {
Expand Down
1 change: 1 addition & 0 deletions gframe/event_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "joystick_wrapper.h"
#include "porting.h"
#include "config.h"
#include "fmt.h"

namespace {

Expand Down
16 changes: 16 additions & 0 deletions gframe/fmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ struct fmt::formatter<irr::core::string<CharT, TAlloc>, CharT> {
}
};

namespace epro {
struct Address;
}

template<typename T>
struct fmt::formatter<epro::Address, T> {
template<typename ParseContext>
constexpr auto parse(ParseContext& ctx) const { return ctx.begin(); }

template<typename FormatContext>
auto format(const epro::Address& address, FormatContext& ctx) const {
static constexpr auto format_str = CHAR_T_STRINGVIEW(T, "{}");
return format_to(ctx.out(), format_str, address.format<T>());
}
};

namespace epro {
using fmt::format;
using fmt::sprintf;
Expand Down
1 change: 1 addition & 0 deletions gframe/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "CGUIWindowedTabControl/CGUIWindowedTabControl.h"
#include "file_stream.h"
#include "porting.h"
#include "fmt.h"

#if EDOPRO_ANDROID || EDOPRO_IOS
#include "CGUICustomComboBox/CGUICustomComboBox.h"
Expand Down
1 change: 1 addition & 0 deletions gframe/game_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "config.h"
#include "logging.h"
#include "file_stream.h"
#include "fmt.h"

namespace ygo {

Expand Down
1 change: 1 addition & 0 deletions gframe/gframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "log.h"
#include "joystick_wrapper.h"
#include "utils_gui.h"
#include "fmt.h"
#if EDOPRO_MACOS
#include "osx_menu.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion gframe/iOS/COSiOSOperator.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#import <UIKit/UIPasteboard.h>
#include <sys/utsname.h>
#include <fmt/format.h>
#include "../bufferio.h"
#include "../text_types.h"
#include "../fmt.h"
#include "COSiOSOperator.h"

namespace irr {
Expand Down
1 change: 1 addition & 0 deletions gframe/image_downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "utils.h"
#include "game_config.h"
#include "file_stream.h"
#include "fmt.h"

namespace ygo {

Expand Down
1 change: 1 addition & 0 deletions gframe/image_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "image_downloader.h"
#include "game.h"
#include "config.h"
#include "fmt.h"

#define BASE_PATH EPRO_TEXT("./textures/")

Expand Down
1 change: 1 addition & 0 deletions gframe/logging.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "logging.h"
#include <ctime>
#include "fmt.h"
#include "file_stream.h"

namespace ygo {
Expand Down
1 change: 1 addition & 0 deletions gframe/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define LOGGING_H

#include "text_types.h"
#include "fmt.h"

namespace ygo {

Expand Down
1 change: 1 addition & 0 deletions gframe/menu_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <IGUITable.h>
#include <IGUIWindow.h>
#include "address.h"
#include "fmt.h"

namespace ygo {

Expand Down
1 change: 1 addition & 0 deletions gframe/old_replay_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "duelclient.h"
#include "game.h"
#include "single_mode.h"
#include "fmt.h"

namespace ygo {
bool ReplayMode::ReadReplayResponse() {
Expand Down
1 change: 1 addition & 0 deletions gframe/replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "common.h"
#include "utils.h"
#include "file_stream.h"
#include "fmt.h"

namespace ygo {
void Replay::BeginRecord(bool write, epro::path_string name) {
Expand Down
1 change: 1 addition & 0 deletions gframe/repo_cloner.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "repo_cloner.h"

#include "config.h"
#include "fmt.h"
#include "game_config.h"
#include "porting.h"
#include "repo_manager.h"
Expand Down
1 change: 1 addition & 0 deletions gframe/repo_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "logging.h"
#include "utils.h"
#include "libgit2.hpp"
#include "fmt.h"

static constexpr int MAX_HISTORY_LENGTH = 100;
static constexpr int FETCH_OBJECTS_PERCENTAGE = 60;
Expand Down
1 change: 1 addition & 0 deletions gframe/server_lobby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "custom_skin_enum.h"
#include "game_config.h"
#include "address.h"
#include "fmt.h"

namespace ygo {

Expand Down
3 changes: 2 additions & 1 deletion gframe/single_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "game.h"
#include "core_utils.h"
#include "sound_manager.h"
#include "fmt.h"
#include "CGUIFileSelectListBox/CGUIFileSelectListBox.h"
#include <IrrlichtDevice.h>
#include <IGUIWindow.h>
Expand Down Expand Up @@ -381,7 +382,7 @@ bool SingleMode::SinglePlayAnalyze(CoreUtils::Packet& packet) {
case 203: {
analyze = true;
break;

}
}
if(analyze)
Expand Down
1 change: 1 addition & 0 deletions gframe/sound_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "sound_manager.h"
#include "utils.h"
#include "config.h"
#include "fmt.h"
#if defined(YGOPRO_USE_IRRKLANG)
#include "sound_irrklang.h"
#define BACKEND SoundIrrklang
Expand Down
1 change: 1 addition & 0 deletions gframe/sound_sdlmixer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifdef YGOPRO_USE_SDL_MIXER
#include "sound_sdlmixer.h"
#include "fmt.h"
#define SDL_MAIN_HANDLED
#include <stdexcept>
#include <SDL2/SDL.h>
Expand Down
14 changes: 8 additions & 6 deletions gframe/text_types.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef TEXT_TYPES_H_
#define TEXT_TYPES_H_
#include <string>
#include "fmt.h"
#include <string_view>

// Double macro to convert the macro-defined int to a character literal
#define STR_HELPER(x) #x
Expand All @@ -22,11 +22,13 @@ using wstringview = basic_string_view<wchar_t>;

namespace Detail {
template<typename Char>
constexpr epro::basic_string_view<Char> CHAR_T_STRINGVIEW(epro::stringview, epro::wstringview);
template<>
constexpr epro::stringview CHAR_T_STRINGVIEW(epro::stringview string, epro::wstringview) { return string; }
template<>
constexpr epro::wstringview CHAR_T_STRINGVIEW(epro::stringview, epro::wstringview string) { return string; }
static constexpr inline epro::basic_string_view<Char> CHAR_T_STRINGVIEW(epro::stringview stringview, epro::wstringview wstringview) {
if constexpr(std::is_same_v<Char, wchar_t>) {
return wstringview;
} else {
return stringview;
}
}
}

#define CHAR_T_STRINGVIEW(Char, text) epro::Detail::CHAR_T_STRINGVIEW<Char>(text ""sv, L"" text ""sv)
Expand Down
1 change: 1 addition & 0 deletions gframe/utils_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "game_config.h"
#include "text_types.h"
#include "porting.h"
#include "fmt.h"
#if EDOPRO_WINDOWS
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
Expand Down
1 change: 1 addition & 0 deletions gframe/windbot_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <IGUICheckBox.h>
#include "config.h"
#include "data_manager.h"
#include "fmt.h"

namespace ygo {

Expand Down

0 comments on commit 7f03e20

Please sign in to comment.