Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
deathkiller committed Dec 17, 2023
1 parent 641b1c1 commit 5ca4dfa
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Sources/Jazz2/Actors/Enemies/EnemyBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ namespace Jazz2::Actors::Enemies
if (auto* shotBase = runtime_cast<Weapons::ShotBase*>(other)) {
if (shotBase->GetStrength() > 0) {
Vector2f shotSpeed;
if (auto* thunderbolt = runtime_cast<Weapons::Thunderbolt*>(shotBase)) {
if (runtime_cast<Weapons::Thunderbolt*>(shotBase)) {
shotSpeed = _pos - shotBase->GetPos();
} else {
shotSpeed = shotBase->GetSpeed();
Expand Down
4 changes: 2 additions & 2 deletions Sources/Jazz2/Actors/Enemies/TurtleShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace Jazz2::Actors::Enemies

if (auto* shotBase = runtime_cast<Weapons::ShotBase*>(other)) {
if (shotBase->GetStrength() > 0) {
if (auto* freezerShot = runtime_cast<Weapons::FreezerShot*>(shotBase)) {
if (runtime_cast<Weapons::FreezerShot*>(shotBase)) {
return false;
}

Expand All @@ -136,7 +136,7 @@ namespace Jazz2::Actors::Enemies
}

float shotSpeed;
if (auto* thunderbolt = runtime_cast<Weapons::Thunderbolt*>(shotBase)) {
if (runtime_cast<Weapons::Thunderbolt*>(shotBase)) {
shotSpeed = (_pos.X < shotBase->GetPos().X ? -8.0f : 8.0f);
} else {
shotSpeed = shotBase->GetSpeed().X;
Expand Down
1 change: 0 additions & 1 deletion Sources/Jazz2/UI/Menu/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,6 @@ namespace Jazz2::UI::Menu
{
TileMapLayer& layer = _owner->_texturedBackgroundLayer;
Vector2i layoutSize = layer.LayoutSize;
Vector2i targetSize = _target->size();

int32_t renderCommandIndex = 0;
bool isAnimated = false;
Expand Down
4 changes: 2 additions & 2 deletions Sources/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@ void GameEventHandler::ResumeSavedState()

if (version == 1) {
// Version 1 included compressedSize and decompressedSize, it's not needed anymore
std::int32_t compressedSize = s->ReadVariableInt32();
std::int32_t decompressedSize = s->ReadVariableInt32();
/*std::int32_t compressedSize =*/ s->ReadVariableInt32();
/*std::int32_t decompressedSize =*/ s->ReadVariableInt32();
}

DeflateStream uc(*s);
Expand Down
27 changes: 26 additions & 1 deletion Sources/Shared/Base/TypeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@
# define DEATH_HAS_BUILTIN_STRCMP(x, y) __builtin_strcmp(x, y)
#endif

#if defined(DEATH_TARGET_MSVC) && !defined(DEATH_TARGET_CLANG_CL)
# define _DEATH_WARNING_PUSH __pragma(warning(push))
# define _DEATH_WARNING_POP __pragma(warning(pop))
# define _DEATH_NO_OVERRIDE_WARNING __pragma(warning(disable: 26433))
#elif defined(DEATH_TARGET_CLANG)
# define _DEATH_WARNING_PUSH _Pragma("clang diagnostic push")
# define _DEATH_WARNING_POP _Pragma("clang diagnostic pop")
# if (__clang_major__ * 100 + __clang_minor__ >= 1100)
# define _DEATH_NO_OVERRIDE_WARNING _Pragma("clang diagnostic ignored -Winconsistent-missing-override") _Pragma("clang diagnostic ignored -Wsuggest-override")
# elif (__clang_major__ * 100 + __clang_minor__ >= 306)
# define _DEATH_NO_OVERRIDE_WARNING _Pragma("clang diagnostic ignored -Winconsistent-missing-override")
# endif
#elif defined(DEATH_TARGET_GCC) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 501)
# define _DEATH_WARNING_PUSH _Pragma("GCC diagnostic push")
# define _DEATH_WARNING_POP _Pragma("GCC diagnostic pop")
# define _DEATH_NO_OVERRIDE_WARNING _Pragma("GCC diagnostic ignored -Wsuggest-override")
#else
# define _DEATH_WARNING_PUSH
# define _DEATH_WARNING_POP
# define _DEATH_NO_OVERRIDE_WARNING
#endif

namespace Death { namespace TypeInfo { namespace Implementation {
//###==##====#=====--==~--~=~- --- -- - - - -

Expand Down Expand Up @@ -226,12 +248,15 @@ namespace Death { namespace TypeInfo { namespace Implementation {

/** @brief Class annotation to enable optimized @ref runtime_cast() functionality */
#define DEATH_RTTI_OBJECT(...) \
_DEATH_WARNING_PUSH \
_DEATH_NO_OVERRIDE_WARNING \
friend struct Death::TypeInfo::Implementation::Helpers; \
virtual const void* __FindInstance(Death::TypeInfo::Implementation::TypeId t) const noexcept { \
if (t == Death::TypeInfo::Implementation::Helpers::GetTypeId(this)) \
return this; \
return Death::TypeInfo::Implementation::Helpers::FindInstance<__VA_ARGS__>(t, this); \
}
} \
_DEATH_WARNING_POP

/** @brief Safely converts pointers to classes up, down, and sideways along the inheritance hierarchy of classes annotated by @ref DEATH_RTTI_OBJECT() */
template<typename T, typename U>
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/Containers/StringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ namespace Death { namespace Containers { namespace StringUtils {
String replaceAll(String string, char search, char replace) {
// If not even a single character is found, pass the argument through unchanged
const MutableStringView found = string.find(search);
if(!found) return std::move(string);
if(!found) return string;

// Convert the found pointer to an index to be able to replace even after a potential reallocation below
const std::size_t firstFoundPosition = found.begin() - string.begin();
Expand Down

0 comments on commit 5ca4dfa

Please sign in to comment.