Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
deathkiller committed Jan 2, 2025
1 parent 9906c2a commit 1520efe
Show file tree
Hide file tree
Showing 58 changed files with 97 additions and 97 deletions.
3 changes: 3 additions & 0 deletions Sources/Jazz2/ContentResolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,15 @@ namespace Jazz2
}

private:
#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct StringRefEqualTo
{
inline bool operator()(const Reference<String>& a, const Reference<String>& b) const noexcept {
return a.get() == b.get();
}
};
#endif

ContentResolver();

Expand Down
3 changes: 3 additions & 0 deletions Sources/Jazz2/Events/EventMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ namespace Jazz2::Events
void SerializeResumableToStream(Stream& dest);

private:
#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct GeneratorInfo {
std::int32_t EventPos;

Expand All @@ -85,6 +87,7 @@ namespace Jazz2::Events
std::uint16_t Id;
Vector2f Pos;
};
#endif

ILevelHandler* _levelHandler;
Vector2i _layoutSize;
Expand Down
3 changes: 3 additions & 0 deletions Sources/Jazz2/Events/EventSpawner.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ namespace Jazz2::Events
void RegisterSpawnable(EventType type, CreateDelegate create, PreloadDelegate preload = nullptr);

private:
#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct SpawnableEvent {
CreateDelegate CreateFunction;
PreloadDelegate PreloadFunction;
};
#endif

ILevelHandler* _levelHandler;
HashMap<EventType, SpawnableEvent> _spawnableEvents;
Expand Down
1 change: 1 addition & 0 deletions Sources/Jazz2/LevelHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ namespace Jazz2
virtual void SpawnPlayers(const LevelInitialization& levelInit);

protected:
/** @brief Describes current input state of a player */
struct PlayerInput {
std::uint64_t PressedActions;
std::uint64_t PressedActionsLast;
Expand Down
6 changes: 6 additions & 0 deletions Sources/Jazz2/Multiplayer/MultiLevelHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ namespace Jazz2::Multiplayer
LevelSynchronized
};

#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct PeerDesc {
Actors::Multiplayer::RemotePlayerOnServer* Player;
PeerState State;
Expand All @@ -126,6 +128,7 @@ namespace Jazz2::Multiplayer
PeerDesc() {}
PeerDesc(Actors::Multiplayer::RemotePlayerOnServer* player, PeerState state) : Player(player), State(state), LastUpdated(0) {}
};
#endif

enum class PlayerFlags {
None = 0,
Expand All @@ -141,6 +144,8 @@ namespace Jazz2::Multiplayer

DEFINE_PRIVATE_ENUM_OPERATORS(PlayerFlags);

#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct PlayerState {
PlayerFlags Flags;
std::uint64_t PressedKeys;
Expand All @@ -157,6 +162,7 @@ namespace Jazz2::Multiplayer
Vector2f Pos;
std::uint8_t Team;
};
#endif

static constexpr float UpdatesPerSecond = 16.0f; // ~62 ms interval
static constexpr std::int64_t ServerDelay = 64;
Expand Down
3 changes: 3 additions & 0 deletions Sources/Jazz2/PreferencesCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ using namespace nCine;

namespace Jazz2
{
/** @brief Rescale mode */
enum class RescaleMode {
None,
HQ2x,
Expand All @@ -24,12 +25,14 @@ namespace Jazz2

DEFINE_ENUM_OPERATORS(RescaleMode);

/** @brief Weapon wheel style */
enum class WeaponWheelStyle : std::uint8_t {
Disabled,
Enabled,
EnabledWithAmmoCount
};

/** @brief Gamepad button labels */
enum class GamepadType : std::uint8_t {
Xbox,
PlayStation,
Expand Down
3 changes: 3 additions & 0 deletions Sources/Jazz2/RumbleDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ namespace Jazz2
}

private:
#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct TimelineItem {
float EndTime;

Expand All @@ -35,6 +37,7 @@ namespace Jazz2
{
}
};
#endif

SmallVector<TimelineItem, 0> _timeline;
};
Expand Down
3 changes: 3 additions & 0 deletions Sources/Jazz2/RumbleProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace Jazz2
void OnEndFrame(float timeMult);

