Skip to content

Commit

Permalink
Extract Is{Any,None}Of out of engine.hpp
Browse files Browse the repository at this point in the history
Untangles some of the dependencies
  • Loading branch information
glebm committed Jan 8, 2025
1 parent 19ccf7c commit a49b1f2
Show file tree
Hide file tree
Showing 54 changed files with 72 additions and 14 deletions.
1 change: 1 addition & 0 deletions Source/DiabloUI/credits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "engine/render/text_render.hpp"
#include "hwcursor.hpp"
#include "utils/display.h"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/log.hpp"
#include "utils/sdl_compat.h"
Expand Down
1 change: 1 addition & 0 deletions Source/DiabloUI/diabloui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "hwcursor.hpp"
#include "utils/algorithm/container.hpp"
#include "utils/display.h"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/log.hpp"
#include "utils/pcx_to_clx.hpp"
Expand Down
1 change: 1 addition & 0 deletions Source/DiabloUI/dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "engine/palette.h"
#include "hwcursor.hpp"
#include "utils/display.h"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/log.hpp"

Expand Down
1 change: 1 addition & 0 deletions Source/DiabloUI/progress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "engine/render/clx_render.hpp"
#include "hwcursor.hpp"
#include "utils/display.h"
#include "utils/is_of.hpp"
#include "utils/language.h"

