- in headless mode skip call to set window icon
This commit is contained in:
parent
ec554ffffb
commit
21005cc1e7
|
@ -83,6 +83,7 @@ PathFinder::~PathFinder() {
|
||||||
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
|
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
|
||||||
factions[i].nodePool.clear();
|
factions[i].nodePool.clear();
|
||||||
}
|
}
|
||||||
|
factions.clear();
|
||||||
map=NULL;
|
map=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,12 @@
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
#include "command_type.h"
|
#include "command_type.h"
|
||||||
#include "base_thread.h"
|
#include "base_thread.h"
|
||||||
|
#include <set>
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::map;
|
using std::map;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
using std::set;
|
||||||
|
|
||||||
using Shared::Graphics::Texture2D;
|
using Shared::Graphics::Texture2D;
|
||||||
using namespace Shared::PlatformCommon;
|
using namespace Shared::PlatformCommon;
|
||||||
|
@ -132,10 +134,20 @@ private:
|
||||||
std::map<int,SwitchTeamVote> switchTeamVotes;
|
std::map<int,SwitchTeamVote> switchTeamVotes;
|
||||||
int currentSwitchTeamVoteFactionIndex;
|
int currentSwitchTeamVoteFactionIndex;
|
||||||
|
|
||||||
|
set<int> livingUnits;
|
||||||
|
set<Unit*> livingUnitsp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Faction();
|
Faction();
|
||||||
~Faction();
|
~Faction();
|
||||||
|
|
||||||
|
void addLivingUnits(int id) { livingUnits.insert(id); }
|
||||||
|
void addLivingUnitsp(Unit *unit) { livingUnitsp.insert(unit); }
|
||||||
|
|
||||||
|
bool isUnitInLivingUnitsp(Unit *unit) { return (livingUnitsp.find(unit) != livingUnitsp.end()); }
|
||||||
|
void deleteLivingUnits(int id) { livingUnits.erase(id); }
|
||||||
|
void deleteLivingUnitsp(Unit *unit) { livingUnitsp.erase(unit); }
|
||||||
|
|
||||||
void init(
|
void init(
|
||||||
FactionType *factionType, ControlType control, TechTree *techTree, Game *game,
|
FactionType *factionType, ControlType control, TechTree *techTree, Game *game,
|
||||||
int factionIndex, int teamIndex, int startLocationIndex, bool thisFaction, bool giveResources);
|
int factionIndex, int teamIndex, int startLocationIndex, bool thisFaction, bool giveResources);
|
||||||
|
|
|
@ -241,8 +241,8 @@ const int Unit::maxDeadCount= 1000; //time in until the corpse disapears - shoul
|
||||||
const float Unit::highlightTime= 0.5f;
|
const float Unit::highlightTime= 0.5f;
|
||||||
const int Unit::invalidId= -1;
|
const int Unit::invalidId= -1;
|
||||||
|
|
||||||
set<int> Unit::livingUnits;
|
//set<int> Unit::livingUnits;
|
||||||
set<Unit*> Unit::livingUnitsp;
|
//set<Unit*> Unit::livingUnitsp;
|
||||||
|
|
||||||
// ============================ Constructor & destructor =============================
|
// ============================ Constructor & destructor =============================
|
||||||
|
|
||||||
|
@ -342,8 +342,8 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType
|
||||||
this->currSkill = getType()->getFirstStOfClass(scStop);
|
this->currSkill = getType()->getFirstStOfClass(scStop);
|
||||||
this->currentAttackBoostOriginatorEffect.skillType = this->currSkill;
|
this->currentAttackBoostOriginatorEffect.skillType = this->currSkill;
|
||||||
|
|
||||||
livingUnits.insert(id);
|
this->faction->addLivingUnits(id);
|
||||||
livingUnitsp.insert(this);
|
this->faction->addLivingUnitsp(this);
|
||||||
|
|
||||||
addItemToVault(&this->hp,this->hp);
|
addItemToVault(&this->hp,this->hp);
|
||||||
addItemToVault(&this->ep,this->ep);
|
addItemToVault(&this->ep,this->ep);
|
||||||
|
@ -359,17 +359,9 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType
|
||||||
Unit::~Unit() {
|
Unit::~Unit() {
|
||||||
badHarvestPosList.clear();
|
badHarvestPosList.clear();
|
||||||
|
|
||||||
//Just to be sure, should already be removed
|
this->faction->deleteLivingUnits(id);
|
||||||
if (livingUnits.erase(id)) {
|
this->faction->deleteLivingUnitsp(this);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
|
||||||
//Only an error if not called at end
|
|
||||||
}
|
|
||||||
|
|
||||||
//Just to be sure, should already be removed
|
|
||||||
if (livingUnitsp.erase(this)) {
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
}
|
|
||||||
//remove commands
|
//remove commands
|
||||||
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
||||||
MutexSafeWrapper safeMutex(&mutexCommands,mutexOwnerId);
|
MutexSafeWrapper safeMutex(&mutexCommands,mutexOwnerId);
|
||||||
|
@ -1206,7 +1198,7 @@ CommandResult Unit::finishCommand() {
|
||||||
this->unitPath->clear();
|
this->unitPath->clear();
|
||||||
|
|
||||||
while (commands.empty() == false) {
|
while (commands.empty() == false) {
|
||||||
if (commands.front()->getUnit() != NULL && livingUnitsp.find(commands.front()->getUnit()) == livingUnitsp.end()) {
|
if (commands.front()->getUnit() != NULL && this->faction->isUnitInLivingUnitsp(commands.front()->getUnit()) == false) {
|
||||||
safeMutex.Lock();
|
safeMutex.Lock();
|
||||||
delete commands.front();
|
delete commands.front();
|
||||||
commands.erase(commands.begin());
|
commands.erase(commands.begin());
|
||||||
|
@ -1326,8 +1318,8 @@ void Unit::undertake() {
|
||||||
//unitUpdater->clearUnitPrecache(this);
|
//unitUpdater->clearUnitPrecache(this);
|
||||||
unitUpdater->removeUnitPrecache(this);
|
unitUpdater->removeUnitPrecache(this);
|
||||||
|
|
||||||
livingUnits.erase(id);
|
this->faction->deleteLivingUnits(id);
|
||||||
livingUnitsp.erase(this);
|
this->faction->deleteLivingUnitsp(this);
|
||||||
faction->removeUnit(this);
|
faction->removeUnit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "particle.h"
|
#include "particle.h"
|
||||||
#include "skill_type.h"
|
#include "skill_type.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
#include <set>
|
|
||||||
#include "platform_common.h"
|
#include "platform_common.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
@ -33,8 +32,6 @@ using Shared::Graphics::Model;
|
||||||
using Shared::PlatformCommon::Chrono;
|
using Shared::PlatformCommon::Chrono;
|
||||||
using Shared::PlatformCommon::ValueCheckerVault;
|
using Shared::PlatformCommon::ValueCheckerVault;
|
||||||
|
|
||||||
using std::set;
|
|
||||||
|
|
||||||
class Map;
|
class Map;
|
||||||
class Faction;
|
class Faction;
|
||||||
class Unit;
|
class Unit;
|
||||||
|
@ -271,10 +268,6 @@ public:
|
||||||
static const float highlightTime;
|
static const float highlightTime;
|
||||||
static const int invalidId;
|
static const int invalidId;
|
||||||
|
|
||||||
static set<int> livingUnits;
|
|
||||||
static set<Unit*> livingUnitsp;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int id;
|
const int id;
|
||||||
int hp;
|
int hp;
|
||||||
|
|
|
@ -65,6 +65,8 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,bool
|
||||||
int resW = PlatformCommon::Private::ScreenWidth;
|
int resW = PlatformCommon::Private::ScreenWidth;
|
||||||
int resH = PlatformCommon::Private::ScreenHeight;
|
int resH = PlatformCommon::Private::ScreenHeight;
|
||||||
|
|
||||||
|
if(Window::getMasterserverMode() == false) {
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
string mg_icon_file = "";
|
string mg_icon_file = "";
|
||||||
#if defined(CUSTOM_DATA_INSTALL_PATH_VALUE)
|
#if defined(CUSTOM_DATA_INSTALL_PATH_VALUE)
|
||||||
|
@ -113,7 +115,7 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,bool
|
||||||
screen = NULL;
|
screen = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Window::getMasterserverMode() == false) {
|
|
||||||
screen = SDL_SetVideoMode(resW, resH, colorBits, flags);
|
screen = SDL_SetVideoMode(resW, resH, colorBits, flags);
|
||||||
if(screen == 0) {
|
if(screen == 0) {
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user