mirror of
https://github.com/glest/glest-source.git
synced 2025-08-11 19:04:00 +02:00
- do not load models or sound files in headless server mode
This commit is contained in:
@@ -39,6 +39,7 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include "core_data.h"
|
#include "core_data.h"
|
||||||
#include "font_text.h"
|
#include "font_text.h"
|
||||||
|
//#include "sound.h"
|
||||||
//#include "unicode/uclean.h"
|
//#include "unicode/uclean.h"
|
||||||
|
|
||||||
// For gcc backtrace on crash!
|
// For gcc backtrace on crash!
|
||||||
@@ -2534,6 +2535,8 @@ int glestMain(int argc, char** argv) {
|
|||||||
config.setString("FactorySound","None");
|
config.setString("FactorySound","None");
|
||||||
if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
||||||
Logger::getInstance().setMasterserverMode(true);
|
Logger::getInstance().setMasterserverMode(true);
|
||||||
|
Model::setMasterserverMode(true);
|
||||||
|
Shared::Sound::Sound::setMasterserverMode(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -176,6 +176,8 @@ private:
|
|||||||
string fileName;
|
string fileName;
|
||||||
string sourceLoader;
|
string sourceLoader;
|
||||||
|
|
||||||
|
static bool masterserverMode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//constructor & destructor
|
//constructor & destructor
|
||||||
Model();
|
Model();
|
||||||
@@ -183,6 +185,8 @@ public:
|
|||||||
virtual void init()= 0;
|
virtual void init()= 0;
|
||||||
virtual void end()= 0;
|
virtual void end()= 0;
|
||||||
|
|
||||||
|
static void setMasterserverMode(bool value) { masterserverMode=value; }
|
||||||
|
|
||||||
//data
|
//data
|
||||||
void updateInterpolationData(float t, bool cycle);
|
void updateInterpolationData(float t, bool cycle);
|
||||||
void updateInterpolationVertices(float t, bool cycle);
|
void updateInterpolationVertices(float t, bool cycle);
|
||||||
|
@@ -61,10 +61,14 @@ protected:
|
|||||||
float volume;
|
float volume;
|
||||||
string fileName;
|
string fileName;
|
||||||
|
|
||||||
|
static bool masterserverMode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Sound();
|
Sound();
|
||||||
virtual ~Sound(){};
|
virtual ~Sound(){};
|
||||||
|
|
||||||
|
static void setMasterserverMode(bool value) { masterserverMode=value; }
|
||||||
|
|
||||||
const SoundInfo *getInfo() const {return &info;}
|
const SoundInfo *getInfo() const {return &info;}
|
||||||
float getVolume() const {return volume;}
|
float getVolume() const {return volume;}
|
||||||
|
|
||||||
|
@@ -34,6 +34,8 @@ namespace Shared{ namespace Graphics{
|
|||||||
|
|
||||||
using namespace Util;
|
using namespace Util;
|
||||||
|
|
||||||
|
bool Model::masterserverMode = false;
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class Mesh
|
// class Mesh
|
||||||
// =====================================================
|
// =====================================================
|
||||||
@@ -777,6 +779,9 @@ void Model::load(const string &path, bool deletePixMapAfterLoad,
|
|||||||
this->sourceLoader = (sourceLoader != NULL ? *sourceLoader : "");
|
this->sourceLoader = (sourceLoader != NULL ? *sourceLoader : "");
|
||||||
this->fileName = path;
|
this->fileName = path;
|
||||||
|
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
string extension= path.substr(path.find_last_of('.') + 1);
|
string extension= path.substr(path.find_last_of('.') + 1);
|
||||||
if(extension=="g3d" || extension=="G3D") {
|
if(extension=="g3d" || extension=="G3D") {
|
||||||
loadG3d(path,deletePixMapAfterLoad,loadedFileList, this->sourceLoader);
|
loadG3d(path,deletePixMapAfterLoad,loadedFileList, this->sourceLoader);
|
||||||
|
@@ -17,6 +17,9 @@
|
|||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared { namespace Sound {
|
namespace Shared { namespace Sound {
|
||||||
|
|
||||||
|
bool Sound::masterserverMode = false;
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class SoundInfo
|
// class SoundInfo
|
||||||
// =====================================================
|
// =====================================================
|
||||||
@@ -70,6 +73,9 @@ void StaticSound::load(const string &path){
|
|||||||
|
|
||||||
fileName = path;
|
fileName = path;
|
||||||
|
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
string ext= path.substr(path.find_last_of('.')+1);
|
string ext= path.substr(path.find_last_of('.')+1);
|
||||||
soundFileLoader= SoundFileLoaderFactory::getInstance()->newInstance(ext);
|
soundFileLoader= SoundFileLoaderFactory::getInstance()->newInstance(ext);
|
||||||
|
|
||||||
@@ -104,6 +110,10 @@ void StrSound::open(const string &path){
|
|||||||
|
|
||||||
fileName = path;
|
fileName = path;
|
||||||
|
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string ext= path.substr(path.find_last_of('.')+1);
|
string ext= path.substr(path.find_last_of('.')+1);
|
||||||
|
|
||||||
soundFileLoader= SoundFileLoaderFactory::getInstance()->newInstance(ext);
|
soundFileLoader= SoundFileLoaderFactory::getInstance()->newInstance(ext);
|
||||||
@@ -111,6 +121,10 @@ void StrSound::open(const string &path){
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 StrSound::read(int8 *samples, uint32 size){
|
uint32 StrSound::read(int8 *samples, uint32 size){
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return soundFileLoader->read(samples, size);
|
return soundFileLoader->read(samples, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,6 +137,10 @@ void StrSound::close(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StrSound::restart(){
|
void StrSound::restart(){
|
||||||
|
if(this->masterserverMode == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
soundFileLoader->restart();
|
soundFileLoader->restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user