namespace devilution {
Expand Down
1 change: 1 addition & 0 deletions Source/DiabloUI/settingsmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "engine/render/text_render.hpp"
#include "hwcursor.hpp"
#include "options.h"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/utf8.hpp"

Expand Down
1 change: 1 addition & 0 deletions Source/automap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "player.h"
#include "utils/attributes.h"
#include "utils/enum_traits.h"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/ui_fwd.h"
#include "utils/utf8.hpp"
Expand Down
2 changes: 1 addition & 1 deletion Source/automap.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

#include <cstdint>

#include "engine.h"
#include "engine/displacement.hpp"
#include "engine/point.hpp"
#include "engine/surface.hpp"
#include "levels/gendung.h"
#include "utils/attributes.h"

Expand Down
1 change: 1 addition & 0 deletions Source/controls/controller_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "controls/touch/gamepad.h"
#include "engine/demomode.h"
#include "options.h"
#include "utils/is_of.hpp"
#include "utils/log.hpp"

namespace devilution {
Expand Down
1 change: 1 addition & 0 deletions Source/controls/game_controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "panels/spell_list.hpp"
#include "qol/stash.h"
#include "stores.h"
#include "utils/is_of.hpp"

namespace devilution {

Expand Down
1 change: 1 addition & 0 deletions Source/controls/plrctrls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "stores.h"
#include "towners.h"
#include "track.h"
#include "utils/is_of.hpp"
#include "utils/log.hpp"
#include "utils/str_cat.hpp"

Expand Down
1 change: 1 addition & 0 deletions Source/controls/touch/event_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "panels/spell_list.hpp"
#include "qol/stash.h"
#include "stores.h"
#include "utils/is_of.hpp"
#include "utils/ui_fwd.h"

namespace devilution {
Expand Down
1 change: 1 addition & 0 deletions Source/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "towners.h"
#include "track.h"
#include "utils/attributes.h"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/sdl_bilinear_scale.hpp"
#include "utils/surface_to_clx.hpp"
Expand Down
1 change: 1 addition & 0 deletions Source/data/file.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <cstddef>
#include <limits>
#include <memory>
#include <string_view>

Expand Down
2 changes: 1 addition & 1 deletion Source/data/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <algorithm>
#include <string_view>

#include "engine.h" // For IsAnyOf
#include "utils/is_of.hpp"

namespace devilution {

Expand Down
1 change: 1 addition & 0 deletions Source/diablo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
#include "track.h"
#include "utils/console.h"
#include "utils/display.h"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/parse_int.hpp"
#include "utils/paths.h"
Expand Down
1 change: 1 addition & 0 deletions Source/dvlnet/base_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "dvlnet/packet.h"
#include "player.h"
#include "utils/algorithm/container.hpp"
#include "utils/is_of.hpp"
#include "utils/log.hpp"

namespace devilution::net {
Expand Down
1 change: 1 addition & 0 deletions Source/effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "engine/sound_position.hpp"
#include "init.h"
#include "player.h"
#include "utils/is_of.hpp"

namespace devilution {

Expand Down
12 changes: 0 additions & 12 deletions Source/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@

namespace devilution {

template <typename V, typename X, typename... Xs>
DVL_ALWAYS_INLINE constexpr bool IsAnyOf(const V &v, X x, Xs... xs)
{
return v == x || ((v == xs) || ...);
}

template <typename V, typename X, typename... Xs>
DVL_ALWAYS_INLINE constexpr bool IsNoneOf(const V &v, X x, Xs... xs)
{
return v != x && ((v != xs) && ...);
}

/**
* @brief Fill a rectangle with the given color.
*/
Expand Down
1 change: 1 addition & 0 deletions Source/engine/demomode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "utils/console.h"
#include "utils/display.h"
#include "utils/endian_stream.hpp"
#include "utils/is_of.hpp"
#include "utils/paths.h"
#include "utils/str_cat.hpp"

Expand Down
2 changes: 2 additions & 0 deletions Source/engine/displacement.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once

#include <cmath>
#include <limits>

#ifdef BUILD_TESTING
#include <ostream>
#endif
Expand Down
1 change: 1 addition & 0 deletions Source/engine/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "movie.h"
#include "options.h"
#include "panels/console.hpp"
#include "utils/is_of.hpp"
#include "utils/log.hpp"

#ifdef USE_SDL1
Expand Down
1 change: 1 addition & 0 deletions Source/engine/render/scrollrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "towners.h"
#include "utils/attributes.h"
#include "utils/display.h"
#include "utils/is_of.hpp"
#include "utils/log.hpp"
#include "utils/str_cat.hpp"

Expand Down
1 change: 1 addition & 0 deletions Source/engine/render/text_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "engine/render/clx_render.hpp"
#include "utils/algorithm/container.hpp"
#include "utils/display.h"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/sdl_compat.h"
#include "utils/utf8.hpp"
Expand Down
1 change: 1 addition & 0 deletions Source/inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "stores.h"
#include "towners.h"
#include "utils/format_int.hpp"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/sdl_geometry.h"
#include "utils/str_cat.hpp"
Expand Down
1 change: 1 addition & 0 deletions Source/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "spells.h"
#include "stores.h"
#include "utils/format_int.hpp"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/log.hpp"
#include "utils/math.h"
Expand Down
1 change: 1 addition & 0 deletions Source/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "engine/point.hpp"
#include "itemdat.h"
#include "monster.h"
#include "utils/is_of.hpp"
#include "utils/string_or_view.hpp"

namespace devilution {
Expand Down
1 change: 1 addition & 0 deletions Source/items/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "monstdat.h"
#include "player.h"
#include "spells.h"
#include "utils/is_of.hpp"

namespace devilution {

Expand Down
1 change: 1 addition & 0 deletions Source/levels/drlg_l1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "player.h"
#include "quests.h"
#include "utils/bitset2d.hpp"
#include "utils/is_of.hpp"

namespace devilution {

Expand Down
1 change: 1 addition & 0 deletions Source/levels/drlg_l2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "levels/setmaps.h"
#include "player.h"
#include "quests.h"
#include "utils/is_of.hpp"

namespace devilution {

Expand Down
1 change: 1 addition & 0 deletions Source/levels/drlg_l3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "objects.h"
#include "player.h"
#include "quests.h"
#include "utils/is_of.hpp"

namespace devilution {

Expand Down
1 change: 1 addition & 0 deletions Source/levels/drlg_l4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "multi.h"
#include "objdat.h"
#include "player.h"
#include "utils/is_of.hpp"

namespace devilution {

Expand Down
1 change: 1 addition & 0 deletions Source/levels/gendung.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "lighting.h"
#include "options.h"
#include "utils/bitset2d.hpp"
#include "utils/is_of.hpp"
#include "utils/log.hpp"
#include "utils/status_macros.hpp"

Expand Down
1 change: 1 addition & 0 deletions Source/levels/themes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "objects.h"
#include "quests.h"
#include "utils/algorithm/container.hpp"
#include "utils/is_of.hpp"
#include "utils/str_cat.hpp"

namespace devilution {
Expand Down
1 change: 1 addition & 0 deletions Source/levels/trigs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "diablo_msg.hpp"
#include "init.h"
#include "utils/algorithm/container.hpp"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/utf8.hpp"

Expand Down
1 change: 1 addition & 0 deletions Source/lighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "engine/points_in_rectangle_range.hpp"
#include "player.h"
#include "utils/attributes.h"
#include "utils/is_of.hpp"
#include "utils/status_macros.hpp"

namespace devilution {
Expand Down
1 change: 1 addition & 0 deletions Source/loadsave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "stores.h"
#include "utils/algorithm/container.hpp"
#include "utils/endian.hpp"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/status_macros.hpp"

Expand Down
1 change: 1 addition & 0 deletions Source/lua/modules/dev/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "lua/metadoc.hpp"
#include "pack.h"
#include "player.h"
#include "utils/is_of.hpp"
#include "utils/str_case.hpp"
#include "utils/str_cat.hpp"

Expand Down
1 change: 1 addition & 0 deletions Source/lua/modules/dev/quests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "engine.h"
#include "lua/metadoc.hpp"
#include "quests.h"
#include "utils/is_of.hpp"
#include "utils/str_cat.hpp"

namespace devilution {
Expand Down
1 change: 1 addition & 0 deletions Source/missiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "lighting.h"
#include "monster.h"
#include "spells.h"
#include "utils/is_of.hpp"
#include "utils/str_cat.hpp"

namespace devilution {
Expand Down
1 change: 1 addition & 0 deletions Source/missiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "monster.h"
#include "player.h"
#include "spelldat.h"
#include "utils/is_of.hpp"

namespace devilution {

Expand Down
1 change: 1 addition & 0 deletions Source/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "utils/attributes.h"
#include "utils/cl2_to_clx.hpp"
#include "utils/file_name_generator.hpp"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/log.hpp"
#include "utils/static_vector.hpp"
Expand Down
1 change: 1 addition & 0 deletions Source/msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "sync.h"
#include "tmsg.h"
#include "towners.h"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/str_cat.hpp"
#include "utils/utf8.hpp"
Expand Down
1 change: 1 addition & 0 deletions Source/multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "sync.h"
#include "tmsg.h"
#include "utils/endian.hpp"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/str_cat.hpp"

Expand Down
1 change: 1 addition & 0 deletions Source/objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "towners.h"
#include "track.h"
#include "utils/algorithm/container.hpp"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/log.hpp"
#include "utils/str_cat.hpp"
Expand Down
1 change: 1 addition & 0 deletions Source/objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "objdat.h"
#include "textdat.h"
#include "utils/attributes.h"
#include "utils/is_of.hpp"
#include "utils/string_or_view.hpp"

namespace devilution {
Expand Down
1 change: 1 addition & 0 deletions Source/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "utils/display.h"
#include "utils/file_util.h"
#include "utils/ini.hpp"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/log.hpp"
#include "utils/logged_fstream.hpp"
Expand Down
1 change: 1 addition & 0 deletions Source/pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "plrmsg.h"
#include "stores.h"
#include "utils/endian.hpp"
#include "utils/is_of.hpp"
#include "utils/log.hpp"
#include "utils/utf8.hpp"

Expand Down
1 change: 1 addition & 0 deletions Source/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "spells.h"
#include "stores.h"
#include "towners.h"
#include "utils/is_of.hpp"
#include "utils/language.h"
#include "utils/log.hpp"
#include "utils/str_cat.hpp"
Expand Down
Loading

0 comments on commit a49b1f2

Please sign in to comment.