Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More dependency untangling #7630

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ jobs:
- name: Formatting Check (Source)
uses: jidicula/[email protected]
with:
clang-format-version: '13'
clang-format-version: '18'
check-path: 'Source'
fallback-style: 'webkit'

- name: Formatting Check (test)
uses: jidicula/[email protected]
with:
clang-format-version: '13'
clang-format-version: '18'
check-path: 'test'
fallback-style: 'webkit'
1 change: 1 addition & 0 deletions Source/DiabloUI/diabloui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "engine/render/clx_render.hpp"
#include "engine/ticks.hpp"
#include "hwcursor.hpp"
#include "init.h"
#include "utils/algorithm/container.hpp"
#include "utils/display.h"
#include "utils/is_of.hpp"
Expand Down
2 changes: 2 additions & 0 deletions Source/DiabloUI/dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#include "engine/load_clx.hpp"
#include "engine/load_pcx.hpp"
#include "engine/palette.h"
#include "headless_mode.hpp"
#include "hwcursor.hpp"
#include "init.h"
#include "utils/display.h"
#include "utils/is_of.hpp"
#include "utils/language.h"
Expand Down
7 changes: 4 additions & 3 deletions Source/DiabloUI/hero/selhero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "DiabloUI/selyesno.h"
#include "control.h"
#include "controls/plrctrls.h"
#include "engine/assets.hpp"
#include "game_mode.hpp"
#include "menu.h"
#include "options.h"
Expand Down Expand Up @@ -161,10 +162,10 @@ void SelheroListSelect(size_t value)
vecSelHeroDlgItems.push_back(std::make_unique<UiListItem>(_("Sorcerer"), static_cast<int>(HeroClass::Sorcerer)));
if (gbIsHellfire) {
vecSelHeroDlgItems.push_back(std::make_unique<UiListItem>(_("Monk"), static_cast<int>(HeroClass::Monk)));
if (gbBard || *sgOptions.Gameplay.testBard) {
if (HaveBardAssets() || *sgOptions.Gameplay.testBard) {
vecSelHeroDlgItems.push_back(std::make_unique<UiListItem>(_("Bard"), static_cast<int>(HeroClass::Bard)));
}
if (gbBarbarian || *sgOptions.Gameplay.testBarbarian) {
if (HaveBarbarianAssets() || *sgOptions.Gameplay.testBarbarian) {
vecSelHeroDlgItems.push_back(std::make_unique<UiListItem>(_("Barbarian"), static_cast<int>(HeroClass::Barbarian)));
}
}
Expand Down Expand Up @@ -263,7 +264,7 @@ void AddSelHeroBackground()
void SelheroClassSelectorSelect(size_t value)
{
auto hClass = static_cast<HeroClass>(vecSelHeroDlgItems[value]->m_value);
if (gbIsSpawn && (hClass == HeroClass::Rogue || hClass == HeroClass::Sorcerer || (hClass == HeroClass::Bard && !gbBard))) {
if (gbIsSpawn && (hClass == HeroClass::Rogue || hClass == HeroClass::Sorcerer || (hClass == HeroClass::Bard && !HaveBardAssets()))) {
RemoveSelHeroBackground();
UiSelOkDialog(nullptr, _("The Rogue and Sorcerer are only available in the full retail version of Diablo. Visit https://www.gog.com/game/diablo to purchase.").data(), false);
AddSelHeroBackground();
Expand Down
1 change: 1 addition & 0 deletions Source/DiabloUI/mainmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "DiabloUI/diabloui.h"
#include "DiabloUI/selok.h"
#include "control.h"
#include "engine/assets.hpp"
#include "engine/load_clx.hpp"
#include "game_mode.hpp"
#include "utils/language.h"
Expand Down
2 changes: 2 additions & 0 deletions Source/DiabloUI/settingsmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <cstdint>
#include <optional>
#include <vector>

#include <function_ref.hpp>

Expand All @@ -11,6 +12,7 @@
#include "controls/controller_motion.h"
#include "controls/plrctrls.h"
#include "controls/remap_keyboard.h"
#include "engine/assets.hpp"
#include "engine/render/text_render.hpp"
#include "hwcursor.hpp"
#include "options.h"
Expand Down
6 changes: 3 additions & 3 deletions Source/appfat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ void FreeDlg()
SNetDestroy();
}

[[noreturn]] void DisplayFatalErrorAndExit(std::string_view title, std::string_view body)
} // namespace

void DisplayFatalErrorAndExit(std::string_view title, std::string_view body)
{
FreeDlg();
UiErrorOkDialog(title, body);
diablo_quit(1);
}

} // namespace

void app_fatal(std::string_view str)
{
DisplayFatalErrorAndExit(_("Error"), str);
Expand Down
7 changes: 7 additions & 0 deletions Source/appfat.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ namespace devilution {
#define assert(exp) (void)((exp) || (assert_fail(__LINE__, __FILE__, #exp), 0))
#endif

/**
* @brief Terminates the game and displays an error message box.
* @param str Message box title.
* @param str Error message.
*/
[[noreturn]] void DisplayFatalErrorAndExit(std::string_view title, std::string_view body);

/**
* @brief Terminates the game and displays an error message box.
* @param str Error message.
Expand Down
2 changes: 1 addition & 1 deletion Source/capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ SDL_RWops *CaptureFile(std::string *dstPath)
const std::tm *tm = std::localtime(&tt);
const std::string filename = tm != nullptr
? fmt::format("Screenshot from {:04}-{:02}-{:02} {:02}-{:02}-{:02}",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec)
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec)
: "Screenshot";
*dstPath = StrCat(paths::PrefPath(), filename, ext);
int i = 0;
Expand Down
1 change: 0 additions & 1 deletion Source/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "engine/trn.hpp"
#include "gamemenu.h"
#include "headless_mode.hpp"
#include "init.h"
#include "inv.h"
#include "inv_iterators.hpp"
#include "levels/setmaps.h"
Expand Down
3 changes: 1 addition & 2 deletions Source/diablo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <config.h>

#include "DiabloUI/selstart.h"
#include "appfat.h"
#include "automap.h"
#include "capture.h"
#include "control.h"
Expand Down Expand Up @@ -124,8 +125,6 @@ bool gbProcessPlayers;
bool gbLoadGame;
bool cineflag;
int PauseMode;
bool gbBard;
bool gbBarbarian;
clicktype sgbMouseDown;
uint16_t gnTickDelay = 50;
char gszProductName[64] = "DevilutionX vUnknown";
Expand Down
8 changes: 6 additions & 2 deletions Source/diablo.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

#include <cstdint>

#include <SDL.h>

#ifdef USE_SDL1
#include "utils/sdl2_to_1_2_backports.h"
#endif

#ifdef _DEBUG
#include "monstdat.h"
#endif
Expand Down Expand Up @@ -69,8 +75,6 @@ extern bool cineflag;
/* These are defined in fonts.h */
extern void FontsCleanup();
extern DVL_API_FOR_TEST int PauseMode;
extern bool gbBard;
extern bool gbBarbarian;
extern clicktype sgbMouseDown;
extern uint16_t gnTickDelay;
extern char gszProductName[64];
Expand Down
2 changes: 1 addition & 1 deletion Source/discord/discord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <fmt/format.h>

#include "config.h"
#include "init.h"
#include "game_mode.hpp"
#include "levels/gendung.h"
#include "levels/setmaps.h"
#include "multi.h"
Expand Down
1 change: 1 addition & 0 deletions Source/dvlnet/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "appfat.h"
#include "dvlnet/abstract_net.h"
#include "utils/attributes.h"
#include "utils/endian_read.hpp"
#include "utils/endian_write.hpp"
#include "utils/str_cat.hpp"
#include "utils/stubs.h"
Expand Down
2 changes: 1 addition & 1 deletion Source/effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "engine/sound.h"
#include "engine/sound_defs.hpp"
#include "engine/sound_position.hpp"
#include "init.h"
#include "game_mode.hpp"
#include "player.h"
#include "utils/is_of.hpp"

Expand Down
Loading
Loading