- lots of code cleanup from the cppcheck
This commit is contained in:
parent
b1cc8592fd
commit
1c211e4ce6
|
@ -288,7 +288,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
|||
model(NULL), glCanvas(NULL), renderer(NULL),
|
||||
initTextureManager(true), timer(NULL),
|
||||
startupSettingsInited(false),
|
||||
fileDialog(NULL)
|
||||
fileDialog(NULL),colorPicker(NULL)
|
||||
{
|
||||
this->appPath = appPath;
|
||||
Properties::setApplicationPath(executable_path(appPath));
|
||||
|
@ -297,6 +297,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
|||
string iniFilePath = extractDirectoryPathFromFile(config.getFileName(false));
|
||||
//getGlPlatformExtensions();
|
||||
|
||||
isControlKeyPressed = false;
|
||||
int args[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_MIN_ALPHA, 8 }; // to prevent flicker
|
||||
//int args[] = { WX_GL_RGBA, WX_GL_MIN_ALPHA, 0 }; // to prevent flicker
|
||||
glCanvas = new GlCanvas(this, args);
|
||||
|
@ -2508,8 +2509,9 @@ int App::MainLoop(){
|
|||
}
|
||||
catch(const exception &e){
|
||||
wxMessageDialog(NULL, ToUnicode(e.what()), ToUnicode("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int App::OnExit(){
|
||||
|
|
|
@ -219,6 +219,7 @@ public:
|
|||
App() : wxApp() {
|
||||
mainWindow = NULL;
|
||||
}
|
||||
virtual ~App() {}
|
||||
virtual bool OnInit();
|
||||
virtual int MainLoop();
|
||||
virtual int OnExit();
|
||||
|
|
|
@ -106,6 +106,16 @@ Renderer::Renderer() {
|
|||
green = 0.3f;
|
||||
blue = 0.3f;
|
||||
alpha = 1.0f;
|
||||
|
||||
customTextureRed=NULL;
|
||||
customTextureBlue=NULL;
|
||||
customTextureGreen=NULL;
|
||||
customTextureYellow=NULL;
|
||||
customTextureWhite=NULL;
|
||||
customTextureCyan=NULL;
|
||||
customTextureOrange=NULL;
|
||||
customTextureMagenta=NULL;
|
||||
particleManager=NULL;
|
||||
}
|
||||
|
||||
Renderer::~Renderer() {
|
||||
|
@ -346,6 +356,7 @@ void Renderer::reset(int w, int h, PlayerColor playerColor) {
|
|||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
meshCallbackTeamColor.setTeamTexture(customTexture);
|
||||
|
||||
|
@ -479,6 +490,7 @@ Texture2D * Renderer::getPlayerColorTexture(PlayerColor playerColor) {
|
|||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
return customTexture;
|
||||
|
|
|
@ -121,7 +121,7 @@ private:
|
|||
void checkExtension(const string &extension, const string &msg);
|
||||
|
||||
public:
|
||||
~Renderer();
|
||||
virtual ~Renderer();
|
||||
static Renderer *getInstance();
|
||||
|
||||
void init();
|
||||
|
|
|
@ -127,6 +127,8 @@ public:
|
|||
virtual unsigned int getEdgeCount(void *userData) const = 0;
|
||||
virtual AI_Node * getEdge(int index,void *userData) const = 0;
|
||||
virtual int32 getHashCode() const = 0;
|
||||
|
||||
virtual ~AI_Node() {}
|
||||
};
|
||||
|
||||
enum SearchState {
|
||||
|
|
|
@ -296,7 +296,7 @@ bool GraphicLabel::mouseMove(int x, int y) {
|
|||
|
||||
int useWidth = w;
|
||||
if(text.length() > 0 && font3D != NULL) {
|
||||
float lineWidth = (font3D->getTextHandler()->Advance(text.c_str()) * Font::scaleFontValue);
|
||||
float lineWidth = (font3D->getTextHandler()->Advance(text.c_str()) * Shared::Graphics::Font::scaleFontValue);
|
||||
useWidth = (int)lineWidth;
|
||||
}
|
||||
|
||||
|
@ -833,7 +833,7 @@ void PopupMenu::init(string menuHeader,std::vector<string> menuItems) {
|
|||
int maxButtonWidth = -1;
|
||||
for(unsigned int i = 0; i < menuItems.size(); ++i) {
|
||||
int currentButtonWidth = -1;
|
||||
if(font3D != NULL && Font::forceLegacyFonts == false) {
|
||||
if(font3D != NULL && Shared::Graphics::Font::forceLegacyFonts == false) {
|
||||
FontMetrics *fontMetrics= font3D->getMetrics();
|
||||
if(fontMetrics) {
|
||||
currentButtonWidth = fontMetrics->getTextWidth(menuItems[i]);
|
||||
|
|
|
@ -38,6 +38,7 @@ class Console;
|
|||
class CustomInputCallbackInterface {
|
||||
public:
|
||||
virtual void processInputText(string text, bool cancelled) = 0;
|
||||
virtual ~CustomInputCallbackInterface() {}
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
|
|
|
@ -968,6 +968,7 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
|
|||
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -52,6 +52,7 @@ class SwitchTeamVote;
|
|||
class CommanderNetworkCallbackInterface {
|
||||
public:
|
||||
virtual void commanderNetworkUpdateTask(int id) = 0;
|
||||
virtual ~CommanderNetworkCallbackInterface() {}
|
||||
};
|
||||
|
||||
class CommanderNetworkThread : public BaseThread
|
||||
|
@ -88,7 +89,7 @@ private:
|
|||
|
||||
public:
|
||||
Commander();
|
||||
~Commander();
|
||||
virtual ~Commander();
|
||||
|
||||
void signalNetworkUpdate(Game *game);
|
||||
void init(World *world);
|
||||
|
|
|
@ -106,6 +106,13 @@ Game::Game() : ProgramState(NULL) {
|
|||
program=NULL;
|
||||
gameStarted=false;
|
||||
|
||||
highlightCellTexture=NULL;
|
||||
lastMasterServerGameStatsDump=0;
|
||||
lastMaxUnitCalcTime=0;
|
||||
lastRenderLog2d=0;
|
||||
playerIndexDisconnect=0;
|
||||
tickCount=0;
|
||||
|
||||
popupMenu.setEnabled(false);
|
||||
popupMenu.setVisible(false);
|
||||
|
||||
|
@ -846,7 +853,7 @@ void Game::load(int loadTypes) {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
Game::findFactionLogoFile(&gameSettings, &logger);
|
||||
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
}
|
||||
|
||||
|
@ -883,7 +890,7 @@ void Game::load(int loadTypes) {
|
|||
|
||||
// give CPU time to update other things to avoid apperance of hanging
|
||||
sleep(0);
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
@ -921,7 +928,7 @@ void Game::load(int loadTypes) {
|
|||
|
||||
// give CPU time to update other things to avoid apperance of hanging
|
||||
sleep(0);
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
@ -934,7 +941,7 @@ void Game::load(int loadTypes) {
|
|||
|
||||
// give CPU time to update other things to avoid apperance of hanging
|
||||
sleep(0);
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
@ -997,7 +1004,7 @@ void Game::init(bool initForPreviewOnly) {
|
|||
|
||||
// give CPU time to update other things to avoid apperance of hanging
|
||||
sleep(0);
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
}
|
||||
|
||||
|
@ -1042,7 +1049,7 @@ void Game::init(bool initForPreviewOnly) {
|
|||
if(initForPreviewOnly == false) {
|
||||
// give CPU time to update other things to avoid apperance of hanging
|
||||
sleep(0);
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
|
||||
gui.init(this);
|
||||
|
@ -1083,7 +1090,7 @@ void Game::init(bool initForPreviewOnly) {
|
|||
if(initForPreviewOnly == false) {
|
||||
// give CPU time to update other things to avoid apperance of hanging
|
||||
sleep(0);
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
|
||||
scriptManager.init(&world, &gameCamera,loadGameNode);
|
||||
|
@ -1122,7 +1129,7 @@ void Game::init(bool initForPreviewOnly) {
|
|||
|
||||
// give CPU time to update other things to avoid apperance of hanging
|
||||
sleep(0);
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
|
||||
if(world.getFactionCount() == 1 && world.getFaction(0)->getPersonalityType() == fpt_Observer) {
|
||||
|
@ -1174,7 +1181,7 @@ void Game::init(bool initForPreviewOnly) {
|
|||
|
||||
// give CPU time to update other things to avoid apperance of hanging
|
||||
sleep(0);
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Waiting for network\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||
|
@ -1833,7 +1840,7 @@ void Game::addOrReplaceInHighlightedCells(MarkedCell mc){
|
|||
|
||||
void Game::ReplaceDisconnectedNetworkPlayersWithAI(bool isNetworkGame, NetworkRole role) {
|
||||
if(role == nrServer && isNetworkGame == true &&
|
||||
difftime(time(NULL),lastNetworkPlayerConnectionCheck) >= NETWORK_PLAYER_CONNECTION_CHECK_SECONDS) {
|
||||
difftime((long int)time(NULL),lastNetworkPlayerConnectionCheck) >= NETWORK_PLAYER_CONNECTION_CHECK_SECONDS) {
|
||||
lastNetworkPlayerConnectionCheck = time(NULL);
|
||||
Logger &logger= Logger::getInstance();
|
||||
ServerInterface *server = NetworkManager::getInstance().getServerInterface();
|
||||
|
@ -1945,7 +1952,7 @@ void Game::render() {
|
|||
string str="";
|
||||
std::map<int,string> factionDebugInfo;
|
||||
|
||||
if( difftime(time(NULL),lastMasterServerGameStatsDump) >= GAME_STATS_DUMP_INTERVAL) {
|
||||
if( difftime((long int)time(NULL),lastMasterServerGameStatsDump) >= GAME_STATS_DUMP_INTERVAL) {
|
||||
lastMasterServerGameStatsDump = time(NULL);
|
||||
str = getDebugStats(factionDebugInfo);
|
||||
|
||||
|
@ -2884,7 +2891,7 @@ void Game::mouseMove(int x, int y, const MouseState *ms) {
|
|||
gameCamera.transitionVH(-(y - lastMousePos.y) * ymult, (lastMousePos.x - x) * xmult);
|
||||
mouseX=lastMousePos.x;
|
||||
mouseY=lastMousePos.y;
|
||||
Window::revertMousePos();
|
||||
Shared::Platform::Window::revertMousePos();
|
||||
|
||||
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
return;
|
||||
|
@ -3632,7 +3639,7 @@ void Game::render3d(){
|
|||
void Game::updateWorldStats() {
|
||||
world.getStats()->setWorldTimeElapsed(world.getTimeFlow()->getTime());
|
||||
|
||||
if(difftime(time(NULL),lastMaxUnitCalcTime) >= 1) {
|
||||
if(difftime((long int)time(NULL),lastMaxUnitCalcTime) >= 1) {
|
||||
lastMaxUnitCalcTime = time(NULL);
|
||||
|
||||
int totalUnitcount = 0;
|
||||
|
@ -3867,7 +3874,7 @@ void Game::render2d() {
|
|||
std::map<int,string> factionDebugInfo;
|
||||
|
||||
if( renderer.getShowDebugUI() == true ||
|
||||
(perfLogging == true && difftime(time(NULL),lastRenderLog2d) >= 1)) {
|
||||
(perfLogging == true && difftime((long int)time(NULL),lastRenderLog2d) >= 1)) {
|
||||
str = getDebugStats(factionDebugInfo);
|
||||
}
|
||||
|
||||
|
@ -3973,7 +3980,7 @@ void Game::render2d() {
|
|||
//2d mouse
|
||||
renderer.renderMouse2d(mouseX, mouseY, mouse2d, gui.isSelectingPos()? 1.f: 0.f);
|
||||
|
||||
if(perfLogging == true && difftime(time(NULL),lastRenderLog2d) >= 1) {
|
||||
if(perfLogging == true && difftime((long int)time(NULL),lastRenderLog2d) >= 1) {
|
||||
lastRenderLog2d = time(NULL);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] Statistics: %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,str.c_str());
|
||||
|
|
|
@ -91,7 +91,7 @@ private:
|
|||
|
||||
int updateFps, lastUpdateFps, avgUpdateFps;
|
||||
int totalRenderFps, renderFps, lastRenderFps, avgRenderFps,currentAvgRenderFpsTotal;
|
||||
Uint64 tickCount;
|
||||
uint64 tickCount;
|
||||
bool paused;
|
||||
bool gameOver;
|
||||
bool renderNetworkStatus;
|
||||
|
|
|
@ -58,6 +58,7 @@ GameCamera::GameCamera() : pos(0.f, defaultHeight, 0.f),
|
|||
//config
|
||||
speed= 15.f / GameConstants::cameraFps;
|
||||
clampBounds= !Config::getInstance().getBool("PhotoMode");
|
||||
clampDisable = false;
|
||||
|
||||
vAng= startingVAng;
|
||||
hAng= startingHAng;
|
||||
|
@ -122,6 +123,14 @@ void GameCamera::setPos(Vec2f pos){
|
|||
destPos.z = pos.y;
|
||||
}
|
||||
|
||||
void GameCamera::setPos(Vec3f pos){
|
||||
this->pos= pos;
|
||||
//clampPosXZ(0.0f, (float)limitX, 0.0f, (float)limitY);
|
||||
destPos.x = pos.x;
|
||||
destPos.y = pos.y;
|
||||
destPos.z = pos.z;
|
||||
}
|
||||
|
||||
void GameCamera::update(){
|
||||
|
||||
//move XZ
|
||||
|
@ -143,13 +152,13 @@ void GameCamera::update(){
|
|||
}
|
||||
if(move.y>0){
|
||||
moveUp(speed * move.y);
|
||||
if(clampBounds && pos.y<maxHeight){
|
||||
if(clampDisable == false && clampBounds && pos.y<maxHeight){
|
||||
rotateHV(0.f, -speed * 1.7f * move.y);
|
||||
}
|
||||
}
|
||||
if(move.y<0){
|
||||
moveUp(speed * move.y);
|
||||
if(clampBounds && pos.y>minHeight){
|
||||
if(clampDisable == false && clampBounds && pos.y>minHeight){
|
||||
rotateHV(0.f, -speed * 1.7f * move.y);
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +191,7 @@ void GameCamera::update(){
|
|||
|
||||
clampAng();
|
||||
|
||||
if(clampBounds){
|
||||
if(clampDisable == false && clampBounds){
|
||||
clampPosXYZ(0.0f, (float)limitX, minHeight, maxHeight, 0.0f, (float)limitY);
|
||||
}
|
||||
}
|
||||
|
@ -341,6 +350,10 @@ void GameCamera::save(XmlNode *node) const {
|
|||
// ==================== PRIVATE ====================
|
||||
|
||||
void GameCamera::clampPosXZ(float x1, float x2, float z1, float z2){
|
||||
if(clampDisable == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(pos.x < x1) pos.x = x1;
|
||||
if(destPos.x < x1) destPos.x = x1;
|
||||
if(pos.z < z1) pos.z = z1;
|
||||
|
@ -352,6 +365,10 @@ void GameCamera::clampPosXZ(float x1, float x2, float z1, float z2){
|
|||
}
|
||||
|
||||
void GameCamera::clampPosXYZ(float x1, float x2, float y1, float y2, float z1, float z2){
|
||||
if(clampDisable == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(pos.x < x1) pos.x = x1;
|
||||
if(destPos.x < x1) destPos.x = x1;
|
||||
if(pos.y < y1) pos.y = y1;
|
||||
|
@ -373,6 +390,10 @@ void GameCamera::rotateHV(float h, float v){
|
|||
}
|
||||
|
||||
void GameCamera::clampAng() {
|
||||
if(clampDisable == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(vAng > maxVAng) vAng = maxVAng;
|
||||
if(destAng.x > maxVAng) destAng.x = maxVAng;
|
||||
if(vAng < minVAng) vAng = minVAng;
|
||||
|
|
|
@ -79,6 +79,7 @@ private:
|
|||
//config
|
||||
float speed;
|
||||
bool clampBounds;
|
||||
bool clampDisable;
|
||||
//float maxRenderDistance;
|
||||
float maxHeight;
|
||||
float minHeight;
|
||||
|
@ -108,6 +109,7 @@ public:
|
|||
//set
|
||||
void setRotate(float rotate){this->rotate= rotate;}
|
||||
void setPos(Vec2f pos);
|
||||
void setPos(Vec3f pos);
|
||||
|
||||
void setMoveX(float f) {this->move.x= f;}
|
||||
void setMoveY(float f) {this->move.y= f;}
|
||||
|
@ -148,6 +150,7 @@ public:
|
|||
void save(XmlNode *node) const;
|
||||
|
||||
void setClampBounds(bool value) { clampBounds = value; }
|
||||
void setClampDisabled(bool value) { clampDisable = value; };
|
||||
void setMaxHeight(float value);
|
||||
float getCalculatedDefault() const{ return calculatedDefault; }
|
||||
void setCalculatedDefault(float calculatedDefault);
|
||||
|
@ -157,6 +160,9 @@ public:
|
|||
void setMinVAng(float value) { minVAng = value; }
|
||||
void setMaxVAng(float value) { maxVAng = value; }
|
||||
|
||||
void setHAng(float value) { hAng=value;};
|
||||
void setVAng(float value) { vAng=value;}
|
||||
|
||||
void saveGame(XmlNode *rootNode);
|
||||
void loadGame(const XmlNode *rootNode);
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "vec.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "conversion.h"
|
||||
#include <stdexcept>
|
||||
|
||||
// ==============================================================
|
||||
|
@ -21,6 +22,7 @@
|
|||
|
||||
using namespace Shared::Graphics;
|
||||
using namespace std;
|
||||
using namespace Shared::Util;
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
|
||||
|
|
|
@ -79,11 +79,12 @@ string PlayerStats::getStats() const {
|
|||
default:
|
||||
printf("Error control = %d\n",control);
|
||||
assert(false);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
if(control != ctHuman && control != ctNetwork ||
|
||||
control == ctNetwork && playerLeftBeforeEnd==true) {
|
||||
if((control != ctHuman && control != ctNetwork) ||
|
||||
(control == ctNetwork && playerLeftBeforeEnd == true)) {
|
||||
controlString += " x " + floatToStr(resourceMultiplier,1);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
maxConcurrentUnitCount = 0;
|
||||
totalEndGameConcurrentUnitCount = 0;
|
||||
isMasterserverMode = false;
|
||||
timePlayed = 0;
|
||||
}
|
||||
|
||||
void init(int factionCount, int thisFactionIndex, const string &description);
|
||||
|
|
|
@ -416,6 +416,7 @@ string Lang::get(const string &s, string uselanguage, bool fallbackToDefault) {
|
|||
|
||||
return "???" + s + "???";
|
||||
}
|
||||
return "???" + s + "???";
|
||||
}
|
||||
|
||||
string Lang::getScenarioString(const string &s) {
|
||||
|
@ -430,6 +431,7 @@ string Lang::getScenarioString(const string &s) {
|
|||
}
|
||||
return "???" + s + "???";
|
||||
}
|
||||
return "???" + s + "???";
|
||||
}
|
||||
|
||||
string Lang::getTechTreeString(const string &s,const char *defaultValue) {
|
||||
|
@ -459,6 +461,7 @@ string Lang::getTechTreeString(const string &s,const char *defaultValue) {
|
|||
}
|
||||
return "???" + s + "???";
|
||||
}
|
||||
return "???" + s + "???";
|
||||
}
|
||||
|
||||
string Lang::getTilesetString(const string &s,const char *defaultValue) {
|
||||
|
@ -488,6 +491,7 @@ string Lang::getTilesetString(const string &s,const char *defaultValue) {
|
|||
}
|
||||
return "???" + s + "???";
|
||||
}
|
||||
return "???" + s + "???";
|
||||
}
|
||||
|
||||
bool Lang::fileMatchesISO630Code(string uselanguage, string testLanguageFile) {
|
||||
|
|
|
@ -161,6 +161,20 @@ Renderer::Renderer() : BaseRenderer() {
|
|||
//assert(0==1);
|
||||
|
||||
Renderer::rendererEnded = false;
|
||||
shadowAlpha = 0;
|
||||
shadowFrameSkip = 0;
|
||||
triangleCount = 0;
|
||||
smoothedRenderFps = 0;
|
||||
shadowTextureSize = 0;
|
||||
shadows = sDisabled;
|
||||
shadowMapFrame = 0;
|
||||
textures3D = false;
|
||||
photoMode = false;
|
||||
focusArrows = false;
|
||||
pointCount = 0;
|
||||
maxLights = 0;
|
||||
waterAnim = 0;
|
||||
|
||||
this->allowRenderUnitTitles = false;
|
||||
this->menu = NULL;
|
||||
this->game = NULL;
|
||||
|
@ -246,7 +260,7 @@ void Renderer::cleanupScreenshotThread() {
|
|||
if(saveScreenShotThread) {
|
||||
saveScreenShotThread->signalQuit();
|
||||
for(time_t elapsed = time(NULL);
|
||||
getSaveScreenQueueSize() > 0 && difftime(time(NULL),elapsed) <= 7;) {
|
||||
getSaveScreenQueueSize() > 0 && difftime((long int)time(NULL),elapsed) <= 7;) {
|
||||
sleep(0);
|
||||
}
|
||||
if(saveScreenShotThread->canShutdown(true) == true &&
|
||||
|
@ -870,7 +884,7 @@ Font3D *Renderer::newFont3D(ResourceScope rs){
|
|||
return fontManager[rs]->newFont3D();
|
||||
}
|
||||
|
||||
void Renderer::endFont(Font *font, ResourceScope rs, bool mustExistInList) {
|
||||
void Renderer::endFont(Shared::Graphics::Font *font, ResourceScope rs, bool mustExistInList) {
|
||||
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||
return;
|
||||
}
|
||||
|
@ -1633,7 +1647,7 @@ void Renderer::computeVisibleQuad() {
|
|||
visibleQuad.p[3].x,visibleQuad.p[3].y);
|
||||
}
|
||||
}
|
||||
catch(PROJECTION_TO_INFINITY e) {
|
||||
catch(PROJECTION_TO_INFINITY &e) {
|
||||
if(debug) printf("hmm staring at the horizon %d\n",(int)e);
|
||||
// use historic code solution
|
||||
visibleQuad = this->gameCamera->computeVisibleQuad();
|
||||
|
@ -2551,7 +2565,7 @@ void Renderer::renderTextBoundingBox3D(const string &text, Font3D *font,
|
|||
for(int i = 0; i < useWidth; ++i) {
|
||||
temp += DEFAULT_CHAR_FOR_WIDTH_CALC;
|
||||
}
|
||||
float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * Font::scaleFontValue);
|
||||
float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * Shared::Graphics::Font::scaleFontValue);
|
||||
useWidth = (int)lineWidth;
|
||||
|
||||
maxEditWidth = useWidth;
|
||||
|
@ -2622,7 +2636,7 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
|
|||
throw megaglest_runtime_error("font->getTextHandler() == NULL (5)");
|
||||
}
|
||||
|
||||
float lineWidth = (font->getTextHandler()->Advance(text.c_str()) * Font::scaleFontValue);
|
||||
float lineWidth = (font->getTextHandler()->Advance(text.c_str()) * Shared::Graphics::Font::scaleFontValue);
|
||||
if(lineWidth < w) {
|
||||
pos.x += ((w / 2.f) - (lineWidth / 2.f));
|
||||
}
|
||||
|
@ -2638,7 +2652,7 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
|
|||
|
||||
//const Metrics &metrics= Metrics::getInstance();
|
||||
//float lineHeight = (font->getTextHandler()->LineHeight(text.c_str()) * Font::scaleFontValue);
|
||||
float lineHeight = (font->getTextHandler()->LineHeight(text.c_str()) * Font::scaleFontValue);
|
||||
float lineHeight = (font->getTextHandler()->LineHeight(text.c_str()) * Shared::Graphics::Font::scaleFontValue);
|
||||
//lineHeight=metrics.toVirtualY(lineHeight);
|
||||
//lineHeight= lineHeight / (2.f + 0.2f * FontMetrics::DEFAULT_Y_OFFSET_FACTOR);
|
||||
//pos.y += (h / 2.f) - (lineHeight / 2.f);
|
||||
|
@ -2651,7 +2665,7 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
|
|||
//if(Font::forceFTGLFonts == true) {
|
||||
// First go to top of bounding box
|
||||
pos.y += (h - lineHeight);
|
||||
pos.y -= ((h - lineHeight) / Font::scaleFontValueCenterHFactor);
|
||||
pos.y -= ((h - lineHeight) / Shared::Graphics::Font::scaleFontValueCenterHFactor);
|
||||
// }
|
||||
// else {
|
||||
// pos.y += (float)(((float)h) / 2.0);
|
||||
|
@ -2702,7 +2716,7 @@ void Renderer::renderTextBoundingBox3D(const string &text, Font3D *font,
|
|||
for(int i = 0; i < useWidth; ++i) {
|
||||
temp += DEFAULT_CHAR_FOR_WIDTH_CALC;
|
||||
}
|
||||
float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * Font::scaleFontValue);
|
||||
float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * Shared::Graphics::Font::scaleFontValue);
|
||||
useWidth = (int)lineWidth;
|
||||
|
||||
maxEditWidth = useWidth;
|
||||
|
@ -2784,7 +2798,7 @@ void Renderer::renderTextBoundingBox3D(const string &text, Font3D *font,
|
|||
for(int i = 0; i < useWidth; ++i) {
|
||||
temp += DEFAULT_CHAR_FOR_WIDTH_CALC;
|
||||
}
|
||||
float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * Font::scaleFontValue);
|
||||
float lineWidth = (font->getTextHandler()->Advance(temp.c_str()) * Shared::Graphics::Font::scaleFontValue);
|
||||
useWidth = (int)lineWidth;
|
||||
|
||||
maxEditWidth = useWidth;
|
||||
|
@ -5261,6 +5275,7 @@ void Renderer::renderSelectionEffects() {
|
|||
break;
|
||||
default:
|
||||
arrowColor= Vec3f(1.f, 1.f, 0.f);
|
||||
break;
|
||||
}
|
||||
|
||||
//arrow target
|
||||
|
|
|
@ -366,7 +366,7 @@ private:
|
|||
vbo_vertices(0), vbo_normals(0),
|
||||
vbo_fowTexCoords(0), vbo_surfTexCoords(0),
|
||||
vbo_indices(0), indexCount(0),
|
||||
textureHandle(th) {}
|
||||
textureHandle(th),textureCRC(0) {}
|
||||
~Layer();
|
||||
void load_vbos(bool vboEnabled);
|
||||
void render(VisibleQuadContainerCache &qCache);
|
||||
|
@ -444,7 +444,7 @@ public:
|
|||
Texture3D *newTexture3D(ResourceScope rs);
|
||||
Font2D *newFont(ResourceScope rs);
|
||||
Font3D *newFont3D(ResourceScope rs);
|
||||
void endFont(Font *font, ResourceScope rs, bool mustExistInList=false);
|
||||
void endFont(Shared::Graphics::Font *font, ResourceScope rs, bool mustExistInList=false);
|
||||
void resetFontManager(ResourceScope rs);
|
||||
|
||||
inline TextRenderer2D *getTextRenderer() const {return textRenderer;}
|
||||
|
|
|
@ -314,6 +314,7 @@ void BattleEnd::render() {
|
|||
default:
|
||||
printf("Error control = %d for i = %d\n",stats.getControl(i),i);
|
||||
assert(false);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ static bool gameInitialized = false;
|
|||
|
||||
static Program *mainProgram = NULL;
|
||||
static FileCRCPreCacheThread *preCacheThread = NULL;
|
||||
static string runtimeErrorMsg = "";
|
||||
//static string runtimeErrorMsg = "";
|
||||
|
||||
void cleanupCRCThread() {
|
||||
if(preCacheThread != NULL) {
|
||||
|
@ -114,14 +114,14 @@ void cleanupCRCThread() {
|
|||
time_t elapsed = time(NULL);
|
||||
preCacheThread->signalQuit();
|
||||
for(;preCacheThread->canShutdown(false) == false &&
|
||||
difftime(time(NULL),elapsed) <= MAX_THREAD_WAIT;) {
|
||||
difftime((long int)time(NULL),elapsed) <= MAX_THREAD_WAIT;) {
|
||||
//sleep(150);
|
||||
}
|
||||
if(difftime(time(NULL),elapsed) <= MAX_THREAD_WAIT) {
|
||||
if(difftime((long int)time(NULL),elapsed) <= MAX_THREAD_WAIT) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("B - shutting down crc threads\n");
|
||||
|
||||
for(;preCacheThread->shutdownAndWait() == false &&
|
||||
difftime(time(NULL),elapsed) <= MAX_THREAD_WAIT;) {
|
||||
difftime((long int)time(NULL),elapsed) <= MAX_THREAD_WAIT;) {
|
||||
}
|
||||
if(preCacheThread->getRunningStatus() == false) {
|
||||
delete preCacheThread;
|
||||
|
@ -173,7 +173,7 @@ static void cleanupProcessObjects() {
|
|||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("start running threads = %lu\n",Thread::getThreadList().size());
|
||||
time_t elapsed = time(NULL);
|
||||
for(;Thread::getThreadList().size() > 0 &&
|
||||
difftime(time(NULL),elapsed) <= 10;) {
|
||||
difftime((long int)time(NULL),elapsed) <= 10;) {
|
||||
//sleep(0);
|
||||
}
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("end running threads = %lu\n",Thread::getThreadList().size());
|
||||
|
@ -405,7 +405,7 @@ public:
|
|||
if(glActiveTexture != NULL) {
|
||||
for(;GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && mainProgram->isMessageShowing();) {
|
||||
//program->getState()->render();
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
mainProgram->loop();
|
||||
|
||||
//printf("\nhandle error #1\n");
|
||||
|
@ -420,7 +420,7 @@ public:
|
|||
if(glActiveTexture != NULL) {
|
||||
for(;GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false && mainProgram->isMessageShowing();) {
|
||||
//program->renderProgramMsgBox();
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
mainProgram->loop();
|
||||
|
||||
//printf("\nhandle error #2\n");
|
||||
|
@ -891,9 +891,9 @@ void MainWindow::eventKeyDown(SDL_KeyboardEvent key) {
|
|||
renderer.setShowDebugUI(!showDebugUI);
|
||||
}
|
||||
}
|
||||
else if(keystate.mod & (KMOD_LCTRL | KMOD_RCTRL) &&
|
||||
else if((keystate.mod & (KMOD_LCTRL | KMOD_RCTRL)) &&
|
||||
isKeyPressed(configKeys.getSDLKey("SwitchLanguage"),key) == true) {
|
||||
if(keystate.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) {
|
||||
if((keystate.mod & (KMOD_LSHIFT | KMOD_RSHIFT))) {
|
||||
//toggleLanguage("");
|
||||
this->triggerLanguageToggle = true;
|
||||
this->triggerLanguage = "";
|
||||
|
@ -3333,7 +3333,7 @@ int glestMain(int argc, char** argv) {
|
|||
}
|
||||
|
||||
if(config.getBool("ForceFTGLFonts","false") == true || hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_FORCE_FTGLFONTS]) == true) {
|
||||
Font::forceFTGLFonts = true;
|
||||
Shared::Graphics::Font::forceFTGLFonts = true;
|
||||
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**WARNING** Forcing Legacy Fonts Enabled\n");
|
||||
printf("**WARNING** Forcing use of FTGL Fonts\n");
|
||||
}
|
||||
|
@ -3342,7 +3342,7 @@ int glestMain(int argc, char** argv) {
|
|||
}
|
||||
|
||||
if(config.getBool("EnableLegacyFonts","false") == true || hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_ENABLE_LEGACYFONTS]) == true) {
|
||||
Font::forceLegacyFonts = true;
|
||||
Shared::Graphics::Font::forceLegacyFonts = true;
|
||||
Renderer::renderText3DEnabled = false;
|
||||
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**WARNING** Forcing Legacy Fonts Enabled\n");
|
||||
printf("**WARNING** Forcing Legacy Fonts Enabled\n");
|
||||
|
@ -3494,14 +3494,14 @@ int glestMain(int argc, char** argv) {
|
|||
|
||||
// 256 for English
|
||||
// 30000 for Chinese
|
||||
Font::charCount = config.getInt("FONT_CHARCOUNT",intToStr(Font::charCount).c_str());
|
||||
Font::fontTypeName = config.getString("FONT_TYPENAME",Font::fontTypeName.c_str());
|
||||
Font::fontIsMultibyte = config.getBool("FONT_MULTIBYTE",intToStr(Font::fontIsMultibyte).c_str());
|
||||
Font::fontIsRightToLeft = config.getBool("FONT_RIGHTTOLEFT",intToStr(Font::fontIsRightToLeft).c_str());
|
||||
Font::baseSize = config.getInt("FONT_BASE_SIZE",intToStr(Font::baseSize).c_str());
|
||||
Font::scaleFontValue = config.getFloat("FONT_SCALE_SIZE",floatToStr(Font::scaleFontValue).c_str());
|
||||
Font::scaleFontValueCenterHFactor = config.getFloat("FONT_SCALE_CENTERH_FACTOR",floatToStr(Font::scaleFontValueCenterHFactor).c_str());
|
||||
Font::langHeightText = config.getString("FONT_HEIGHT_TEXT",Font::langHeightText.c_str());
|
||||
Shared::Graphics::Font::charCount = config.getInt("FONT_CHARCOUNT",intToStr(Shared::Graphics::Font::charCount).c_str());
|
||||
Shared::Graphics::Font::fontTypeName = config.getString("FONT_TYPENAME",Shared::Graphics::Font::fontTypeName.c_str());
|
||||
Shared::Graphics::Font::fontIsMultibyte = config.getBool("FONT_MULTIBYTE",intToStr(Shared::Graphics::Font::fontIsMultibyte).c_str());
|
||||
Shared::Graphics::Font::fontIsRightToLeft = config.getBool("FONT_RIGHTTOLEFT",intToStr(Shared::Graphics::Font::fontIsRightToLeft).c_str());
|
||||
Shared::Graphics::Font::baseSize = config.getInt("FONT_BASE_SIZE",intToStr(Shared::Graphics::Font::baseSize).c_str());
|
||||
Shared::Graphics::Font::scaleFontValue = config.getFloat("FONT_SCALE_SIZE",floatToStr(Shared::Graphics::Font::scaleFontValue).c_str());
|
||||
Shared::Graphics::Font::scaleFontValueCenterHFactor = config.getFloat("FONT_SCALE_CENTERH_FACTOR",floatToStr(Shared::Graphics::Font::scaleFontValueCenterHFactor).c_str());
|
||||
Shared::Graphics::Font::langHeightText = config.getString("FONT_HEIGHT_TEXT",Shared::Graphics::Font::langHeightText.c_str());
|
||||
|
||||
// Example values:
|
||||
// DEFAULT_CHARSET (English) = 1
|
||||
|
@ -3514,8 +3514,8 @@ int glestMain(int argc, char** argv) {
|
|||
SystemFlags::DEFAULT_HTTP_TIMEOUT = config.getInt("DEFAULT_HTTP_TIMEOUT",intToStr(SystemFlags::DEFAULT_HTTP_TIMEOUT).c_str());
|
||||
}
|
||||
|
||||
bool allowAltEnterFullscreenToggle = config.getBool("AllowAltEnterFullscreenToggle",boolToStr(Window::getAllowAltEnterFullscreenToggle()).c_str());
|
||||
Window::setAllowAltEnterFullscreenToggle(allowAltEnterFullscreenToggle);
|
||||
bool allowAltEnterFullscreenToggle = config.getBool("AllowAltEnterFullscreenToggle",boolToStr(Shared::Platform::Window::getAllowAltEnterFullscreenToggle()).c_str());
|
||||
Shared::Platform::Window::setAllowAltEnterFullscreenToggle(allowAltEnterFullscreenToggle);
|
||||
|
||||
if(config.getBool("noTeamColors","false") == true) {
|
||||
MeshCallbackTeamColor::noTeamColors = true;
|
||||
|
@ -3524,7 +3524,7 @@ int glestMain(int argc, char** argv) {
|
|||
// Setup debug logging etc
|
||||
setupLogging(config, haveSpecialOutputCommandLineOption);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, fontIsRightToLeft = %d\n",__FILE__,__FUNCTION__,__LINE__,Font::charCount,Font::fontTypeName.c_str(),Shared::Platform::charSet,Font::fontIsMultibyte, Font::fontIsRightToLeft);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, fontIsRightToLeft = %d\n",__FILE__,__FUNCTION__,__LINE__,Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::charSet,Shared::Graphics::Font::fontIsMultibyte, Shared::Graphics::Font::fontIsRightToLeft);
|
||||
|
||||
NetworkInterface::setDisplayMessageFunction(ExceptionHandler::DisplayMessage);
|
||||
MenuStateMasterserver::setDisplayMessageFunction(ExceptionHandler::DisplayMessage);
|
||||
|
@ -3560,7 +3560,7 @@ int glestMain(int argc, char** argv) {
|
|||
}
|
||||
|
||||
if(config.getBool("EnableVSynch","false") == true) {
|
||||
Window::setTryVSynch(true);
|
||||
Shared::Platform::Window::setTryVSynch(true);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**ENABLED OPENGL VSYNCH**\n");
|
||||
}
|
||||
|
||||
|
@ -3671,7 +3671,7 @@ int glestMain(int argc, char** argv) {
|
|||
lang.loadStrings(language,false, true);
|
||||
|
||||
if( lang.hasString("FONT_HEIGHT_TEXT")) {
|
||||
Font::langHeightText = config.getString("FONT_HEIGHT_TEXT",Font::langHeightText.c_str());
|
||||
Shared::Graphics::Font::langHeightText = config.getString("FONT_HEIGHT_TEXT",Shared::Graphics::Font::langHeightText.c_str());
|
||||
}
|
||||
|
||||
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_FONT_BASESIZE]) == true) {
|
||||
|
@ -3688,7 +3688,7 @@ int glestMain(int argc, char** argv) {
|
|||
//printf("#1 Forcing font [%s] paramPartTokens.size() = %d, paramValue [%s]\n",newfont.c_str(),paramPartTokens.size(),paramValue.c_str());
|
||||
printf("Forcing font base size[%s]\n",newfontBaseSize.c_str());
|
||||
|
||||
Font::baseSize = strToInt(newfontBaseSize);
|
||||
Shared::Graphics::Font::baseSize = strToInt(newfontBaseSize);
|
||||
}
|
||||
else {
|
||||
printf("\nInvalid missing font base size specified on commandline [%s] value [%s]\n\n",argv[foundParamIndIndex],(paramPartTokens.size() >= 2 ? paramPartTokens[1].c_str() : NULL));
|
||||
|
@ -3698,8 +3698,8 @@ int glestMain(int argc, char** argv) {
|
|||
}
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",__FILE__,__FUNCTION__,__LINE__,Font::charCount,Font::fontTypeName.c_str(),Shared::Platform::charSet,Font::fontIsMultibyte,Font::fontIsRightToLeft);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Using Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",Font::charCount,Font::fontTypeName.c_str(),Shared::Platform::charSet,Font::fontIsMultibyte,Font::fontIsRightToLeft);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",__FILE__,__FUNCTION__,__LINE__,Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::charSet,Shared::Graphics::Font::fontIsMultibyte,Shared::Graphics::Font::fontIsRightToLeft);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Using Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::charSet,Shared::Graphics::Font::fontIsMultibyte,Shared::Graphics::Font::fontIsRightToLeft);
|
||||
|
||||
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_USE_FONT]) == true) {
|
||||
int foundParamIndIndex = -1;
|
||||
|
@ -4466,7 +4466,7 @@ int glestMain(int argc, char** argv) {
|
|||
}
|
||||
|
||||
sleep(0);
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
|
||||
int result = 0;
|
||||
|
@ -4497,7 +4497,7 @@ int glestMain(int argc, char** argv) {
|
|||
renderer.swapBuffers();
|
||||
|
||||
sleep(0);
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
SDL_PumpEvents();
|
||||
|
||||
Model *model = renderer.newModel(rsGlobal);
|
||||
|
@ -4618,7 +4618,7 @@ int glestMain(int argc, char** argv) {
|
|||
//throw megaglest_runtime_error("Test!");
|
||||
|
||||
//main loop
|
||||
while(program->isShutdownApplicationEnabled() == false && Window::handleEvent()) {
|
||||
while(program->isShutdownApplicationEnabled() == false && Shared::Platform::Window::handleEvent()) {
|
||||
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||
|
||||
if(disableheadless_console == false) {
|
||||
|
|
|
@ -161,7 +161,7 @@ private:
|
|||
|
||||
public:
|
||||
Program();
|
||||
~Program();
|
||||
virtual ~Program();
|
||||
|
||||
static Program *getInstance() {return singleton;}
|
||||
|
||||
|
|
|
@ -1070,7 +1070,7 @@ void MenuStateConnectedGame::broadCastGameSettingsToHeadlessServer(bool forceNow
|
|||
}
|
||||
|
||||
if(forceNow == true ||
|
||||
((needToBroadcastServerSettings == true ) && ( difftime(time(NULL),broadcastServerSettingsDelayTimer) >= HEADLESSSERVER_BROADCAST_SETTINGS_SECONDS))) {
|
||||
((needToBroadcastServerSettings == true ) && ( difftime((long int)time(NULL),broadcastServerSettingsDelayTimer) >= HEADLESSSERVER_BROADCAST_SETTINGS_SECONDS))) {
|
||||
//printf("In [%s:%s] Line: %d forceNow = %d broadcastServerSettingsDelayTimer = %lu, now =%lu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,forceNow,broadcastServerSettingsDelayTimer,time(NULL));
|
||||
|
||||
needToBroadcastServerSettings = false;
|
||||
|
@ -1800,7 +1800,7 @@ void MenuStateConnectedGame::render() {
|
|||
clientInterface->getGameSettings()->getMasterserver_admin() > 0 &&
|
||||
clientInterface->getGameSettings()->getMasterserver_admin_faction_index() == i) {
|
||||
|
||||
if(difftime(time(NULL),timerLabelFlash) < 1) {
|
||||
if(difftime((long int)time(NULL),timerLabelFlash) < 1) {
|
||||
renderer.renderLabel(&labelPlayers[i],&playerColor);
|
||||
}
|
||||
else {
|
||||
|
@ -1858,7 +1858,7 @@ void MenuStateConnectedGame::render() {
|
|||
renderer.renderLabel(&labelStatus);
|
||||
renderer.renderLabel(&labelInfo);
|
||||
|
||||
if(difftime(time(NULL),timerLabelFlash) < 1) {
|
||||
if(difftime((long int)time(NULL),timerLabelFlash) < 1) {
|
||||
renderer.renderLabel(&labelDataSynchInfo,&RED);
|
||||
}
|
||||
else {
|
||||
|
@ -1962,7 +1962,7 @@ void MenuStateConnectedGame::render() {
|
|||
renderer.renderChatManager(&chatManager);
|
||||
renderer.renderConsole(&console,showFullConsole,true);
|
||||
|
||||
if(difftime(time(NULL),timerLabelFlash) > 2) {
|
||||
if(difftime((long int)time(NULL),timerLabelFlash) > 2) {
|
||||
timerLabelFlash = time(NULL);
|
||||
}
|
||||
}
|
||||
|
@ -2012,11 +2012,11 @@ void MenuStateConnectedGame::update() {
|
|||
}
|
||||
}
|
||||
|
||||
if(difftime(time(NULL),lastNetworkSendPing) >= GameConstants::networkPingInterval) {
|
||||
if(difftime((long int)time(NULL),lastNetworkSendPing) >= GameConstants::networkPingInterval) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to sendPingMessage...\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
lastNetworkSendPing = time(NULL);
|
||||
clientInterface->sendPingMessage(GameConstants::networkPingInterval, time(NULL));
|
||||
clientInterface->sendPingMessage(GameConstants::networkPingInterval, (int64)time(NULL));
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pingCount = %d, clientInterface->getLastPingLag() = %f, GameConstants::networkPingInterval = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,pingCount, clientInterface->getLastPingLag(),GameConstants::networkPingInterval);
|
||||
|
||||
|
@ -2101,7 +2101,7 @@ void MenuStateConnectedGame::update() {
|
|||
|
||||
const time_t REFRESH_CRC_DAY_SECONDS = 60 * 60 * 1;
|
||||
if( lastUpdateDate <= 0 ||
|
||||
difftime(time(NULL),lastUpdateDate) >= REFRESH_CRC_DAY_SECONDS) {
|
||||
difftime((long int)time(NULL),lastUpdateDate) >= REFRESH_CRC_DAY_SECONDS) {
|
||||
techCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), string("/") + gameSettings->getTech() + string("/*"), ".xml", NULL, true);
|
||||
//clientInterface->sendTextMessage("#3 TechCRC = " + intToStr(techCRC) + " remoteCRC = " + intToStr(gameSettings->getTechCRC()),-1, true, "");
|
||||
}
|
||||
|
@ -2126,7 +2126,7 @@ void MenuStateConnectedGame::update() {
|
|||
|
||||
const time_t REFRESH_CRC_DAY_SECONDS = 60 * 60 * 24;
|
||||
if( lastUpdateDate <= 0 ||
|
||||
difftime(time(NULL),lastUpdateDate) >= REFRESH_CRC_DAY_SECONDS ||
|
||||
difftime((long int)time(NULL),lastUpdateDate) >= REFRESH_CRC_DAY_SECONDS ||
|
||||
(techCRC != 0 && techCRC != gameSettings->getTechCRC())) {
|
||||
factionCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), "/" + gameSettings->getTech() + "/factions/" + factionName + "/*", ".xml", NULL, true);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <iterator>
|
||||
#include "map_preview.h"
|
||||
#include "string_utils.h"
|
||||
#include "network_message.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
|
@ -252,7 +253,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
|
|||
listBoxTileset.init(xoffset+460, mapPos, 150);
|
||||
//listBoxTileset.setItems(results);
|
||||
setupTilesetList("");
|
||||
srand(time(NULL));
|
||||
srand((unsigned int)time(NULL));
|
||||
listBoxTileset.setSelectedItemIndex(rand() % listBoxTileset.getItemCount());
|
||||
|
||||
//tech Tree listBox
|
||||
|
@ -903,7 +904,7 @@ void MenuStateCustomGame::cleanup() {
|
|||
time_t elapsed = time(NULL);
|
||||
publishToMasterserverThread->signalQuit();
|
||||
for(;publishToMasterserverThread->canShutdown(false) == false &&
|
||||
difftime(time(NULL),elapsed) <= 15;) {
|
||||
difftime((long int)time(NULL),elapsed) <= 15;) {
|
||||
//sleep(150);
|
||||
}
|
||||
if(publishToMasterserverThread->canShutdown(true)) {
|
||||
|
@ -1273,7 +1274,7 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
int slotsToChangeStart = i;
|
||||
int slotsToChangeEnd = i;
|
||||
// If control is pressed while changing player types then change all other slots to same type
|
||||
if(Window::isKeyStateModPressed(KMOD_CTRL) == true) {
|
||||
if(Shared::Platform::Window::isKeyStateModPressed(KMOD_CTRL) == true) {
|
||||
slotsToChangeStart = 0;
|
||||
slotsToChangeEnd = mapInfo.players-1;
|
||||
}
|
||||
|
@ -1561,7 +1562,7 @@ void MenuStateCustomGame::PlayNow(bool saveGame) {
|
|||
|
||||
// Max 1000 tries to get a random, unused faction
|
||||
for(int findRandomFaction = 1; findRandomFaction < 1000; ++findRandomFaction) {
|
||||
srand(time(NULL) + findRandomFaction);
|
||||
srand((unsigned int)time(NULL) + findRandomFaction);
|
||||
int selectedFactionIndex = rand() % listBoxFactions[i].getItemCount();
|
||||
string selectedFactionName = listBoxFactions[i].getItem(selectedFactionIndex);
|
||||
|
||||
|
@ -2196,7 +2197,7 @@ void MenuStateCustomGame::update() {
|
|||
|
||||
if(needToLoadTextures) {
|
||||
// this delay is done to make it possible to switch faster
|
||||
if(difftime(time(NULL), previewLoadDelayTimer) >= 2){
|
||||
if(difftime((long int)time(NULL), previewLoadDelayTimer) >= 2){
|
||||
//loadScenarioPreviewTexture();
|
||||
needToLoadTextures= false;
|
||||
}
|
||||
|
@ -2501,7 +2502,7 @@ void MenuStateCustomGame::update() {
|
|||
|
||||
bool checkDataSynch = (serverInterface->getAllowGameDataSynchCheck() == true &&
|
||||
needToSetChangedGameSettings == true &&
|
||||
(( difftime(time(NULL),lastSetChangedGameSettings) >= BROADCAST_SETTINGS_SECONDS)||
|
||||
(( difftime((long int)time(NULL),lastSetChangedGameSettings) >= BROADCAST_SETTINGS_SECONDS)||
|
||||
(this->headlessServerMode == true)));
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
@ -2558,7 +2559,7 @@ void MenuStateCustomGame::update() {
|
|||
//listBoxEnableServerControlledAI.setEditable(false);
|
||||
}
|
||||
|
||||
bool republishToMaster = (difftime(time(NULL),lastMasterserverPublishing) >= MASTERSERVER_BROADCAST_PUBLISH_SECONDS);
|
||||
bool republishToMaster = (difftime((long int)time(NULL),lastMasterserverPublishing) >= MASTERSERVER_BROADCAST_PUBLISH_SECONDS);
|
||||
|
||||
if(republishToMaster == true) {
|
||||
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||
|
@ -2580,7 +2581,7 @@ void MenuStateCustomGame::update() {
|
|||
}
|
||||
if(needToPublishDelayed) {
|
||||
// this delay is done to make it possible to switch over maps which are not meant to be distributed
|
||||
if((difftime(time(NULL), mapPublishingDelayTimer) >= BROADCAST_MAP_DELAY_SECONDS) ||
|
||||
if((difftime((long int)time(NULL), mapPublishingDelayTimer) >= BROADCAST_MAP_DELAY_SECONDS) ||
|
||||
(this->headlessServerMode == true) ){
|
||||
// after 5 seconds we are allowed to publish again!
|
||||
needToSetChangedGameSettings = true;
|
||||
|
@ -2590,7 +2591,7 @@ void MenuStateCustomGame::update() {
|
|||
}
|
||||
}
|
||||
if(needToPublishDelayed == false || headlessServerMode == true) {
|
||||
bool broadCastSettings = (difftime(time(NULL),lastSetChangedGameSettings) >= BROADCAST_SETTINGS_SECONDS);
|
||||
bool broadCastSettings = (difftime((long int)time(NULL),lastSetChangedGameSettings) >= BROADCAST_SETTINGS_SECONDS);
|
||||
|
||||
//printf("broadCastSettings = %d\n",broadCastSettings);
|
||||
|
||||
|
@ -2885,7 +2886,7 @@ void MenuStateCustomGame::simpleTask(BaseThread *callingThread) {
|
|||
hasClientConnection = serverInterface->hasClientConnection();
|
||||
}
|
||||
}
|
||||
bool needPing = (difftime(time(NULL),lastNetworkPing) >= GameConstants::networkPingInterval);
|
||||
bool needPing = (difftime((long int)time(NULL),lastNetworkPing) >= GameConstants::networkPingInterval);
|
||||
|
||||
if(callingThread->getQuitStatus() == true) {
|
||||
return;
|
||||
|
@ -2940,7 +2941,7 @@ void MenuStateCustomGame::simpleTask(BaseThread *callingThread) {
|
|||
|
||||
// Give things another chance to see if we can get a connection from the master server
|
||||
if(tMasterserverErrorElapsed > 0 &&
|
||||
difftime(time(NULL),tMasterserverErrorElapsed) > MASTERSERVER_BROADCAST_MAX_WAIT_RESPONSE_SECONDS) {
|
||||
difftime((long int)time(NULL),tMasterserverErrorElapsed) > MASTERSERVER_BROADCAST_MAX_WAIT_RESPONSE_SECONDS) {
|
||||
showMasterserverError=true;
|
||||
masterServererErrorToShow = (serverInfo != "" ? serverInfo : "No Reply");
|
||||
}
|
||||
|
@ -2950,7 +2951,7 @@ void MenuStateCustomGame::simpleTask(BaseThread *callingThread) {
|
|||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line %d] error checking response from masterserver elapsed seconds = %.2f / %d\nResponse:\n%s\n",
|
||||
extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,difftime(time(NULL),tMasterserverErrorElapsed),MASTERSERVER_BROADCAST_MAX_WAIT_RESPONSE_SECONDS,serverInfo.c_str());
|
||||
extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,difftime((long int)time(NULL),tMasterserverErrorElapsed),MASTERSERVER_BROADCAST_MAX_WAIT_RESPONSE_SECONDS,serverInfo.c_str());
|
||||
|
||||
needToRepublishToMasterserver = true;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ void ClientInterface::shutdownNetworkCommandListThread() {
|
|||
time_t elapsed = time(NULL);
|
||||
networkCommandListThread->signalQuit();
|
||||
for(;networkCommandListThread->canShutdown(false) == false &&
|
||||
difftime(time(NULL),elapsed) <= 15;) {
|
||||
difftime((long int)time(NULL),elapsed) <= 15;) {
|
||||
//sleep(150);
|
||||
}
|
||||
if(networkCommandListThread->canShutdown(true)) {
|
||||
|
@ -168,7 +168,7 @@ void ClientInterface::update() {
|
|||
}
|
||||
}
|
||||
|
||||
double lastSendElapsed = difftime(time(NULL),lastNetworkCommandListSendTime);
|
||||
double lastSendElapsed = difftime((long int)time(NULL),lastNetworkCommandListSendTime);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
|
@ -583,8 +583,8 @@ void ClientInterface::updateLobby() {
|
|||
}
|
||||
|
||||
if( clientSocket != NULL && clientSocket->isConnected() == true &&
|
||||
gotIntro == false && difftime(time(NULL),connectedTime) > GameConstants::maxClientConnectHandshakeSecs) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] difftime(time(NULL),connectedTime) = %f\n",__FILE__,__FUNCTION__,__LINE__,difftime(time(NULL),connectedTime));
|
||||
gotIntro == false && difftime((long int)time(NULL),connectedTime) > GameConstants::maxClientConnectHandshakeSecs) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] difftime(time(NULL),connectedTime) = %f\n",__FILE__,__FUNCTION__,__LINE__,difftime((long int)time(NULL),connectedTime));
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
|||
if(clientSimulationLagStartTime == 0) {
|
||||
clientSimulationLagStartTime = time(NULL);
|
||||
}
|
||||
if(difftime(time(NULL),clientSimulationLagStartTime) <= Config::getInstance().getInt("SimulateClientLagDurationSeconds","0")) {
|
||||
if(difftime((long int)time(NULL),clientSimulationLagStartTime) <= Config::getInstance().getInt("SimulateClientLagDurationSeconds","0")) {
|
||||
sleep(Config::getInstance().getInt("SimulateClientLag","0"));
|
||||
}
|
||||
}
|
||||
|
@ -820,6 +820,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
|||
close();
|
||||
done= true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(isConnected() == false && quit == true) {
|
||||
|
@ -1138,7 +1139,7 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
|||
return;
|
||||
}
|
||||
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
// sleep a bit
|
||||
sleep(waitSleepTime);
|
||||
}
|
||||
|
|
|
@ -243,6 +243,7 @@ ConnectionSlot::ConnectionSlot(ServerInterface* serverInterface, int playerIndex
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
this->mutexSocket = new Mutex();
|
||||
this->socket = NULL;
|
||||
this->mutexCloseConnection = new Mutex();
|
||||
this->mutexPendingNetworkCommandList = new Mutex();
|
||||
this->socketSynchAccessor = new Mutex();
|
||||
|
@ -452,7 +453,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
if(this->isConnected() == true) {
|
||||
//RandomGen random;
|
||||
//sessionKey = random.randRange(-100000, 100000);
|
||||
srand(time(NULL) / (this->playerIndex + 1));
|
||||
srand((unsigned int)time(NULL) / (this->playerIndex + 1));
|
||||
sessionKey = rand() % 1000000;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] accepted new client connection, serverInterface->getOpenSlotCount() = %d, sessionKey = %d\n",__FILE__,__FUNCTION__,__LINE__,serverInterface->getOpenSlotCount(),sessionKey);
|
||||
|
@ -1143,11 +1144,11 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
double maxClientLagTimeAllowed = 8;
|
||||
|
||||
if(this->serverInterface->getGameStartTime() > 0 &&
|
||||
difftime(time(NULL),this->serverInterface->getGameStartTime()) >= LAG_CHECK_GRACE_PERIOD) {
|
||||
difftime((long int)time(NULL),this->serverInterface->getGameStartTime()) >= LAG_CHECK_GRACE_PERIOD) {
|
||||
if(this->isConnected() == true) {
|
||||
double clientLag = this->serverInterface->getCurrentFrameCount() - this->getCurrentFrameCount();
|
||||
double clientLagCount = (gameSettings.getNetworkFramePeriod() > 0 ? (clientLag / gameSettings.getNetworkFramePeriod()) : 0);
|
||||
double clientLagTime = difftime(time(NULL),this->getLastReceiveCommandListTime());
|
||||
double clientLagTime = difftime((long int)time(NULL),this->getLastReceiveCommandListTime());
|
||||
|
||||
// New lag check
|
||||
if((maxFrameCountLagAllowed > 0 && clientLagCount > maxFrameCountLagAllowed) ||
|
||||
|
@ -1200,7 +1201,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
void ConnectionSlot::validateConnection() {
|
||||
if(this->isConnected() == true &&
|
||||
gotIntro == false && connectedTime > 0 &&
|
||||
difftime(time(NULL),connectedTime) > GameConstants::maxClientConnectHandshakeSecs) {
|
||||
difftime((long int)time(NULL),connectedTime) > GameConstants::maxClientConnectHandshakeSecs) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
class ConnectionSlotCallbackInterface {
|
||||
public:
|
||||
virtual void slotUpdateTask(ConnectionSlotEvent *event) = 0;
|
||||
virtual ~ConnectionSlotCallbackInterface() {}
|
||||
};
|
||||
|
||||
class ConnectionSlotThread : public BaseThread
|
||||
|
|
|
@ -244,7 +244,7 @@ public:
|
|||
|
||||
NetworkMessagePing getLastPingInfo() const { return lastPingInfo; }
|
||||
double getLastPingLag() const {
|
||||
return difftime(time(NULL),lastPingInfo.getPingReceivedLocalTime());
|
||||
return difftime((long int)time(NULL),lastPingInfo.getPingReceivedLocalTime());
|
||||
}
|
||||
|
||||
std::string getIpAddress();
|
||||
|
|
|
@ -136,6 +136,7 @@ NetworkMessagePing::NetworkMessagePing(int32 pingFrequency, int64 pingTime){
|
|||
data.messageType= nmtPing;
|
||||
data.pingFrequency= pingFrequency;
|
||||
data.pingTime= pingTime;
|
||||
pingReceivedLocalTime=0;
|
||||
}
|
||||
|
||||
bool NetworkMessagePing::receive(Socket* socket){
|
||||
|
|
|
@ -103,7 +103,23 @@ private:
|
|||
int32 unitCommandGroupId;
|
||||
|
||||
public:
|
||||
NetworkCommand(){};
|
||||
NetworkCommand() {
|
||||
networkCommandType=0;
|
||||
unitId=0;
|
||||
unitTypeId=0;
|
||||
commandTypeId=0;
|
||||
positionX=0;
|
||||
positionY=0;
|
||||
targetId=0;
|
||||
wantQueue=0;
|
||||
fromFactionIndex=0;
|
||||
unitFactionUnitCount=0;
|
||||
unitFactionIndex=0;
|
||||
commandStateType=0;
|
||||
commandStateValue=0;
|
||||
unitCommandGroupId=0;
|
||||
}
|
||||
|
||||
NetworkCommand(
|
||||
World *world,
|
||||
int networkCommandType,
|
||||
|
|
|
@ -219,7 +219,7 @@ void ServerInterface::shutdownMasterserverPublishThread() {
|
|||
time_t elapsed = time(NULL);
|
||||
publishToMasterserverThread->signalQuit();
|
||||
for(;publishToMasterserverThread->canShutdown(false) == false &&
|
||||
difftime(time(NULL),elapsed) <= 15;) {
|
||||
difftime((long int)time(NULL),elapsed) <= 15;) {
|
||||
//sleep(150);
|
||||
}
|
||||
if(publishToMasterserverThread->canShutdown(true)) {
|
||||
|
@ -658,13 +658,13 @@ std::pair<bool,bool> ServerInterface::clientLagCheck(ConnectionSlot *connectionS
|
|||
alreadyInLagCheck = true;
|
||||
|
||||
if(gameStartTime > 0 &&
|
||||
difftime(time(NULL),gameStartTime) >= LAG_CHECK_GRACE_PERIOD) {
|
||||
difftime((long int)time(NULL),gameStartTime) >= LAG_CHECK_GRACE_PERIOD) {
|
||||
if(connectionSlot != NULL && connectionSlot->isConnected() == true) {
|
||||
double clientLag = this->getCurrentFrameCount() - connectionSlot->getCurrentFrameCount();
|
||||
double clientLagCount = (gameSettings.getNetworkFramePeriod() > 0 ? (clientLag / gameSettings.getNetworkFramePeriod()) : 0);
|
||||
connectionSlot->setCurrentLagCount(clientLagCount);
|
||||
|
||||
double clientLagTime = difftime(time(NULL),connectionSlot->getLastReceiveCommandListTime());
|
||||
double clientLagTime = difftime((long int)time(NULL),connectionSlot->getLastReceiveCommandListTime());
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
|
@ -869,7 +869,7 @@ void ServerInterface::checkForCompletedClients(std::map<int,bool> & mapSlotSigna
|
|||
std::map<int,bool> slotsCompleted;
|
||||
for(bool threadsDone = false;
|
||||
exitServer == false && threadsDone == false &&
|
||||
difftime(time(NULL),waitForThreadElapsed) < MAX_SLOT_THREAD_WAIT_TIME;) {
|
||||
difftime((long int)time(NULL),waitForThreadElapsed) < MAX_SLOT_THREAD_WAIT_TIME;) {
|
||||
threadsDone = true;
|
||||
// Examine all threads for completion of delegation
|
||||
for(int i= 0; exitServer == false && i < GameConstants::maxPlayers; ++i) {
|
||||
|
@ -932,7 +932,7 @@ void ServerInterface::checkForLaggingClients(std::map<int,bool> &mapSlotSignalle
|
|||
std::map<int,bool> slotsWarnedList;
|
||||
for(bool threadsDone = false;
|
||||
exitServer == false && threadsDone == false &&
|
||||
difftime(time(NULL),waitForThreadElapsed) < MAX_SLOT_THREAD_WAIT_TIME;) {
|
||||
difftime((long int)time(NULL),waitForThreadElapsed) < MAX_SLOT_THREAD_WAIT_TIME;) {
|
||||
threadsDone = true;
|
||||
// Examine all threads for completion of delegation
|
||||
for(int i= 0; exitServer == false && i < GameConstants::maxPlayers; ++i) {
|
||||
|
@ -978,9 +978,9 @@ void ServerInterface::checkForLaggingClients(std::map<int,bool> &mapSlotSignalle
|
|||
if((clientLagExceededOrWarned.first == true && gameSettings.getNetworkPauseGameForLaggedClients() == true)) { // ||
|
||||
//(clientLagExceededOrWarned.second == true && slotsWarnedAndRetried[i] == false)) {
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d, clientLagExceededOrWarned.first = %d, clientLagExceededOrWarned.second = %d, difftime(time(NULL),waitForClientsElapsed) = %.2f, MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE = %.2f\n",__FILE__,__FUNCTION__,__LINE__,clientLagExceededOrWarned.first,clientLagExceededOrWarned.second,difftime(time(NULL),waitForClientsElapsed),MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d, clientLagExceededOrWarned.first = %d, clientLagExceededOrWarned.second = %d, difftime(time(NULL),waitForClientsElapsed) = %.2f, MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE = %.2f\n",__FILE__,__FUNCTION__,__LINE__,clientLagExceededOrWarned.first,clientLagExceededOrWarned.second,difftime((long int)time(NULL),waitForClientsElapsed),MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE);
|
||||
|
||||
if(difftime(time(NULL),waitForClientsElapsed) < MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE) {
|
||||
if(difftime((long int)time(NULL),waitForClientsElapsed) < MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE) {
|
||||
if(connectionSlot != NULL) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d, clientLagExceededOrWarned.first = %d, clientLagExceededOrWarned.second = %d\n",__FILE__,__FUNCTION__,__LINE__,clientLagExceededOrWarned.first,clientLagExceededOrWarned.second);
|
||||
|
||||
|
@ -1011,7 +1011,7 @@ void ServerInterface::checkForLaggingClients(std::map<int,bool> &mapSlotSignalle
|
|||
if(connectionSlot != NULL && connectionSlot->isConnected() == true) {
|
||||
try {
|
||||
if(gameHasBeenInitiated == true &&
|
||||
difftime(time(NULL),lastGlobalLagCheckTime) >= LAG_CHECK_GRACE_PERIOD) {
|
||||
difftime((long int)time(NULL),lastGlobalLagCheckTime) >= LAG_CHECK_GRACE_PERIOD) {
|
||||
|
||||
//printf("\n\n\n^^^^^^^^^^^^^^ PART A\n\n\n");
|
||||
|
||||
|
@ -1306,7 +1306,7 @@ void ServerInterface::update() {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
else if(gameHasBeenInitiated == true &&
|
||||
difftime(time(NULL),lastGlobalLagCheckTime) >= LAG_CHECK_GRACE_PERIOD) {
|
||||
difftime((long int)time(NULL),lastGlobalLagCheckTime) >= LAG_CHECK_GRACE_PERIOD) {
|
||||
//printf("\nServerInterface::update -- E1\n");
|
||||
|
||||
//std::map<int,ConnectionSlotEvent> eventList;
|
||||
|
@ -1318,7 +1318,7 @@ void ServerInterface::update() {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
else if(gameHasBeenInitiated == true &&
|
||||
difftime(time(NULL),lastGlobalLagCheckTime) >= LAG_CHECK_GRACE_PERIOD) {
|
||||
difftime((long int)time(NULL),lastGlobalLagCheckTime) >= LAG_CHECK_GRACE_PERIOD) {
|
||||
//printf("\nServerInterface::update -- F\n");
|
||||
|
||||
std::map<int,ConnectionSlotEvent> eventList;
|
||||
|
@ -1764,7 +1764,7 @@ void ServerInterface::waitUntilReady(Checksum *checksum) {
|
|||
}
|
||||
}
|
||||
|
||||
Window::handleEvent();
|
||||
Shared::Platform::Window::handleEvent();
|
||||
}
|
||||
|
||||
if(logger.getCancelLoading() == true) {
|
||||
|
@ -1941,7 +1941,7 @@ string ServerInterface::getNetworkStatus() {
|
|||
if(connectionSlot!= NULL) {
|
||||
if(connectionSlot->isConnected()) {
|
||||
int clientLagCount = connectionSlot->getCurrentLagCount();
|
||||
double lastClientCommandListTimeLag = difftime(time(NULL),connectionSlot->getLastReceiveCommandListTime());
|
||||
double lastClientCommandListTimeLag = difftime((long int)time(NULL),connectionSlot->getLastReceiveCommandListTime());
|
||||
//float pingTime = connectionSlot->getThreadedPingMS(connectionSlot->getIpAddress().c_str());
|
||||
char szBuf[1024]="";
|
||||
//sprintf(szBuf,", lag = %d [%.2f], ping = %.2fms",clientLagCount,lastClientCommandListTimeLag,pingTime);
|
||||
|
@ -2305,7 +2305,7 @@ void ServerInterface::setGameSettings(GameSettings *serverGameSettings, bool wai
|
|||
|
||||
time_t tStart = time(NULL);
|
||||
bool gotAckFromAllClients = false;
|
||||
while(gotAckFromAllClients == false && difftime(time(NULL),tStart) <= 5) {
|
||||
while(gotAckFromAllClients == false && difftime((long int)time(NULL),tStart) <= 5) {
|
||||
gotAckFromAllClients = true;
|
||||
for(int i= 0; exitServer == false && i < GameConstants::maxPlayers; ++i) {
|
||||
//printf("===> START slot %d - About to setGameSettings #1\n",i);
|
||||
|
@ -2341,7 +2341,7 @@ void ServerInterface::setGameSettings(GameSettings *serverGameSettings, bool wai
|
|||
|
||||
time_t tStart = time(NULL);
|
||||
bool gotAckFromAllClients = false;
|
||||
while(gotAckFromAllClients == false && difftime(time(NULL),tStart) <= 5) {
|
||||
while(gotAckFromAllClients == false && difftime((long int)time(NULL),tStart) <= 5) {
|
||||
gotAckFromAllClients = true;
|
||||
for(int i= 0; exitServer == false && i < GameConstants::maxPlayers; ++i) {
|
||||
//printf("===> START slot %d - About to setGameSettings 2\n",i);
|
||||
|
@ -2440,7 +2440,7 @@ std::map<string,string> ServerInterface::publishToMasterserver() {
|
|||
void ServerInterface::simpleTask(BaseThread *callingThread) {
|
||||
MutexSafeWrapper safeMutex(masterServerThreadAccessor,CODE_AT_LINE);
|
||||
|
||||
if(difftime(time(NULL),lastMasterserverHeartbeatTime) >= MASTERSERVER_HEARTBEAT_GAME_STATUS_SECONDS) {
|
||||
if(difftime((long int)time(NULL),lastMasterserverHeartbeatTime) >= MASTERSERVER_HEARTBEAT_GAME_STATUS_SECONDS) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
lastMasterserverHeartbeatTime = time(NULL);
|
||||
|
@ -2532,7 +2532,7 @@ std::string ServerInterface::DumpStatsToLog(bool dumpToStringOnly) const {
|
|||
const int HOURS_IN_DAY = 24;
|
||||
const int MINUTES_IN_HOUR = 60;
|
||||
const int SECONDS_IN_MINUTE = 60;
|
||||
int InSeconds = difftime(time(NULL),slot->getConnectedTime());
|
||||
int InSeconds = difftime((long int)time(NULL),slot->getConnectedTime());
|
||||
// compute seconds
|
||||
int seconds = InSeconds % SECONDS_IN_MINUTE ;
|
||||
// throw away seconds used in previous statement and convert to minutes
|
||||
|
@ -2588,7 +2588,7 @@ void ServerInterface::notifyBadClientConnectAttempt(string ipAddress) {
|
|||
//printf("In [%s::%s Line: %d] ipAddress [%s]\n",__FILE__,__FUNCTION__,__LINE__,ipAddress.c_str());
|
||||
|
||||
if(badClientConnectIPList.find(ipAddress) == badClientConnectIPList.end()) {
|
||||
badClientConnectIPList[ipAddress] = make_pair(0,time(NULL));
|
||||
badClientConnectIPList[ipAddress] = make_pair(0,(long int)time(NULL));
|
||||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
|
@ -2598,7 +2598,7 @@ void ServerInterface::notifyBadClientConnectAttempt(string ipAddress) {
|
|||
const uint64 BLOCK_BAD_CLIENT_CONNECT_MAX_ATTEMPTS = Config::getInstance().getInt("BlockBadClientConnectMaxAttempts", "6");
|
||||
bool addToBlockedClientsList = false;
|
||||
|
||||
if(difftime(time(NULL),lastBadConnectionAttempt.second) <= BLOCK_BAD_CLIENT_CONNECT_MAX_SECONDS) {
|
||||
if(difftime((long int)time(NULL),lastBadConnectionAttempt.second) <= BLOCK_BAD_CLIENT_CONNECT_MAX_SECONDS) {
|
||||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
if(lastBadConnectionAttempt.first+1 > BLOCK_BAD_CLIENT_CONNECT_MAX_ATTEMPTS) {
|
||||
|
|
|
@ -61,7 +61,7 @@ private:
|
|||
|
||||
public:
|
||||
//misc
|
||||
~SoundRenderer();
|
||||
virtual ~SoundRenderer();
|
||||
static SoundRenderer &getInstance();
|
||||
bool init(Window *window);
|
||||
void update();
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
Command(const CommandType *ct, Unit *unit);
|
||||
Command(const CommandType *ct, const Vec2i &pos, const UnitType *unitType, CardinalDir facing);
|
||||
|
||||
virtual ~Command() {}
|
||||
//get
|
||||
inline const CommandType *getCommandType() const {return commandType;}
|
||||
inline Vec2i getPos() const {return pos;}
|
||||
|
|
|
@ -46,6 +46,7 @@ class Object;
|
|||
class ObjectStateInterface {
|
||||
public:
|
||||
virtual void removingObjectEvent(Object *object) = 0;
|
||||
virtual ~ObjectStateInterface() {}
|
||||
};
|
||||
|
||||
class Object : public BaseColorPickEntity {
|
||||
|
@ -69,7 +70,7 @@ private:
|
|||
|
||||
public:
|
||||
Object(ObjectType *objectType, const Vec3f &pos, const Vec2i &mapPos);
|
||||
~Object();
|
||||
virtual ~Object();
|
||||
|
||||
void end(); //to kill particles
|
||||
void initParticles();
|
||||
|
|
|
@ -1050,8 +1050,42 @@ void Unit::setPos(const Vec2i &pos, bool clearPathFinder) {
|
|||
if(clearPathFinder == true && this->unitPath != NULL) {
|
||||
this->unitPath->clear();
|
||||
}
|
||||
Vec2i oldLastPos = this->lastPos;
|
||||
this->lastPos= this->pos;
|
||||
this->pos= pos;
|
||||
|
||||
/*
|
||||
// This code is initial code to make the camera 'follow' a unit
|
||||
if(this->getId() == 5) {
|
||||
printf("A fov [%f] [H [%f] [V [%f]\n",game->getGameCameraPtr()->getFov(),game->getGameCameraPtr()->getHAng(),game->getGameCameraPtr()->getVAng());
|
||||
|
||||
game->getGameCameraPtr()->setClampDisabled(true);
|
||||
|
||||
game->getGameCameraPtr()->setFov(45);
|
||||
if(oldLastPos.x > pos.x) {
|
||||
game->getGameCameraPtr()->setHAng(270);
|
||||
game->getGameCameraPtr()->setVAng(-7.6);
|
||||
}
|
||||
else if(oldLastPos.x < pos.x) {
|
||||
game->getGameCameraPtr()->setHAng(90);
|
||||
game->getGameCameraPtr()->setVAng(1.4);
|
||||
}
|
||||
else if(oldLastPos.y > pos.y) {
|
||||
game->getGameCameraPtr()->setHAng(180);
|
||||
game->getGameCameraPtr()->setVAng(4.2);
|
||||
}
|
||||
else {
|
||||
game->getGameCameraPtr()->setHAng(-2.4);
|
||||
game->getGameCameraPtr()->setVAng(-1.4);
|
||||
}
|
||||
|
||||
game->getGameCameraPtr()->setPos(getCurrVector());
|
||||
game->getGameCameraPtr()->stop();
|
||||
|
||||
printf("B fov [%f] [H [%f] [V [%f]\n",game->getGameCameraPtr()->getFov(),game->getGameCameraPtr()->getHAng(),game->getGameCameraPtr()->getVAng());
|
||||
}
|
||||
*/
|
||||
|
||||
map->clampPos(this->pos);
|
||||
this->meetingPos= pos - Vec2i(1);
|
||||
map->clampPos(this->meetingPos);
|
||||
|
|
|
@ -289,7 +289,7 @@ class UnitAttackBoostEffect {
|
|||
public:
|
||||
|
||||
UnitAttackBoostEffect();
|
||||
~UnitAttackBoostEffect();
|
||||
virtual ~UnitAttackBoostEffect();
|
||||
|
||||
const AttackBoost *boost;
|
||||
const Unit *source;
|
||||
|
@ -303,7 +303,7 @@ class UnitAttackBoostEffectOriginator {
|
|||
public:
|
||||
|
||||
UnitAttackBoostEffectOriginator();
|
||||
~UnitAttackBoostEffectOriginator();
|
||||
virtual ~UnitAttackBoostEffectOriginator();
|
||||
|
||||
const SkillType *skillType;
|
||||
std::vector<int> currentAttackBoostUnits;
|
||||
|
@ -458,7 +458,7 @@ private:
|
|||
|
||||
public:
|
||||
Unit(int id, UnitPathInterface *path, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map, CardinalDir placeFacing);
|
||||
~Unit();
|
||||
virtual ~Unit();
|
||||
|
||||
//static bool isUnitDeleted(void *unit);
|
||||
|
||||
|
|
|
@ -575,8 +575,9 @@ string SkillType::skillClassToStr(SkillClass skillClass) {
|
|||
case scUpgrade: return "Upgrade";
|
||||
default:
|
||||
assert(false);
|
||||
return "";
|
||||
};
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
string SkillType::fieldToStr(Field field) {
|
||||
|
@ -605,8 +606,9 @@ string SkillType::fieldToStr(Field field) {
|
|||
return lang.getTilesetString("FieldAirName",fieldName.c_str());
|
||||
default:
|
||||
assert(false);
|
||||
return "";
|
||||
};
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void SkillType::saveGame(XmlNode *rootNode) {
|
||||
|
|
|
@ -90,7 +90,7 @@ enum AttackBoostTargetType {
|
|||
class AttackBoost {
|
||||
public:
|
||||
AttackBoost();
|
||||
~AttackBoost();
|
||||
virtual ~AttackBoost();
|
||||
bool enabled;
|
||||
bool allowMultipleBoosts;
|
||||
int radius;
|
||||
|
|
|
@ -84,6 +84,17 @@ UnitType::UnitType() : ProducibleType() {
|
|||
armorType= NULL;
|
||||
rotatedBuildPos=0;
|
||||
|
||||
field = fLand;
|
||||
id = 0;
|
||||
meetingPoint = false;
|
||||
rotationAllowed = false;
|
||||
|
||||
countUnitDeathInStats=false;
|
||||
countUnitProductionInStats=false;
|
||||
countUnitKillInStats=false;
|
||||
countKillForUnitUpgrade=false;
|
||||
|
||||
|
||||
for(int i=0; i<ccCount; ++i){
|
||||
firstCommandTypeOfClass[i]= NULL;
|
||||
}
|
||||
|
@ -919,6 +930,7 @@ bool UnitType::isOfClass(UnitClass uc) const{
|
|||
return hasSkillClass(scBeBuilt);
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ protected:
|
|||
std::map<string,int> prodSpeedMorphIsMultiplierValueList;
|
||||
|
||||
public:
|
||||
virtual ~UpgradeTypeBase() {}
|
||||
|
||||
int getMaxHp() const {return maxHp;}
|
||||
bool getMaxHpIsMultiplier() const {return maxHpIsMultiplier;}
|
||||
|
@ -180,6 +181,7 @@ public:
|
|||
class TotalUpgrade: public UpgradeTypeBase {
|
||||
public:
|
||||
TotalUpgrade();
|
||||
virtual ~TotalUpgrade() {}
|
||||
|
||||
void reset();
|
||||
void sum(const UpgradeTypeBase *ut, const Unit *unit);
|
||||
|
|
|
@ -217,6 +217,7 @@ public:
|
|||
|
||||
FastAINode() {
|
||||
this->map = NULL;
|
||||
hashCode=0;
|
||||
}
|
||||
FastAINode(Vec2i &pos,const Map *map) {
|
||||
this->pos = pos;
|
||||
|
@ -226,6 +227,7 @@ public:
|
|||
result.addInt(pos.y);
|
||||
hashCode = result.getSum();
|
||||
}
|
||||
virtual ~FastAINode() {}
|
||||
void setData(Vec2i pos, const Map *map) {
|
||||
this->pos = pos;
|
||||
this->map = map;
|
||||
|
|
|
@ -398,6 +398,7 @@ string Scenario::controllerTypeToStr(const ControlType &ct) {
|
|||
default:
|
||||
printf("Error control = %d\n",ct);
|
||||
//assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
return controlString;
|
||||
|
|
|
@ -464,6 +464,7 @@ void UnitUpdater::updateMove(Unit *unit, int frameIndex) {
|
|||
|
||||
default:
|
||||
unit->finishCommand();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld --------------------------- [END OF METHOD] ---------------------------\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
@ -557,6 +558,7 @@ void UnitUpdater::updateAttack(Unit *unit, int frameIndex) {
|
|||
break;
|
||||
default:
|
||||
unit->finishCommand();
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case tsMoving:
|
||||
|
|
|
@ -341,6 +341,7 @@ public:
|
|||
App() : wxApp() {
|
||||
mainWindow = NULL;
|
||||
}
|
||||
virtual ~App() {}
|
||||
virtual bool OnInit();
|
||||
virtual int MainLoop();
|
||||
virtual int OnExit();
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Shared { namespace Graphics {
|
|||
class BaseRenderer : public RendererMapInterface {
|
||||
public:
|
||||
BaseRenderer() { }
|
||||
~BaseRenderer() { }
|
||||
virtual ~BaseRenderer() { }
|
||||
|
||||
virtual void initMapSurface(int clientW, int clientH);
|
||||
virtual void renderMap(MapPreview *map, int x, int y, int clientW, int clientH, int cellSize, bool grid=false);
|
||||
|
|
|
@ -36,12 +36,16 @@ class RendererInterface {
|
|||
public:
|
||||
virtual Texture2D *newTexture2D(ResourceScope rs) = 0;
|
||||
virtual Model *newModel(ResourceScope rs) = 0;
|
||||
|
||||
virtual ~RendererInterface() {}
|
||||
};
|
||||
|
||||
class RendererMapInterface {
|
||||
public:
|
||||
virtual void initMapSurface(int clientW, int clientH) = 0;
|
||||
virtual void renderMap(MapPreview *map, int x, int y, int clientW, int clientH, int cellSize, bool grid) = 0;
|
||||
|
||||
virtual ~RendererMapInterface() {}
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
|
|
|
@ -241,6 +241,7 @@ class BaseColorPickEntity {
|
|||
|
||||
public:
|
||||
BaseColorPickEntity();
|
||||
virtual ~BaseColorPickEntity() {}
|
||||
|
||||
static const int COLOR_COMPONENTS = 4;
|
||||
static void init(int bufferSize);
|
||||
|
@ -254,8 +255,6 @@ public:
|
|||
string getColorDescription() const;
|
||||
virtual string getUniquePickName() const = 0;
|
||||
|
||||
~BaseColorPickEntity() {};
|
||||
|
||||
private:
|
||||
unsigned char uniqueColorID[COLOR_COMPONENTS];
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ class TextRenderer {
|
|||
public:
|
||||
virtual void render(const string &text, float x, float y, bool centered=false, Vec3f *color=NULL) = 0;
|
||||
virtual void end()= 0;
|
||||
|
||||
virtual ~TextRenderer() {}
|
||||
};
|
||||
|
||||
class TextRenderer2D : public TextRenderer {
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace Shared{ namespace Graphics{
|
|||
|
||||
class VideoLoadingCallbackInterface {
|
||||
public:
|
||||
virtual ~VideoLoadingCallbackInterface() {}
|
||||
/** a value from 1 to 100 representing % done */
|
||||
virtual void renderVideoLoading(int progressPercent) = 0;
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace Shared { namespace PlatformCommon {
|
|||
class FileCRCPreCacheThreadCallbackInterface {
|
||||
public:
|
||||
virtual vector<Texture2D *> processTech(string techName) = 0;
|
||||
virtual ~FileCRCPreCacheThreadCallbackInterface() {}
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
|
@ -74,6 +75,8 @@ public:
|
|||
|
||||
virtual void setupTask(BaseThread *callingThread) { }
|
||||
virtual void shutdownTask(BaseThread *callingThread) { }
|
||||
|
||||
virtual ~SimpleTaskCallbackInterface() {}
|
||||
};
|
||||
|
||||
class SimpleTaskThread : public BaseThread
|
||||
|
|
|
@ -46,6 +46,8 @@ void normalizeNick(char *nick);
|
|||
class IRCCallbackInterface {
|
||||
public:
|
||||
virtual void IRC_CallbackEvent(IRCEventType evt, const char* origin, const char **params, unsigned int count) = 0;
|
||||
|
||||
virtual ~IRCCallbackInterface() {}
|
||||
};
|
||||
|
||||
class IRCThread : public BaseThread
|
||||
|
|
|
@ -44,7 +44,7 @@ enum FTP_Client_CallbackType {
|
|||
|
||||
class FTPClientCallbackInterface {
|
||||
public:
|
||||
|
||||
virtual ~FTPClientCallbackInterface() {}
|
||||
struct FtpProgressStats {
|
||||
double download_total;
|
||||
double download_now;
|
||||
|
|
|
@ -55,6 +55,8 @@ class FTPClientValidationInterface {
|
|||
public:
|
||||
virtual int isValidClientType(uint32 clientIp) = 0;
|
||||
virtual int isClientAllowedToGetFile(uint32 clientIp, const char *username, const char *filename) = 0;
|
||||
|
||||
virtual ~FTPClientValidationInterface() {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,6 +64,8 @@ public:
|
|||
class UPNPInitInterface {
|
||||
public:
|
||||
virtual void UPNPInitStatus(bool result) = 0;
|
||||
|
||||
virtual ~UPNPInitInterface() {}
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -71,6 +75,7 @@ public:
|
|||
class DiscoveredServersInterface {
|
||||
public:
|
||||
virtual void DiscoveredServers(std::vector<string> serverList) = 0;
|
||||
virtual ~DiscoveredServersInterface() {}
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
|
|
|
@ -233,7 +233,7 @@ LOCAL int ftpCmdPort(int sessionId, const char* args, int len)
|
|||
}
|
||||
}
|
||||
// TODO Derzeit wird die übergebene IP nicht beachtet, sondern nur die IP des Control-Sockets verwendet
|
||||
clientIp[0] = clientIp[0];
|
||||
//clientIp[0] = clientIp[0];
|
||||
if(ftpGetSession(sessionId)->passiveDataSocket >= 0)
|
||||
{
|
||||
if(VERBOSE_MODE_ENABLED) printf("In ftpCmdPort about to Close socket = %d for sessionId = %d\n",ftpGetSession(sessionId)->passiveDataSocket,sessionId);
|
||||
|
@ -701,6 +701,7 @@ LOCAL int ftpCmdType(int sessionId, const char* args, int len)
|
|||
break;
|
||||
default:
|
||||
ftpSendMsg(MSG_NORMAL, sessionId, 504, ftpMsg028);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -799,6 +800,7 @@ LOCAL int ftpCmdStru(int sessionId, const char* args, int len)
|
|||
break;
|
||||
default:
|
||||
ftpSendMsg(MSG_NORMAL, sessionId, 504, ftpMsg031);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -195,6 +195,7 @@ Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const
|
|||
for (int i = 0; i < picComponents; ++i) {
|
||||
pixels[location+xPic+i] = l;
|
||||
}
|
||||
break;
|
||||
//TODO: Error
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,10 +38,9 @@ static void user_read_data(png_structp read_ptr, png_bytep data, png_size_t leng
|
|||
}
|
||||
}
|
||||
|
||||
static void user_write_data(png_structp png_ptr, png_bytep data, png_size_t length) {
|
||||
}
|
||||
//static void user_write_data(png_structp png_ptr, png_bytep data, png_size_t length) {}
|
||||
|
||||
static void user_flush_data(png_structp png_ptr) {}
|
||||
//static void user_flush_data(png_structp png_ptr) {}
|
||||
|
||||
/**Get Extension array, initialised*/
|
||||
//static inline const string* getExtensionsPng() {
|
||||
|
@ -178,6 +177,7 @@ Pixmap2D* PNGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const
|
|||
for (unsigned int i = 0; i < picComponents; ++i) {
|
||||
pixels[location+xPic+i] = l;
|
||||
}
|
||||
break;
|
||||
//TODO: Error
|
||||
}
|
||||
}
|
||||
|
@ -327,6 +327,7 @@ Pixmap3D* PNGReader3D::read(ifstream& is, const string& path, Pixmap3D* ret) con
|
|||
for (unsigned int i = 0; i < picComponents; ++i) {
|
||||
pixels[location+xPic+i] = l;
|
||||
}
|
||||
break;
|
||||
//TODO: Error
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ void fillPixels(uint8 *texturePixels, const Pixmap2D *pixmap){
|
|||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ ModelRendererGl::ModelRendererGl() {
|
|||
rendering= false;
|
||||
duplicateTexCoords= false;
|
||||
secondaryTexCoordUnit= 1;
|
||||
lastTexture=0;
|
||||
}
|
||||
|
||||
void ModelRendererGl::begin(bool renderNormals, bool renderTextures, bool renderColors, MeshCallback *meshCallback) {
|
||||
|
|
|
@ -307,6 +307,7 @@ void ParticleRendererGl::setBlendMode(ParticleSystem::BlendMode blendMode){
|
|||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -205,6 +205,7 @@ void TextRenderer2DGl::render(const string &text, float x, float y, bool centere
|
|||
parts[parts.size()-1] += szBuf;
|
||||
}
|
||||
lastCharacterWasSpecial = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,6 +222,7 @@ void TextRenderer2DGl::render(const string &text, float x, float y, bool centere
|
|||
break;
|
||||
default:
|
||||
font->getTextHandler()->Render(parts[i].c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -299,6 +301,7 @@ void TextRenderer2DGl::render(const string &text, float x, float y, bool centere
|
|||
parts[parts.size()-1] += szBuf;
|
||||
}
|
||||
lastCharacterWasSpecial = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -315,6 +318,7 @@ void TextRenderer2DGl::render(const string &text, float x, float y, bool centere
|
|||
break;
|
||||
default:
|
||||
font->getTextHandler()->Render(parts[i].c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -590,6 +594,7 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo
|
|||
parts[parts.size()-1] += szBuf;
|
||||
}
|
||||
lastCharacterWasSpecial = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -635,6 +640,7 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo
|
|||
font->getTextHandler()->Render(parts[i].c_str());
|
||||
specialFTGLErrorCheckWorkaround(parts[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -772,6 +772,7 @@ void GameParticleSystem::render(ParticleRenderer *pr, ModelRenderer *mr){
|
|||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -900,6 +901,7 @@ UnitParticleSystem::UnitParticleSystem(int particleCount) :
|
|||
radius= 0.5f;
|
||||
speed= 0.01f;
|
||||
windSpeed= Vec3f(0.0f);
|
||||
minRadius = 0.0;
|
||||
|
||||
setParticleSize(0.6f);
|
||||
setColorNoEnergy(Vec4f(1.0f, 0.5f, 0.0f, 1.0f));
|
||||
|
@ -1403,6 +1405,7 @@ AttackParticleSystem::AttackParticleSystem(int particleCount) :
|
|||
GameParticleSystem(particleCount){
|
||||
primitive= pQuad;
|
||||
gravity= 0.0f;
|
||||
sizeNoEnergy = 0.0;
|
||||
}
|
||||
|
||||
void AttackParticleSystem::saveGame(XmlNode *rootNode) {
|
||||
|
@ -1520,6 +1523,7 @@ void ProjectileParticleSystem::update(){
|
|||
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
direction= pos - lastPos;
|
||||
|
@ -1729,6 +1733,7 @@ SplashParticleSystem::SplashParticleSystem(int particleCount) :
|
|||
verticalSpreadB= 0.0f;
|
||||
horizontalSpreadA= 1.0f;
|
||||
horizontalSpreadB= 0.0f;
|
||||
startEmissionRate= 0.0f;
|
||||
}
|
||||
|
||||
SplashParticleSystem::~SplashParticleSystem(){
|
||||
|
|
|
@ -26,7 +26,8 @@ const int Texture::defaultSize = 256;
|
|||
const int Texture::defaultComponents = 4;
|
||||
bool Texture::useTextureCompression = false;
|
||||
|
||||
/* Quick utility function for texture creation */
|
||||
// Quick utility function for texture creation
|
||||
/*
|
||||
static int powerOfTwo(int input) {
|
||||
int value = 1;
|
||||
|
||||
|
@ -35,6 +36,7 @@ static int powerOfTwo(int input) {
|
|||
}
|
||||
return value;
|
||||
}
|
||||
*/
|
||||
|
||||
Texture::Texture() {
|
||||
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||
|
|
|
@ -184,7 +184,7 @@ static void unlock(void *data, void *id, void *const *p_pixels) {
|
|||
}
|
||||
|
||||
static void display(void *data, void *id) {
|
||||
/* VLC wants to display the video */
|
||||
// VLC wants to display the video
|
||||
class ctx *ctx = (class ctx *)data;
|
||||
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
|
|
@ -201,6 +201,8 @@ static void libirc_dcc_add_descriptors (irc_session_t * ircsession, fd_set *in_s
|
|||
|
||||
if ( dcc->dccmode == LIBIRC_DCC_SENDFILE && dcc->incoming_offset < 4 )
|
||||
libirc_add_to_set (dcc->sock, in_set, maxfd);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ static int socket_connect (socket_t * sock, const struct sockaddr *saddr, sockle
|
|||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -202,6 +202,8 @@ static void libirc_dcc_add_descriptors (irc_session_t * ircsession, fd_set *in_s
|
|||
|
||||
if ( dcc->dccmode == LIBIRC_DCC_SENDFILE && dcc->incoming_offset < 4 )
|
||||
libirc_add_to_set (dcc->sock, in_set, maxfd);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ static int socket_connect (socket_t * sock, const struct sockaddr *saddr, sockle
|
|||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -552,6 +552,7 @@ string LuaScript::errorToString(int errorCode) {
|
|||
break;
|
||||
default:
|
||||
error+= "Unknown error";
|
||||
break;
|
||||
}
|
||||
|
||||
error += string(": ")+luaL_checkstring(luaState, -1);
|
||||
|
|
|
@ -1370,7 +1370,7 @@ string extractLastDirectoryFromPath(string Path) {
|
|||
}
|
||||
else {
|
||||
for(int i = lastDirectory-1; i >= 0; --i) {
|
||||
if(Path[i] == '/' || Path[i] == '\\' && i > 0) {
|
||||
if((Path[i] == '/' || Path[i] == '\\') && i > 0) {
|
||||
result = Path.erase( 0, i);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -573,6 +573,7 @@ int main(int argc, char ** argv)
|
|||
default:
|
||||
printf("Found device (igd ?) : %s\n", urls.controlURL);
|
||||
printf("Trying to continue anyway\n");
|
||||
break;
|
||||
}
|
||||
printf("Local LAN ip address : %s\n", lanaddr);
|
||||
#if 0
|
||||
|
@ -662,6 +663,7 @@ int main(int argc, char ** argv)
|
|||
default:
|
||||
fprintf(stderr, "Unknown switch -%c\n", command);
|
||||
retcode = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
FreeUPNPUrls(&urls);
|
||||
|
|
|
@ -98,6 +98,7 @@ const char * strupnperror(int err)
|
|||
break;
|
||||
default:
|
||||
s = NULL;
|
||||
break;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -349,6 +349,7 @@ void Ip::Inet_NtoA(uint32 addr, char * ipbuf)
|
|||
}
|
||||
|
||||
// convert a string represenation of an IP address into its numeric equivalent
|
||||
/*
|
||||
static uint32 Inet_AtoN(const char * buf)
|
||||
{
|
||||
// net_server inexplicably doesn't have this function; so I'll just fake it
|
||||
|
@ -368,7 +369,7 @@ static uint32 Inet_AtoN(const char * buf)
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
static void PrintNetworkInterfaceInfos()
|
||||
{
|
||||
|
@ -793,6 +794,8 @@ Socket::Socket(PLATFORM_SOCKET sock) {
|
|||
MutexSafeWrapper safeMutexSocketDestructorFlag(inSocketDestructorSynchAccessor,CODE_AT_LINE);
|
||||
inSocketDestructorSynchAccessor->setOwnerId(CODE_AT_LINE);
|
||||
this->inSocketDestructor = false;
|
||||
lastThreadedPing = 0;
|
||||
lastDebugEvent = 0;
|
||||
//safeMutexSocketDestructorFlag.ReleaseLock();
|
||||
|
||||
//this->pingThread = NULL;
|
||||
|
@ -933,7 +936,7 @@ Socket::~Socket() {
|
|||
for(time_t elapsed = time(NULL);
|
||||
(dataSynchAccessorRead->getRefCount() > 0 ||
|
||||
dataSynchAccessorWrite->getRefCount() > 0) &&
|
||||
difftime(time(NULL),elapsed) <= 2;) {
|
||||
difftime((long int)time(NULL),elapsed) <= 2;) {
|
||||
printf("Waiting in socket destructor\n");
|
||||
//sleep(0);
|
||||
}
|
||||
|
@ -1149,7 +1152,7 @@ int Socket::getDataToRead(bool wantImmediateReply) {
|
|||
if(isSocketValid() == true)
|
||||
{
|
||||
//int loopCount = 1;
|
||||
for(time_t elapsed = time(NULL); difftime(time(NULL),elapsed) < 1;) {
|
||||
for(time_t elapsed = time(NULL); difftime((long int)time(NULL),elapsed) < 1;) {
|
||||
/* ioctl isn't posix, but the following seems to work on all modern
|
||||
* unixes */
|
||||
#ifndef WIN32
|
||||
|
@ -1236,7 +1239,7 @@ int Socket::send(const void *data, int dataSize) {
|
|||
int attemptCount = 0;
|
||||
time_t tStartTimer = time(NULL);
|
||||
while((bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||
(difftime(time(NULL),tStartTimer) <= MAX_SEND_WAIT_SECONDS)) {
|
||||
(difftime((long int)time(NULL),tStartTimer) <= MAX_SEND_WAIT_SECONDS)) {
|
||||
attemptCount++;
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount);
|
||||
|
||||
|
@ -1297,7 +1300,7 @@ int Socket::send(const void *data, int dataSize) {
|
|||
time_t tStartTimer = time(NULL);
|
||||
while(((bytesSent > 0 && totalBytesSent < dataSize) ||
|
||||
(bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN)) &&
|
||||
(difftime(time(NULL),tStartTimer) <= MAX_SEND_WAIT_SECONDS)) {
|
||||
(difftime((long int)time(NULL),tStartTimer) <= MAX_SEND_WAIT_SECONDS)) {
|
||||
attemptCount++;
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, totalBytesSent = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,totalBytesSent);
|
||||
|
||||
|
@ -1399,7 +1402,7 @@ int Socket::receive(void *data, int dataSize, bool tryReceiveUntilDataSizeMet) {
|
|||
|
||||
time_t tStartTimer = time(NULL);
|
||||
while((bytesReceived < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||
(difftime(time(NULL),tStartTimer) <= MAX_RECV_WAIT_SECONDS)) {
|
||||
(difftime((long int)time(NULL),tStartTimer) <= MAX_RECV_WAIT_SECONDS)) {
|
||||
if(isConnected() == false) {
|
||||
int iErr = getLastSocketError();
|
||||
disconnectSocket();
|
||||
|
@ -1512,7 +1515,7 @@ int Socket::peek(void *data, int dataSize,bool mustGetData,int *pLastSocketError
|
|||
|
||||
time_t tStartTimer = time(NULL);
|
||||
while((err < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||
(difftime(time(NULL),tStartTimer) <= MAX_PEEK_WAIT_SECONDS)) {
|
||||
(difftime((long int)time(NULL),tStartTimer) <= MAX_PEEK_WAIT_SECONDS)) {
|
||||
/*
|
||||
if(isConnected() == false) {
|
||||
int iErr = getLastSocketError();
|
||||
|
@ -1978,7 +1981,7 @@ void BroadCastClientSocketThread::execute() {
|
|||
|
||||
try {
|
||||
// Keep getting packets forever.
|
||||
for( time_t elapsed = time(NULL); difftime(time(NULL),elapsed) <= 5; ) {
|
||||
for( time_t elapsed = time(NULL); difftime((long int)time(NULL),elapsed) <= 5; ) {
|
||||
alen = sizeof(struct sockaddr);
|
||||
int nb=0;// The number of bytes read.
|
||||
bool gotData = (nb = recvfrom(bcfd, buff, 10024, 0, (struct sockaddr *) &bcSender, &alen)) > 0;
|
||||
|
@ -2061,6 +2064,7 @@ ServerSocket::ServerSocket(bool basicMode) : Socket() {
|
|||
//ServerSocket::upnpdiscoverThread = NULL;
|
||||
//safeMutexUPNP.ReleaseLock();
|
||||
|
||||
boundPort = 0;
|
||||
portBound = false;
|
||||
broadCastThread = NULL;
|
||||
if(this->basicMode == false) {
|
||||
|
@ -2791,7 +2795,7 @@ void BroadCastSocketThread::execute() {
|
|||
strcat(buff,ipList[idx1].c_str());
|
||||
}
|
||||
|
||||
if(difftime(time(NULL),elapsed) >= 1 && getQuitStatus() == false) {
|
||||
if(difftime((long int)time(NULL),elapsed) >= 1 && getQuitStatus() == false) {
|
||||
elapsed = time(NULL);
|
||||
|
||||
bool pauseBroadCast = getPauseBroadcast();
|
||||
|
|
|
@ -877,8 +877,8 @@ bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,bool modifiersAllow
|
|||
if(result == true && modifiersAllowed == false) {
|
||||
//printf("input.keysym.mod = %d\n",input.keysym.mod);
|
||||
|
||||
if( input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL) ||
|
||||
input.keysym.mod & (KMOD_LALT | KMOD_RALT)) {
|
||||
if( (input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) ||
|
||||
(input.keysym.mod & (KMOD_LALT | KMOD_RALT))) {
|
||||
//input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] result *WOULD HAVE BEEN TRUE* but is false due to: modifiersAllowed = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,modifiersAllowed,input.keysym.mod);
|
||||
result = false;
|
||||
|
|
|
@ -359,6 +359,7 @@ bool Properties::getBool(const string &key, const char *defaultValueIfNotFound)
|
|||
//throw megaglest_runtime_error("Error accessing value: " + key + " in: " + path+"\n[" + e.what() + "]");
|
||||
throw runtime_error("Error accessing value: " + key + " in: " + path+"\n[" + e.what() + "]");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int Properties::getInt(const string &key,const char *defaultValueIfNotFound) const{
|
||||
|
@ -370,6 +371,7 @@ int Properties::getInt(const string &key,const char *defaultValueIfNotFound) con
|
|||
//throw megaglest_runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]");
|
||||
throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Properties::getInt(const string &key, int min, int max,const char *defaultValueIfNotFound) const{
|
||||
|
@ -389,6 +391,7 @@ float Properties::getFloat(const string &key, const char *defaultValueIfNotFound
|
|||
//throw megaglest_runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]");
|
||||
throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]");
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
float Properties::getFloat(const string &key, float min, float max, const char *defaultValueIfNotFound) const{
|
||||
|
@ -476,6 +479,7 @@ bool Properties::getBool(const char *key, const char *defaultValueIfNotFound) co
|
|||
//throw megaglest_runtime_error("Error accessing value: " + string(key) + " in: " + path+"\n[" + e.what() + "]");
|
||||
throw runtime_error("Error accessing value: " + string(key) + " in: " + path+"\n[" + e.what() + "]");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int Properties::getInt(const char *key,const char *defaultValueIfNotFound) const{
|
||||
|
@ -487,6 +491,7 @@ int Properties::getInt(const char *key,const char *defaultValueIfNotFound) const
|
|||
//throw megaglest_runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]");
|
||||
throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
float Properties::getFloat(const char *key, const char *defaultValueIfNotFound) const{
|
||||
|
@ -498,6 +503,7 @@ float Properties::getFloat(const char *key, const char *defaultValueIfNotFound)
|
|||
//throw megaglest_runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]");
|
||||
throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]");
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
const string Properties::getString(const char *key, const char *defaultValueIfNotFound) const{
|
||||
|
|
|
@ -173,6 +173,7 @@ XmlNode *XmlIo::load(const string &path, std::map<string,string> mapTagReplaceme
|
|||
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void XmlIo::save(const string &path, const XmlNode *node){
|
||||
|
|
Loading…
Reference in New Issue