private:
#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct ActiveRumble
{
std::shared_ptr<RumbleDescription> Desc;
Expand All @@ -26,6 +28,7 @@ namespace Jazz2

ActiveRumble(std::int32_t joyId, std::shared_ptr<RumbleDescription> desc);
};
#endif

SmallVector<ActiveRumble, 0> _activeRumble;
};
Expand Down
3 changes: 3 additions & 0 deletions Sources/Jazz2/Tiles/TileMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ namespace Jazz2::Tiles
Sprite
};

#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct TileSetPart {
std::unique_ptr<TileSet> Data;
std::int32_t Offset;
Expand Down Expand Up @@ -243,6 +245,7 @@ namespace Jazz2::Tiles
SmallVector<std::unique_ptr<RenderCommand>, 0> _renderCommands;
bool _alreadyRendered;
};
#endif

ITileMapOwner* _owner;
std::int32_t _sprLayerIndex;
Expand Down
3 changes: 3 additions & 0 deletions Sources/Jazz2/UI/Cinematics.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ namespace Jazz2::UI
void OnTouchEvent(const TouchEvent& event) override;

private:
#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
class CinematicsCanvas : public SceneNode
{
public:
Expand All @@ -58,6 +60,7 @@ namespace Jazz2::UI
Cinematics* _owner;
RenderCommand _renderCommand;
};
#endif

#if defined(WITH_AUDIO)
struct SfxItem {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Jazz2/UI/FormattedTextBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ namespace Jazz2::UI
}

private:
#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct Part
{
const char* Value;
Expand All @@ -135,6 +137,7 @@ namespace Jazz2::UI

BackgroundPart(Colorf color);
};
#endif

enum class FormattedTextBlockFlags : std::uint16_t {
None = 0,
Expand Down
3 changes: 3 additions & 0 deletions Sources/Jazz2/UI/HUD.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ namespace Jazz2::UI
WaitingForFadeOut
};

#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct TouchButtonInfo {
PlayerActions Action;

Expand Down Expand Up @@ -94,6 +96,7 @@ namespace Jazz2::UI

WeaponWheelState();
};
#endif

static constexpr std::uint32_t VertexBytes = sizeof(Vertex);
static constexpr std::uint32_t VertexFloats = VertexBytes / sizeof(float);
Expand Down
3 changes: 3 additions & 0 deletions Sources/Jazz2/UI/LoadingHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ namespace Jazz2::UI
private:
IRootController* _root;

#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
class BackgroundCanvas : public Canvas
{
public:
Expand All @@ -37,6 +39,7 @@ namespace Jazz2::UI
private:
LoadingHandler* _owner;
};
#endif

UI::UpscaleRenderPass _upscalePass;
std::unique_ptr<BackgroundCanvas> _canvasBackground;
Expand Down
6 changes: 2 additions & 4 deletions Sources/Shared/Base/TypeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ namespace Death { namespace TypeInfo { namespace Implementation {
}
}}}

#ifndef DOXYGEN_GENERATING_OUTPUT
// It is located in the root namespace to keep the resulting string as short as possible
template<class T>
struct __ti
Expand All @@ -181,7 +180,6 @@ struct __ti
#endif
}
};
#endif

