Fixed compiler warnings.

This commit is contained in:
jeefo 2020-11-23 10:48:44 +03:00
commit b75e1b8a23
9 changed files with 22 additions and 17 deletions

3
.gitignore vendored
View file

@ -1,10 +1,11 @@
*.dll *.dll
*.so *.so
*.user *.user
*.json
vc/release vc/release
vc/debug vc/debug
vc/.vs vc/.vs
vc/enc_temp_folder vc/enc_temp_folder
build/ build/

View file

@ -10,11 +10,11 @@
#include <crlib/cr-memory.h> #include <crlib/cr-memory.h>
#include <crlib/cr-platform.h> #include <crlib/cr-platform.h>
void *operator new (size_t size) noexcept { void *operator new (size_t size) {
return cr::Memory::get <void *> (size); return cr::Memory::get <void *> (size);
} }
void *operator new [] (size_t size) noexcept { void *operator new [] (size_t size) {
return cr::Memory::get <void *> (size); return cr::Memory::get <void *> (size);
} }
@ -36,4 +36,4 @@ void operator delete [] (void *ptr, size_t) noexcept {
CR_LINKAGE_C void __cxa_pure_virtual () { CR_LINKAGE_C void __cxa_pure_virtual () {
cr::plat.abort ("pure virtual function call"); cr::plat.abort ("pure virtual function call");
} }

View file

@ -142,8 +142,8 @@ CR_NAMESPACE_BEGIN
// helper struct for platform detection // helper struct for platform detection
struct Platform : public Singleton <Platform> { struct Platform : public Singleton <Platform> {
bool win32 = false; bool win = false;
bool linux = false; bool nix = false;
bool osx = false; bool osx = false;
bool android = false; bool android = false;
bool hfp = false; bool hfp = false;
@ -154,7 +154,7 @@ struct Platform : public Singleton <Platform> {
Platform () { Platform () {
#if defined(CR_WINDOWS) #if defined(CR_WINDOWS)
win32 = true; win = true;
#endif #endif
#if defined(CR_ANDROID) #if defined(CR_ANDROID)
@ -166,7 +166,7 @@ struct Platform : public Singleton <Platform> {
#endif #endif
#if defined(CR_LINUX) #if defined(CR_LINUX)
linux = true; nix = true;
#endif #endif
#if defined(CR_OSX) #if defined(CR_OSX)

View file

@ -709,7 +709,7 @@ public:
} }
bool isWorkaroundNeeded () { bool isWorkaroundNeeded () {
return !plat.win32 && !Game::instance ().isDedicated (); return !plat.win && !Game::instance ().isDedicated ();
} }
}; };

View file

@ -70,13 +70,13 @@ private:
struct Args { struct Args {
union { union {
float float_; float float_;
long long_; int32 long_;
const char *chars_; const char *chars_;
}; };
public: public:
Args (float value) : float_ (value) { } Args (float value) : float_ (value) { }
Args (int value) : long_ (value) { } Args (int32 value) : long_ (value) { }
Args (const char *value) : chars_ (value) { } Args (const char *value) : chars_ (value) { }
}; };

View file

@ -571,7 +571,7 @@ bool Game::isSoftwareRenderer () {
} }
// and on only windows version you can use software-render game. Linux, OSX always defaults to OpenGL // and on only windows version you can use software-render game. Linux, OSX always defaults to OpenGL
if (plat.win32) { if (plat.win) {
return plat.hasModule ("sw"); return plat.hasModule ("sw");
} }
return false; return false;
@ -696,11 +696,11 @@ bool Game::loadCSBinary () {
} }
StringArray libs; StringArray libs;
if (plat.win32) { if (plat.win) {
libs.push ("mp.dll"); libs.push ("mp.dll");
libs.push ("cs.dll"); libs.push ("cs.dll");
} }
else if (plat.linux) { else if (plat.nix) {
libs.push ("cs.so"); libs.push ("cs.so");
libs.push ("cs_i386.so"); libs.push ("cs_i386.so");
} }

View file

@ -997,7 +997,7 @@ DLSYM_RETURN EntityLinkage::lookup (SharedLibrary::Handle module, const char *fu
} }
// if requested module is yapb module, put in cache the looked up symbol // if requested module is yapb module, put in cache the looked up symbol
if (self != module || (plat.win32 && (static_cast <uint16> (reinterpret_cast <uint32> (function) >> 16) & 0xffff) == 0)) { if (self != module || (plat.win && (static_cast <uint16> (reinterpret_cast <unsigned long> (function) >> 16) & 0xffff) == 0)) {
return resolve (module); return resolve (module);
} }

View file

@ -770,7 +770,11 @@ float BotManager::getAverageTeamKPD (bool calcForBots) {
} }
auto bot = bots[client.ent]; auto bot = bots[client.ent];
if ((calcForBots && bot) || (!calcForBots && !bot)) { if (calcForBots && bot) {
calc.first += client.ent->v.frags;
calc.second++;
}
else if (!calcForBots && !bot) {
calc.first += client.ent->v.frags; calc.first += client.ent->v.frags;
calc.second++; calc.second++;
} }

View file

@ -650,7 +650,7 @@ void BotSupport::installSendTo () {
} }
// enable only on modern games // enable only on modern games
if (game.is (GameFlags::Modern) && (plat.linux || plat.win32) && !plat.arm && !m_sendToDetour.detoured ()) { if (game.is (GameFlags::Modern) && (plat.nix || plat.win) && !plat.arm && !m_sendToDetour.detoured ()) {
m_sendToDetour.install (reinterpret_cast <void *> (BotSupport::sendTo), true); m_sendToDetour.install (reinterpret_cast <void *> (BotSupport::sendTo), true);
} }
} }