Some cleaning up

dev-mp
Piotr Dziwinski 2014-09-07 19:26:06 +02:00
parent f0b38721e0
commit 6a1ceba8c0
17 changed files with 64 additions and 60 deletions

View File

@ -40,20 +40,24 @@ CPauseManager::~CPauseManager()
void CPauseManager::SetPause(PauseType pause) void CPauseManager::SetPause(PauseType pause)
{ {
if(pause != PAUSE_NONE) { if (pause != PAUSE_NONE)
if(m_pause != pause) { {
if (m_pause != pause)
{
CLogger::GetInstancePointer()->Info("Game paused - %s\n", GetPauseName(pause).c_str()); CLogger::GetInstancePointer()->Info("Game paused - %s\n", GetPauseName(pause).c_str());
CRobotMain::GetInstancePointer()->StartPauseMusic(pause); CRobotMain::GetInstancePointer()->StartPauseMusic(pause);
} }
m_pause = pause; m_pause = pause;
} else }
else
ClearPause(); ClearPause();
} }
void CPauseManager::ClearPause() void CPauseManager::ClearPause()
{ {
if(m_pause != PAUSE_NONE) { if(m_pause != PAUSE_NONE)
{
CLogger::GetInstancePointer()->Info("Game resumed\n"); CLogger::GetInstancePointer()->Info("Game resumed\n");
m_sound->StopPauseMusic(); m_sound->StopPauseMusic();
} }

View File

@ -25,7 +25,7 @@
void CSystemUtilsLinux::Init() void CSystemUtilsLinux::Init()
{ {
m_zenityAvailable = true; m_zenityAvailable = true;
if (system("zenity --version") != 0) if (system("zenity --version >& /dev/null") != 0)
{ {
m_zenityAvailable = false; m_zenityAvailable = false;
GetLogger()->Warn("Zenity not available, will fallback to console users dialogs.\n"); GetLogger()->Warn("Zenity not available, will fallback to console users dialogs.\n");

View File

@ -25,7 +25,6 @@ class COutputStreamBuffer : public std::streambuf
public: public:
COutputStreamBuffer(size_t buffer_size = 512); COutputStreamBuffer(size_t buffer_size = 512);
virtual ~COutputStreamBuffer(); virtual ~COutputStreamBuffer();
void open(const std::string &filename); void open(const std::string &filename);
void close(); void close();
bool is_open(); bool is_open();
@ -38,7 +37,6 @@ private:
// copying not allowed // copying not allowed
COutputStreamBuffer(const COutputStreamBuffer &); COutputStreamBuffer(const COutputStreamBuffer &);
COutputStreamBuffer &operator= (const COutputStreamBuffer &); COutputStreamBuffer &operator= (const COutputStreamBuffer &);
PHYSFS_File *m_file; PHYSFS_File *m_file;
char *m_buffer; char *m_buffer;
size_t m_buffer_size; size_t m_buffer_size;

View File

@ -22,6 +22,11 @@
#include <physfs.h> #include <physfs.h>
namespace
{
const Uint32 PHYSFS_RWOPS_TYPE = 0xc010b04f;
}
CResourceManager::CResourceManager(const char *argv0) CResourceManager::CResourceManager(const char *argv0)
{ {
@ -112,7 +117,7 @@ SDL_RWops* CResourceManager::GetSDLFileHandler(const std::string &filename)
handler->read = SDLRead; handler->read = SDLRead;
handler->write = SDLWrite; handler->write = SDLWrite;
handler->close = SDLClose; handler->close = SDLClose;
handler->type = 0xc010b04f; handler->type = PHYSFS_RWOPS_TYPE;
handler->hidden.unknown.data1 = file; handler->hidden.unknown.data1 = file;
return handler; return handler;
@ -212,7 +217,7 @@ int CResourceManager::SDLSeek(SDL_RWops *context, int offset, int whence)
bool CResourceManager::CheckSDLContext(SDL_RWops *context) bool CResourceManager::CheckSDLContext(SDL_RWops *context)
{ {
if (context->type != 0xc010b04f) if (context->type != PHYSFS_RWOPS_TYPE)
{ {
SDL_SetError("Wrong kind of RWops"); SDL_SetError("Wrong kind of RWops");
return false; return false;

View File

@ -31,7 +31,6 @@ CSNDFile::CSNDFile(const std::string& filename)
{ {
m_last_error = "Resource system not started!"; m_last_error = "Resource system not started!";
} }
if (m_file) if (m_file)
{ {
m_snd_file = sf_open_virtual(&snd_callbacks, SFM_READ, &m_file_info, m_file); m_snd_file = sf_open_virtual(&snd_callbacks, SFM_READ, &m_file_info, m_file);
@ -99,7 +98,6 @@ sf_count_t CSNDFile::SNDRead(void *ptr, sf_count_t count, void *data)
sf_count_t CSNDFile::SNDSeek(sf_count_t offset, int whence, void *data) sf_count_t CSNDFile::SNDSeek(sf_count_t offset, int whence, void *data)
{ {
PHYSFS_File *file = static_cast<PHYSFS_File *>(data); PHYSFS_File *file = static_cast<PHYSFS_File *>(data);
switch(whence) switch(whence)
{ {
case SEEK_CUR: case SEEK_CUR:

View File

@ -38,7 +38,6 @@ private:
static sf_count_t SNDRead(void *ptr, sf_count_t count, void *data); static sf_count_t SNDRead(void *ptr, sf_count_t count, void *data);
static sf_count_t SNDWrite(const void *ptr, sf_count_t count, void *data); static sf_count_t SNDWrite(const void *ptr, sf_count_t count, void *data);
static sf_count_t SNDTell(void *data); static sf_count_t SNDTell(void *data);
SF_INFO m_file_info; SF_INFO m_file_info;
SNDFILE *m_snd_file; SNDFILE *m_snd_file;
PHYSFS_File *m_file; PHYSFS_File *m_file;