namespace Death { namespace TypeInfo { namespace Implementation {
//###==##====#=====--==~--~=~- --- -- - - - -
Expand Down Expand Up @@ -249,7 +247,7 @@ namespace Death { namespace TypeInfo { namespace Implementation {
};
}}}

/** @brief Class annotation to enable optimized @ref runtime_cast(U*) functionality */
/** @brief Class annotation to enable optimized `runtime_cast()` functionality */
#define DEATH_RUNTIME_OBJECT(...) \
__DEATH_WARNING_PUSH \
__DEATH_NO_OVERRIDE_WARNING \
Expand Down Expand Up @@ -291,7 +289,7 @@ DEATH_ALWAYS_INLINE T runtime_cast(const std::unique_ptr<U>& u) noexcept {

#else

/** @brief Class annotation to enable optimized @ref runtime_cast(U*) functionality */
/** @brief Class annotation to enable optimized `runtime_cast()` functionality */
#define DEATH_RUNTIME_OBJECT(...)

/** @brief Safely converts pointers to classes up, down, and sideways along the inheritance hierarchy of classes annotated by `DEATH_RUNTIME_OBJECT()` */
Expand Down
11 changes: 0 additions & 11 deletions Sources/Shared/Containers/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,37 +288,28 @@ namespace Death { namespace Containers {
*
* If set to @cpp nullptr @ce, the contents are deleted using standard
* @cpp operator delete[] @ce.
* @see @ref Array(T*, std::size_t, D)
*/
D deleter() const { return _deleter; }

/**
* @brief Array size
*
* @see @ref isEmpty()
*/
std::size_t size() const { return _size; }

/**
* @brief Whether the array is empty
*
* @see @ref size()
*/
bool empty() const { return !_size; }

/**
* @brief Pointer to first element
*
* @see @ref front(), @ref operator[]()
*/
T* begin() { return _data; }
const T* begin() const { return _data; } /**< @overload */
const T* cbegin() const { return _data; } /**< @overload */

/**
* @brief Pointer to (one item after) last element
*
* @see @ref back(), @ref operator[]()
*/
T* end() { return _data+_size; }
const T* end() const { return _data+_size; } /**< @overload */
Expand All @@ -328,7 +319,6 @@ namespace Death { namespace Containers {
* @brief First element
*
* Expects there is at least one element.
* @see @ref begin(), @ref operator[]()
*/
T& front();
const T& front() const; /**< @overload */
Expand All @@ -337,7 +327,6 @@ namespace Death { namespace Containers {
* @brief Last element
*
* Expects there is at least one element.
* @see @ref end(), @ref operator[]()
*/
T& back();
const T& back() const; /**< @overload */
Expand Down
5 changes: 0 additions & 5 deletions Sources/Shared/Containers/ArrayView.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ namespace Death { namespace Containers {
* @brief Construct a view on an array with explicit size
* @param data Data pointer
* @param size Data size
*
* @see @ref arrayView(T*, std::size_t)
*/
constexpr /*implicit*/ ArrayView(T* data, std::size_t size) noexcept : _data(data), _size(size) {}

Expand Down Expand Up @@ -731,8 +729,6 @@ namespace Death { namespace Containers {

/**
* @brief Pointer to the first element
*
* @see @ref front(), @ref operator[]()
*/
constexpr T* begin() const { return _data; }
/** @overload */
Expand Down Expand Up @@ -761,7 +757,6 @@ namespace Death { namespace Containers {
* @brief Element access
*
* Expects that @p i is less than @ref size().
* @see @ref front(), @ref back()
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
constexpr T& operator[](std::size_t i) const;
Expand Down
3 changes: 3 additions & 0 deletions Sources/Shared/Containers/Function.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ namespace Death { namespace Containers {
private:
template<class> friend class Function;

#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
union Storage {
// Simple, small enough and trivial functors
char data[Implementation::FunctionPointerSize*sizeof(std::size_t) + sizeof(void*)];
Expand All @@ -150,6 +152,7 @@ namespace Death { namespace Containers {
void(*call)();
} functor;
};
#endif

constexpr explicit FunctionData(const Storage& storage, void(*call)()):
// GCC 4.8 attempts to initialize the first member (the char array) instead of performing a copy if {} is used
Expand Down
3 changes: 3 additions & 0 deletions Sources/Shared/Containers/String.h
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,8 @@ namespace Death { namespace Containers {
The above approach is consistent with StringView, which is the
preferrable solution after all. */
#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct Small {
#if defined(DEATH_TARGET_BIG_ENDIAN)
unsigned char size;
Expand All @@ -1029,6 +1031,7 @@ namespace Death { namespace Containers {
Small _small;
Large _large;
};
#endif
};

}}
1 change: 0 additions & 1 deletion Sources/Shared/Containers/StringView.h
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,6 @@ namespace Death { namespace Containers {
*
* If it's only needed to know whether a character is contained in a
* string at all, consider using @ref contains(char) const instead.
* @see @ref find(char) const
*/
std::size_t count(char character) const;

Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/IO/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace Death { namespace IO {

DEFINE_PRIVATE_ENUM_OPERATORS(EnumerationOptions);

/** @brief The class that handles directory traversal, should be used as iterator */
/** @brief Handles directory traversal, should be used as iterator */
class Directory
{
public:
Expand Down
Loading

0 comments on commit 1520efe

Please sign in to comment.