1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 17:26:41 +00:00

compile fixes for clang when c++98 is enforced

This commit is contained in:
fgenesis 2024-02-07 03:26:18 +01:00
parent 8c467517fd
commit ebf49310b3
4 changed files with 48 additions and 13 deletions

View file

@ -75,7 +75,10 @@ size_t TileMgr::getNumTiles() const
TileStorage::Sizes TileMgr::getStats() const TileStorage::Sizes TileMgr::getStats() const
{ {
TileStorage::Sizes tsz {}; TileStorage::Sizes tsz;
tsz.collide = 0;
tsz.tiles = 0;
tsz.update = 0;
for(size_t i = 0; i < Countof(tilestore); ++i) for(size_t i = 0; i < Countof(tilestore); ++i)
{ {
TileStorage::Sizes sz = tilestore[i].stats(); TileStorage::Sizes sz = tilestore[i].stats();

View file

@ -106,12 +106,17 @@ void Precacher::precacheList(const std::string &list, ProgressCallback progress)
std::string t; std::string t;
while (std::getline(in, t)) while (std::getline(in, t))
{ {
while (!t.empty()) if(!t.empty())
{ {
if(t.back() == '\r' || t.back() == '\n') // linux doesn't like CRLF, make sure to trim that off size_t i = t.size();
t.pop_back(); for( ; i --> 0; )
else {
break; const char bk = t[i];
if(!(bk == '\r' || bk == '\n' || bk == ' ' || bk == '\t')) // linux doesn't like CRLF, make sure to trim that off
break;
}
if(i+1 != t.size())
t.erase(i+1, std::string::npos);
} }
if(!t.empty()) if(!t.empty())

View file

@ -198,7 +198,7 @@ void TextureMgr::clearUnused()
{ {
if(it->second->refcount() <= 1) if(it->second->refcount() <= 1)
{ {
it = cache.erase(it); cache.erase(it++);
++done; ++done;
} }
else else

View file

@ -8,7 +8,16 @@
#include <limits.h> #include <limits.h>
#if defined(_MSC_VER) && _MSC_VER < 1600 #if (defined(__cplusplus) && (__cplusplus+0 > 201103L)) \
|| (defined(_MSC_VER) && (_MSC_VER+0 > 1600)) \
|| (defined(__STDC_VERSION__) && (__STDC_VERSION__+0 >= 199901L))
# if (defined(__cplusplus) && (__cplusplus+0 > 201103L))
# include <cstdint>
# endif
# include <stdint.h>
#elif defined(_MSC_VER) // older MSVC
#include "SDL_version.h" #include "SDL_version.h"
#if SDL_VERSION_ATLEAST(2, 0, 0) // AQUARIA HACK: Included SDL 1.2 includes define some of these, SDL does not. Avoid conflicts. #if SDL_VERSION_ATLEAST(2, 0, 0) // AQUARIA HACK: Included SDL 1.2 includes define some of these, SDL does not. Avoid conflicts.
typedef signed __int8 int8_t; typedef signed __int8 int8_t;
@ -43,11 +52,29 @@
# define UINT32_C(v) ((uint32_t)v) # define UINT32_C(v) ((uint32_t)v)
# define UINT64_C(v) (v ## UI64) # define UINT64_C(v) (v ## UI64)
# define INT64_C(v) (v ## I64) # define INT64_C(v) (v ## I64)
#else #elif 1
# ifdef __cplusplus typedef __uint8_t uint8_t;
# include <cstdint> typedef __int8_t int8_t;
# endif typedef __uint16_t uint16_t;
# include <stdint.h> typedef __int16_t int16_t;
typedef __uint32_t uint32_t;
typedef __int32_t int32_t;
typedef __uint64_t uint64_t;
typedef __int64_t int64_t;
#elif 0
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef signed int int32_t;
typedef unsigned long long uint64_t;
typedef signed long long int64_t;
// produce compile errors if the sizes aren't right
typedef char _pstdint_testsize16[sizeof(int16_t) == 2];
typedef char _pstdint_testsize32[sizeof(int32_t) == 4];
typedef char _pstdint_testsize64[sizeof(int64_t) == 8];
#endif #endif
# if !defined (UINT64_MAX) # if !defined (UINT64_MAX)