- first round of cleanup from cppcheck report
This commit is contained in:
parent
da8a44167b
commit
26581a77d2
|
@ -761,7 +761,7 @@ void Ai::sendScoutPatrol(){
|
|||
bool megaResourceAttack=(aiInterface->getControlType() == ctCpuMega || aiInterface->getControlType() == ctNetworkCpuMega)
|
||||
&& random.randRange(0, 1) == 1;
|
||||
|
||||
if(possibleTargetFound == false && (megaResourceAttack || ultraResourceAttack)) {
|
||||
if(megaResourceAttack || ultraResourceAttack) {
|
||||
Map *map= aiInterface->getMap();
|
||||
|
||||
const TechTree *tt= aiInterface->getTechTree();
|
||||
|
@ -1131,8 +1131,8 @@ void Ai::unblockUnits() {
|
|||
|
||||
//printf("#2 AI found blocked unit [%d - %s]\n",u->getId(),u->getFullName().c_str());
|
||||
|
||||
int failureCount = 0;
|
||||
int cellCount = 0;
|
||||
//int failureCount = 0;
|
||||
//int cellCount = 0;
|
||||
|
||||
for(int i = -1; i <= 1; ++i) {
|
||||
for(int j = -1; j <= 1; ++j) {
|
||||
|
@ -1141,10 +1141,10 @@ void Ai::unblockUnits() {
|
|||
if(pos != unitPos) {
|
||||
bool canUnitMoveToCell = map->aproxCanMove(u, unitPos, pos);
|
||||
if(canUnitMoveToCell == false) {
|
||||
failureCount++;
|
||||
//failureCount++;
|
||||
getAdjacentUnits(signalAdjacentUnits, u);
|
||||
}
|
||||
cellCount++;
|
||||
//cellCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,9 +66,9 @@ private:
|
|||
|
||||
ProduceTask();
|
||||
public:
|
||||
ProduceTask(UnitClass unitClass);
|
||||
ProduceTask(const UnitType *unitType);
|
||||
ProduceTask(const ResourceType *resourceType);
|
||||
explicit ProduceTask(UnitClass unitClass);
|
||||
explicit ProduceTask(const UnitType *unitType);
|
||||
explicit ProduceTask(const ResourceType *resourceType);
|
||||
|
||||
UnitClass getUnitClass() const {return unitClass;}
|
||||
const UnitType *getUnitType() const {return unitType;}
|
||||
|
@ -91,8 +91,8 @@ private:
|
|||
BuildTask();
|
||||
|
||||
public:
|
||||
BuildTask(const UnitType *unitType);
|
||||
BuildTask(const ResourceType *resourceType);
|
||||
explicit BuildTask(const UnitType *unitType);
|
||||
explicit BuildTask(const ResourceType *resourceType);
|
||||
BuildTask(const UnitType *unitType, const Vec2i &pos);
|
||||
|
||||
const UnitType *getUnitType() const {return unitType;}
|
||||
|
@ -113,7 +113,7 @@ private:
|
|||
|
||||
UpgradeTask();
|
||||
public:
|
||||
UpgradeTask(const UpgradeType *upgradeType);
|
||||
explicit UpgradeTask(const UpgradeType *upgradeType);
|
||||
const UpgradeType *getUpgradeType() const {return upgradeType;}
|
||||
virtual string toString() const;
|
||||
|
||||
|
|
|
@ -359,7 +359,7 @@ std::pair<CommandResult,string> AiInterface::giveCommand(int unitIndex, CommandC
|
|||
std::pair<CommandResult,string> result(crFailUndefined,"");
|
||||
if(executeCommandOverNetwork() == true) {
|
||||
const Unit *unit = getMyUnit(unitIndex);
|
||||
result = commander->tryGiveCommand(unit, unit->getType()->getFirstCtOfClass(commandClass), pos, unit->getType(),CardinalDir::NORTH);
|
||||
result = commander->tryGiveCommand(unit, unit->getType()->getFirstCtOfClass(commandClass), pos, unit->getType(),CardinalDir(CardinalDir::NORTH));
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
|
@ -410,7 +410,7 @@ std::pair<CommandResult,string> AiInterface::giveCommand(const Unit *unit, const
|
|||
|
||||
if(executeCommandOverNetwork() == true) {
|
||||
result = commander->tryGiveCommand(unit, commandType, pos,
|
||||
unit->getType(),CardinalDir::NORTH, false, NULL,unitGroupCommandId);
|
||||
unit->getType(),CardinalDir(CardinalDir::NORTH), false, NULL,unitGroupCommandId);
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
|
@ -460,7 +460,7 @@ std::pair<CommandResult,string> AiInterface::giveCommand(int unitIndex, const Co
|
|||
|
||||
if(executeCommandOverNetwork() == true) {
|
||||
const Unit *unit = getMyUnit(unitIndex);
|
||||
result = commander->tryGiveCommand(unit, commandType, pos, unit->getType(),CardinalDir::NORTH);
|
||||
result = commander->tryGiveCommand(unit, commandType, pos, unit->getType(),CardinalDir(CardinalDir::NORTH));
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
|
@ -508,13 +508,13 @@ std::pair<CommandResult,string> AiInterface::giveCommand(int unitIndex, const Co
|
|||
|
||||
if(executeCommandOverNetwork() == true) {
|
||||
const Unit *unit = getMyUnit(unitIndex);
|
||||
result = commander->tryGiveCommand(unit, commandType, pos, ut,CardinalDir::NORTH);
|
||||
result = commander->tryGiveCommand(unit, commandType, pos, ut,CardinalDir(CardinalDir::NORTH));
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
result = world->getFaction(factionIndex)->getUnit(unitIndex)->giveCommand(new Command(commandType, pos, ut, CardinalDir::NORTH));
|
||||
result = world->getFaction(factionIndex)->getUnit(unitIndex)->giveCommand(new Command(commandType, pos, ut, CardinalDir(CardinalDir::NORTH)));
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
|
@ -558,7 +558,7 @@ std::pair<CommandResult,string> AiInterface::giveCommand(int unitIndex, const Co
|
|||
Unit *targetUnit = u;
|
||||
const Unit *unit = getMyUnit(unitIndex);
|
||||
|
||||
result = commander->tryGiveCommand(unit, commandType, Vec2i(0), unit->getType(),CardinalDir::NORTH,false,targetUnit);
|
||||
result = commander->tryGiveCommand(unit, commandType, Vec2i(0), unit->getType(),CardinalDir(CardinalDir::NORTH),false,targetUnit);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
|||
virtual void setTaskCompleted(int frameIndex);
|
||||
|
||||
public:
|
||||
AiInterfaceThread(AiInterface *aiIntf);
|
||||
explicit AiInterfaceThread(AiInterface *aiIntf);
|
||||
virtual ~AiInterfaceThread();
|
||||
virtual void execute();
|
||||
void signal(int frameIndex);
|
||||
|
|
|
@ -49,7 +49,7 @@ protected:
|
|||
Ai *ai;
|
||||
|
||||
public:
|
||||
AiRule(Ai *ai);
|
||||
explicit AiRule(Ai *ai);
|
||||
virtual ~AiRule() {}
|
||||
|
||||
virtual int getTestInterval() const= 0; //in milliseconds
|
||||
|
@ -68,7 +68,7 @@ private:
|
|||
int stoppedWorkerIndex;
|
||||
|
||||
public:
|
||||
AiRuleWorkerHarvest(Ai *ai);
|
||||
explicit AiRuleWorkerHarvest(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 2000;}
|
||||
virtual string getName() const {return "Worker stopped => Order worker to harvest";}
|
||||
|
@ -86,7 +86,7 @@ private:
|
|||
int workerIndex;
|
||||
|
||||
public:
|
||||
AiRuleRefreshHarvester(Ai *ai);
|
||||
explicit AiRuleRefreshHarvester(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 20000;}
|
||||
virtual string getName() const {return "Worker reassigned to needed resource";}
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
|
||||
class AiRuleScoutPatrol: public AiRule{
|
||||
public:
|
||||
AiRuleScoutPatrol(Ai *ai);
|
||||
explicit AiRuleScoutPatrol(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 10000;}
|
||||
virtual string getName() const {return "Base is stable => Send scout patrol";}
|
||||
|
@ -123,7 +123,7 @@ private:
|
|||
double getMinCastleHpRatio() const;
|
||||
|
||||
public:
|
||||
AiRuleRepair(Ai *ai);
|
||||
explicit AiRuleRepair(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 10000;}
|
||||
virtual string getName() const {return "Building Damaged => Repair";}
|
||||
|
@ -140,7 +140,7 @@ class AiRuleReturnBase: public AiRule{
|
|||
private:
|
||||
int stoppedUnitIndex;
|
||||
public:
|
||||
AiRuleReturnBase(Ai *ai);
|
||||
explicit AiRuleReturnBase(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 5000;}
|
||||
virtual string getName() const {return "Stopped unit => Order return base";}
|
||||
|
@ -163,7 +163,7 @@ private:
|
|||
bool ultraAttack;
|
||||
|
||||
public:
|
||||
AiRuleMassiveAttack(Ai *ai);
|
||||
explicit AiRuleMassiveAttack(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 1000;}
|
||||
virtual string getName() const {return "Unit under attack => Order massive attack";}
|
||||
|
@ -178,7 +178,7 @@ public:
|
|||
|
||||
class AiRuleAddTasks: public AiRule{
|
||||
public:
|
||||
AiRuleAddTasks(Ai *ai);
|
||||
explicit AiRuleAddTasks(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 5000;}
|
||||
virtual string getName() const {return "Tasks empty => Add tasks";}
|
||||
|
@ -196,7 +196,7 @@ private:
|
|||
const UnitType *farm;
|
||||
|
||||
public:
|
||||
AiRuleBuildOneFarm(Ai *ai);
|
||||
explicit AiRuleBuildOneFarm(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 10000;}
|
||||
virtual string getName() const {return "No farms => Build one";}
|
||||
|
@ -219,7 +219,7 @@ private:
|
|||
bool newResourceBehaviour;
|
||||
|
||||
public:
|
||||
AiRuleProduceResourceProducer(Ai *ai);
|
||||
explicit AiRuleProduceResourceProducer(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return interval;}
|
||||
virtual string getName() const {return "No resources => Build Resource Producer";}
|
||||
|
@ -241,7 +241,7 @@ private:
|
|||
bool newResourceBehaviour;
|
||||
|
||||
public:
|
||||
AiRuleProduce(Ai *ai);
|
||||
explicit AiRuleProduce(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 2000;}
|
||||
virtual string getName() const {return "Performing produce task";}
|
||||
|
@ -269,7 +269,7 @@ private:
|
|||
const BuildTask *buildTask;
|
||||
|
||||
public:
|
||||
AiRuleBuild(Ai *ai);
|
||||
explicit AiRuleBuild(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 2000;}
|
||||
virtual string getName() const {return "Performing build task";}
|
||||
|
@ -296,7 +296,7 @@ private:
|
|||
const UpgradeTask *upgradeTask;
|
||||
|
||||
public:
|
||||
AiRuleUpgrade(Ai *ai);
|
||||
explicit AiRuleUpgrade(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 2000;}
|
||||
virtual string getName() const {return "Performing upgrade task";}
|
||||
|
@ -322,7 +322,7 @@ private:
|
|||
const UnitType *storeType;
|
||||
|
||||
public:
|
||||
AiRuleExpand(Ai *ai);
|
||||
explicit AiRuleExpand(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 30000;}
|
||||
virtual string getName() const {return "Expanding";}
|
||||
|
@ -337,7 +337,7 @@ public:
|
|||
|
||||
class AiRuleUnBlock: public AiRule{
|
||||
public:
|
||||
AiRuleUnBlock(Ai *ai);
|
||||
explicit AiRuleUnBlock(Ai *ai);
|
||||
|
||||
virtual int getTestInterval() const {return 3000;}
|
||||
virtual string getName() const {return "Blocked Units => Move surrounding units";}
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
protected:
|
||||
Mutex *factionMutexPrecache;
|
||||
public:
|
||||
FactionState(int factionIndex) :
|
||||
explicit FactionState(int factionIndex) :
|
||||
//factionMutexPrecache(new Mutex) {
|
||||
factionMutexPrecache(NULL) { //, random(factionIndex) {
|
||||
|
||||
|
@ -184,7 +184,7 @@ private:
|
|||
|
||||
public:
|
||||
PathFinder();
|
||||
PathFinder(const Map *map);
|
||||
explicit PathFinder(const Map *map);
|
||||
~PathFinder();
|
||||
|
||||
PathFinder(const PathFinder& obj) {
|
||||
|
@ -265,7 +265,7 @@ private:
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
|
||||
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In processNode() nodeLimitReached %d unitFactionIndex %d foundOpenPosForPos %d allowUnitMoveSoon %d maxNodeCount %d node->pos = %s finalPos = %s sucPos = %s faction.openPosList.size() %ld closedNodesList.size() %ld",
|
||||
snprintf(szBuf,8096,"In processNode() nodeLimitReached %d unitFactionIndex %d foundOpenPosForPos %d allowUnitMoveSoon %d maxNodeCount %d node->pos = %s finalPos = %s sucPos = %s faction.openPosList.size() %lu closedNodesList.size() %lu",
|
||||
nodeLimitReached,unitFactionIndex,foundOpenPosForPos, allowUnitMoveSoon, maxNodeCount,node->pos.getString().c_str(),finalPos.getString().c_str(),sucPos.getString().c_str(),faction.openPosList.size(),faction.closedNodesList.size());
|
||||
|
||||
if(Thread::isCurrentThreadMainThread() == false) {
|
||||
|
@ -327,9 +327,9 @@ private:
|
|||
|
||||
inline void doAStarPathSearch(bool & nodeLimitReached, int & whileLoopCount,
|
||||
int & unitFactionIndex, bool & pathFound, Node *& node, const Vec2i & finalPos,
|
||||
std::map<Vec2i,bool> closedNodes,
|
||||
std::map<Vec2i,Vec2i> cameFrom, std::map<std::pair<Vec2i,Vec2i> ,
|
||||
bool> canAddNode, Unit *& unit, int & maxNodeCount, int curFrameIndex) {
|
||||
const std::map<Vec2i,bool> &closedNodes,
|
||||
const std::map<Vec2i,Vec2i> &cameFrom, const std::map<std::pair<Vec2i,Vec2i> ,bool> &canAddNode,
|
||||
Unit *& unit, int & maxNodeCount, int curFrameIndex) {
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
|
||||
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
static void setMaxGameTime(time_t value) { gameTime = value; }
|
||||
static void setWantExitGameWhenDone(bool value) { wantExitGame = value; }
|
||||
static string getLoadGameSettingsFile() { return loadGameSettingsFile; }
|
||||
static void setLoadGameSettingsFile(string filename) { loadGameSettingsFile = filename; }
|
||||
static void setLoadGameSettingsFile(const string &filename) { loadGameSettingsFile = filename; }
|
||||
|
||||
bool mustExitGame() const { return exitGame; }
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ Vec3f GraphicComponent::customTextColor = Vec3f(1.0,1.0,1.0);
|
|||
|
||||
std::map<std::string, std::map<std::string, GraphicComponent *> > GraphicComponent::registeredGraphicComponentList;
|
||||
|
||||
GraphicComponent::GraphicComponent(std::string containerName, std::string objName, bool registerControl) {
|
||||
GraphicComponent::GraphicComponent(const std::string &containerName, const std::string &objName, bool registerControl) {
|
||||
this->containerName = containerName;
|
||||
this->instanceName = "";
|
||||
if(containerName == "" || objName == "") {
|
||||
|
@ -370,7 +370,7 @@ void GraphicComponent::resetFade(){
|
|||
const int GraphicLabel::defH= 20;
|
||||
const int GraphicLabel::defW= 70;
|
||||
|
||||
GraphicLabel::GraphicLabel(std::string containerName, std::string objName, bool registerControl) :
|
||||
GraphicLabel::GraphicLabel(const std::string &containerName, const std::string &objName, bool registerControl) :
|
||||
GraphicComponent(containerName, objName, registerControl) {
|
||||
centered = false;
|
||||
wordWrap = false;
|
||||
|
@ -438,7 +438,7 @@ void GraphicLabel::setCenteredH(bool centered) {
|
|||
const int GraphicButton::defH= 22;
|
||||
const int GraphicButton::defW= 90;
|
||||
|
||||
GraphicButton::GraphicButton(std::string containerName, std::string objName, bool registerControl) :
|
||||
GraphicButton::GraphicButton(const std::string &containerName, const std::string &objName, bool registerControl) :
|
||||
GraphicComponent(containerName,objName,registerControl) {
|
||||
|
||||
lighted = false;
|
||||
|
@ -469,7 +469,7 @@ bool GraphicButton::mouseMove(int x, int y){
|
|||
const int GraphicListBox::defH= 22;
|
||||
const int GraphicListBox::defW= 140;
|
||||
|
||||
GraphicListBox::GraphicListBox(std::string containerName, std::string objName)
|
||||
GraphicListBox::GraphicListBox(const std::string &containerName, const std::string &objName)
|
||||
: GraphicComponent(containerName, objName), graphButton1(containerName, objName + "_button1"),
|
||||
graphButton2(containerName, objName + "_button2") {
|
||||
selectedItemIndex = 0;
|
||||
|
@ -707,7 +707,7 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
|||
const int GraphicMessageBox::defH= 280;
|
||||
const int GraphicMessageBox::defW= 350;
|
||||
|
||||
GraphicMessageBox::GraphicMessageBox(std::string containerName, std::string objName) :
|
||||
GraphicMessageBox::GraphicMessageBox(const std::string &containerName, const std::string &objName) :
|
||||
GraphicComponent(containerName, objName) {
|
||||
header= "";
|
||||
autoWordWrap=true;
|
||||
|
@ -836,7 +836,7 @@ bool GraphicMessageBox::mouseClick(int x, int y, int &clickedButton){
|
|||
const int GraphicLine::defH= 5;
|
||||
const int GraphicLine::defW= 1000;
|
||||
|
||||
GraphicLine::GraphicLine(std::string containerName, std::string objName)
|
||||
GraphicLine::GraphicLine(const std::string &containerName, const std::string &objName)
|
||||
: GraphicComponent(containerName, objName) {
|
||||
horizontal = false;
|
||||
}
|
||||
|
@ -853,7 +853,7 @@ void GraphicLine::init(int x, int y, int w, int h){
|
|||
const int GraphicCheckBox::defH= 22;
|
||||
const int GraphicCheckBox::defW= 22;
|
||||
|
||||
GraphicCheckBox::GraphicCheckBox(std::string containerName, std::string objName)
|
||||
GraphicCheckBox::GraphicCheckBox(const std::string &containerName, const std::string &objName)
|
||||
: GraphicComponent(containerName, objName) {
|
||||
value = false;
|
||||
lighted = false;
|
||||
|
@ -895,7 +895,7 @@ bool GraphicCheckBox::mouseClick(int x, int y){
|
|||
const int GraphicScrollBar::defThickness=20;
|
||||
const int GraphicScrollBar::defLength= 200;
|
||||
|
||||
GraphicScrollBar::GraphicScrollBar(std::string containerName, std::string objName)
|
||||
GraphicScrollBar::GraphicScrollBar(const std::string &containerName, const std::string &objName)
|
||||
: GraphicComponent(containerName, objName) {
|
||||
lighted = false;
|
||||
activated = false;
|
||||
|
@ -1041,7 +1041,8 @@ void GraphicScrollBar::arrangeComponents(vector<GraphicComponent *> &gcs) {
|
|||
const int PopupMenu::defH= 240;
|
||||
const int PopupMenu::defW= 350;
|
||||
|
||||
PopupMenu::PopupMenu(std::string containerName, std::string objName) : GraphicComponent(containerName, objName, false) {
|
||||
PopupMenu::PopupMenu(const std::string &containerName, const std::string &objName) :
|
||||
GraphicComponent(containerName, objName, false) {
|
||||
registerGraphicComponentOnlyFontCallbacks(containerName,objName);
|
||||
|
||||
h= defH;
|
||||
|
|
|
@ -75,7 +75,7 @@ protected:
|
|||
virtual void FontChangedCallback(std::string fontUniqueId, Font *font);
|
||||
|
||||
public:
|
||||
GraphicComponent(std::string containerName="", std::string objName="", bool registerControl=true);
|
||||
GraphicComponent(const std::string &containerName="", const std::string &objName="", bool registerControl=true);
|
||||
virtual ~GraphicComponent();
|
||||
|
||||
static void setCustomTextColor(Vec3f value) { customTextColor = value; }
|
||||
|
@ -164,7 +164,7 @@ private:
|
|||
Texture2D *texture;
|
||||
|
||||
public:
|
||||
GraphicLabel(std::string containerName="", std::string objName="", bool registerControl=true);
|
||||
GraphicLabel(const std::string &containerName="", const std::string &objName="", bool registerControl=true);
|
||||
void init(int x, int y, int w=defW, int h=defH, bool centered= false, Vec3f textColor=GraphicComponent::customTextColor, bool wordWrap=false);
|
||||
|
||||
virtual bool mouseMove(int x, int y);
|
||||
|
@ -228,7 +228,7 @@ private:
|
|||
Texture *customTexture;
|
||||
|
||||
public:
|
||||
GraphicButton(std::string containerName="", std::string objName="", bool registerControl=true);
|
||||
GraphicButton(const std::string &containerName="", const std::string &objName="", bool registerControl=true);
|
||||
void init(int x, int y, int w=defW, int h=defH);
|
||||
|
||||
bool getUseCustomTexture() const { return useCustomTexture; }
|
||||
|
@ -263,7 +263,7 @@ private:
|
|||
bool leftControlled;
|
||||
|
||||
public:
|
||||
GraphicListBox(std::string containerName="", std::string objName="");
|
||||
GraphicListBox(const std::string &containerName="", const std::string &objName="");
|
||||
void init(int x, int y, int w=defW, int h=defH, Vec3f textColor=GraphicComponent::customTextColor);
|
||||
|
||||
int getItemCount() const {return (int)items.size();}
|
||||
|
@ -313,7 +313,7 @@ private:
|
|||
private:
|
||||
void alignButtons();
|
||||
public:
|
||||
GraphicMessageBox(std::string containerName="", std::string objName="");
|
||||
GraphicMessageBox(const std::string &containerName="", const std::string &objName="");
|
||||
virtual ~GraphicMessageBox();
|
||||
void init(const string &button1Str, const string &button2Str, int newWidth=-1,int newHeight=-1);
|
||||
void init(const string &button1Str, int newWidth=-1,int newHeight=-1);
|
||||
|
@ -351,7 +351,7 @@ private:
|
|||
bool horizontal;
|
||||
|
||||
public:
|
||||
GraphicLine(std::string containerName="", std::string objName="");
|
||||
GraphicLine(const std::string &containerName="", const std::string &objName="");
|
||||
void init(int x, int y, int w=defW, int h=defH);
|
||||
bool getHorizontal() const {return horizontal;}
|
||||
void setHorizontal(bool horizontal) {this->horizontal= horizontal;}
|
||||
|
@ -371,7 +371,7 @@ private:
|
|||
bool lighted;
|
||||
|
||||
public:
|
||||
GraphicCheckBox(std::string containerName="", std::string objName="");
|
||||
GraphicCheckBox(const std::string &containerName="", const std::string &objName="");
|
||||
void init(int x, int y, int w=defW, int h=defH);
|
||||
bool getValue() const {return value;}
|
||||
void setValue(bool value) {this->value= value;}
|
||||
|
@ -403,7 +403,7 @@ private:
|
|||
int visibleCompPosEnd;
|
||||
|
||||
public:
|
||||
GraphicScrollBar(std::string containerName="", std::string objName="");
|
||||
GraphicScrollBar(const std::string &containerName="", const std::string &objName="");
|
||||
void init(int x, int y, bool horizontal,int length=defLength, int thickness=defThickness);
|
||||
virtual bool mouseDown(int x, int y);
|
||||
virtual bool mouseMove(int x, int y);
|
||||
|
@ -447,7 +447,7 @@ private:
|
|||
string header;
|
||||
|
||||
public:
|
||||
PopupMenu(std::string containerName="", std::string objName="");
|
||||
PopupMenu(const std::string &containerName="", const std::string &objName="");
|
||||
virtual ~PopupMenu();
|
||||
void init(string menuHeader, std::vector<string> menuItems);
|
||||
|
||||
|
|
|
@ -260,8 +260,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
|||
int newMatchedIndex = -1;
|
||||
for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) {
|
||||
int possibleMatchIndex = matchedIndexes[index];
|
||||
if(replaceCurrentAutoCompleteName < 0 ||
|
||||
(replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex > replaceCurrentAutoCompleteName)) {
|
||||
if(replaceCurrentAutoCompleteName < 0 || possibleMatchIndex>replaceCurrentAutoCompleteName) {
|
||||
newMatchedIndex = possibleMatchIndex;
|
||||
break;
|
||||
}
|
||||
|
@ -269,8 +268,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
|||
if(newMatchedIndex < 0) {
|
||||
for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) {
|
||||
int possibleMatchIndex = matchedIndexes[index];
|
||||
if(replaceCurrentAutoCompleteName < 0 ||
|
||||
(replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex < replaceCurrentAutoCompleteName)) {
|
||||
if(replaceCurrentAutoCompleteName < 0 || possibleMatchIndex>replaceCurrentAutoCompleteName) {
|
||||
newMatchedIndex = possibleMatchIndex;
|
||||
break;
|
||||
}
|
||||
|
@ -308,8 +306,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
|||
int newMatchedIndex = -1;
|
||||
for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) {
|
||||
int possibleMatchIndex = matchedIndexes[index];
|
||||
if(replaceCurrentAutoCompleteName < 0 ||
|
||||
(replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex > replaceCurrentAutoCompleteName)) {
|
||||
if(replaceCurrentAutoCompleteName < 0 || possibleMatchIndex>replaceCurrentAutoCompleteName) {
|
||||
newMatchedIndex = possibleMatchIndex;
|
||||
break;
|
||||
}
|
||||
|
@ -317,8 +314,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
|||
if(newMatchedIndex < 0) {
|
||||
for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) {
|
||||
int possibleMatchIndex = matchedIndexes[index];
|
||||
if(replaceCurrentAutoCompleteName < 0 ||
|
||||
(replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex < replaceCurrentAutoCompleteName)) {
|
||||
if(replaceCurrentAutoCompleteName < 0 || possibleMatchIndex>replaceCurrentAutoCompleteName) {
|
||||
newMatchedIndex = possibleMatchIndex;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
bool getDisableTeamMode() const { return disableTeamMode; }
|
||||
void setDisableTeamMode(bool value);
|
||||
|
||||
void setAutoCompleteTextList(vector<string> list) { autoCompleteTextList = list; }
|
||||
void setAutoCompleteTextList(const vector<string> &list) { autoCompleteTextList = list; }
|
||||
|
||||
bool isInCustomInputMode() const { return customCB != NULL; };
|
||||
};
|
||||
|
|
|
@ -79,7 +79,7 @@ void Console::setFont3D(Font3D *font) {
|
|||
}
|
||||
}
|
||||
|
||||
void Console::registerGraphicComponent(std::string containerName, std::string objName) {
|
||||
void Console::registerGraphicComponent(const std::string &containerName, const std::string &objName) {
|
||||
this->instanceName = objName;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ void Console::addStdMessage(const string &s,bool clearOtherLines) {
|
|||
}
|
||||
}
|
||||
|
||||
void Console::addStdMessage(const string &s,string failText, bool clearOtherLines) {
|
||||
void Console::addStdMessage(const string &s,const string &failText, bool clearOtherLines) {
|
||||
if(clearOtherLines == true) {
|
||||
addLineOnly(Lang::getInstance().getString(s) + failText);
|
||||
}
|
||||
|
@ -136,11 +136,11 @@ void Console::addStdScenarioMessage(const string &s,bool clearOtherLines) {
|
|||
}
|
||||
}
|
||||
|
||||
void Console::addLineOnly(string line) {
|
||||
void Console::addLineOnly(const string &line) {
|
||||
addLine(line,false,-1,Vec3f(1.f, 1.f, 1.f),false,true);
|
||||
}
|
||||
|
||||
void Console::addLine(string line, bool playSound, int playerIndex, Vec3f textColor, bool teamMode,bool clearOtherLines) {
|
||||
void Console::addLine(const string &line, bool playSound, int playerIndex, Vec3f textColor, bool teamMode,bool clearOtherLines) {
|
||||
try {
|
||||
if(playSound == true) {
|
||||
SoundRenderer::getInstance().playFx(CoreData::getInstance().getClickSoundA());
|
||||
|
@ -186,7 +186,7 @@ void Console::addLine(string line, bool playSound, int playerIndex, Vec3f textCo
|
|||
}
|
||||
}
|
||||
|
||||
void Console::addLine(string line, bool playSound, string playerName, Vec3f textColor, bool teamMode) {
|
||||
void Console::addLine(const string &line, bool playSound, const string &playerName, Vec3f textColor, bool teamMode) {
|
||||
try {
|
||||
if(playSound == true) {
|
||||
SoundRenderer::getInstance().playFx(CoreData::getInstance().getClickSoundA());
|
||||
|
|
|
@ -92,9 +92,9 @@ public:
|
|||
Console();
|
||||
virtual ~Console();
|
||||
|
||||
void registerGraphicComponent(std::string containerName, std::string objName);
|
||||
void registerGraphicComponent(const std::string &containerName, const std::string &objName);
|
||||
string getInstanceName() const { return instanceName; }
|
||||
void setInstanceName(string value) { instanceName = value; }
|
||||
void setInstanceName(const string &value) { instanceName = value; }
|
||||
string getFontCallbackName() const { return fontCallbackName; }
|
||||
|
||||
int getStoredLineCount() const {return (int)storedLines.size();}
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
void setFont(Font2D *font);
|
||||
void setFont3D(Font3D *font);
|
||||
string getStringToHighlight() const { return stringToHighlight;}
|
||||
void setStringToHighlight(string stringToHighlight) { this->stringToHighlight = stringToHighlight;}
|
||||
void setStringToHighlight(const string &stringToHighlight) { this->stringToHighlight = stringToHighlight;}
|
||||
void resetFonts();
|
||||
|
||||
|
||||
|
@ -124,13 +124,13 @@ public:
|
|||
|
||||
void clearStoredLines();
|
||||
void addStdMessage(const string &s, bool clearOtherLines=false);
|
||||
void addStdMessage(const string &s, string failText, bool clearOtherLines=false);
|
||||
void addStdMessage(const string &s, const string &failText, bool clearOtherLines=false);
|
||||
|
||||
void addStdScenarioMessage(const string &s,bool clearOtherLines=false);
|
||||
void addLineOnly(string line);
|
||||
void addLine(string line, bool playSound= false,int playerIndex=-1,Vec3f textColor=Vec3f(1.f, 1.f, 1.f),bool teamMode=false,bool clearOtherLines=false);
|
||||
void addLine(string line, bool playSound,string playerName, Vec3f textColor=Vec3f(1.f, 1.f, 1.f),bool teamMode=false);
|
||||
void addLine(string line, bool playSound, Vec3f textColor) { addLine(line,playSound,"",textColor,false); }
|
||||
void addLineOnly(const string &line);
|
||||
void addLine(const string &line, bool playSound= false,int playerIndex=-1,Vec3f textColor=Vec3f(1.f, 1.f, 1.f),bool teamMode=false,bool clearOtherLines=false);
|
||||
void addLine(const string &line, bool playSound, const string &playerName, Vec3f textColor=Vec3f(1.f, 1.f, 1.f),bool teamMode=false);
|
||||
void addLine(const string &line, bool playSound, Vec3f textColor) { addLine(line,playSound,"",textColor,false); }
|
||||
void update();
|
||||
bool isEmpty();
|
||||
|
||||
|
|
|
@ -601,8 +601,8 @@ string Game::extractScenarioLogoFile(const GameSettings *settings, string &resul
|
|||
return scenarioDir;
|
||||
}
|
||||
|
||||
string Game::extractFactionLogoFile(bool &loadingImageUsed, string factionName,
|
||||
string scenarioDir, string techName, Logger *logger, string factionLogoFilter) {
|
||||
string Game::extractFactionLogoFile(bool &loadingImageUsed, const string &factionName,
|
||||
string scenarioDir, const string &techName, Logger *logger, string factionLogoFilter) {
|
||||
string result = "";
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Searching for faction loading screen\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
|
@ -800,8 +800,8 @@ string Game::extractFactionLogoFile(bool &loadingImageUsed, string factionName,
|
|||
return result;
|
||||
}
|
||||
|
||||
string Game::extractTechLogoFile(string scenarioDir, string techName,
|
||||
bool &loadingImageUsed, Logger *logger,string factionLogoFilter) {
|
||||
string Game::extractTechLogoFile(string scenarioDir, const string &techName,
|
||||
bool &loadingImageUsed, Logger *logger,const string &factionLogoFilter) {
|
||||
string result = "";
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Searching for tech loading screen\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
Config &config = Config::getInstance();
|
||||
|
@ -891,7 +891,7 @@ void Game::loadHudTexture(const GameSettings *settings)
|
|||
}
|
||||
|
||||
string Game::findFactionLogoFile(const GameSettings *settings, Logger *logger,
|
||||
string factionLogoFilter) {
|
||||
const string &factionLogoFilter) {
|
||||
string result = "";
|
||||
if(settings == NULL) {
|
||||
result = "";
|
||||
|
@ -918,14 +918,15 @@ string Game::findFactionLogoFile(const GameSettings *settings, Logger *logger,
|
|||
}
|
||||
}
|
||||
|
||||
string scenarioDir = "";
|
||||
bool skipCustomLoadScreen = false;
|
||||
if(skipCustomLoadScreen == false) {
|
||||
scenarioDir = extractScenarioLogoFile(settings, result, loadingImageUsed,
|
||||
//string scenarioDir = "";
|
||||
//bool skipCustomLoadScreen = false;
|
||||
//if(skipCustomLoadScreen == false) {
|
||||
string scenarioDir = extractScenarioLogoFile(settings, result, loadingImageUsed,
|
||||
logger, factionLogoFilter);
|
||||
}
|
||||
//}
|
||||
// try to use a faction related loading screen
|
||||
if(skipCustomLoadScreen == false && loadingImageUsed == false) {
|
||||
//if(skipCustomLoadScreen == false && loadingImageUsed == false) {
|
||||
if(loadingImageUsed == false) {
|
||||
for(int i=0; i < settings->getFactionCount(); ++i ) {
|
||||
if( settings->getFactionControl(i) == ctHuman ||
|
||||
(settings->getFactionControl(i) == ctNetwork && settings->getThisFactionIndex() == i)) {
|
||||
|
@ -938,7 +939,8 @@ string Game::findFactionLogoFile(const GameSettings *settings, Logger *logger,
|
|||
}
|
||||
|
||||
// try to use a tech related loading screen
|
||||
if(skipCustomLoadScreen == false && loadingImageUsed == false){
|
||||
//if(skipCustomLoadScreen == false && loadingImageUsed == false){
|
||||
if(loadingImageUsed == false) {
|
||||
result = extractTechLogoFile(scenarioDir, techName,
|
||||
loadingImageUsed, logger, factionLogoFilter);
|
||||
}
|
||||
|
@ -5299,9 +5301,7 @@ void Game::highlightUnit(int unitId,float radius, float thickness, Vec4f color)
|
|||
}
|
||||
|
||||
void Game::unhighlightUnit(int unitId) {
|
||||
if(unitHighlightList.find(unitId) != unitHighlightList.end()) {
|
||||
unitHighlightList.erase(unitId);
|
||||
}
|
||||
unitHighlightList.erase(unitId);
|
||||
}
|
||||
|
||||
// ==================== render ====================
|
||||
|
@ -6538,7 +6538,7 @@ void Game::saveGame(){
|
|||
config.save();
|
||||
}
|
||||
|
||||
string Game::saveGame(string name, string path) {
|
||||
string Game::saveGame(string name, const string &path) {
|
||||
Config &config= Config::getInstance();
|
||||
// auto name file if using saved file pattern string
|
||||
if(name == GameConstants::saveGameFilePattern) {
|
||||
|
|
|
@ -313,10 +313,10 @@ public:
|
|||
Vec2i getPerformanceTimerResults();
|
||||
|
||||
static Texture2D * findFactionLogoTexture(const GameSettings *settings, Logger *logger=NULL,string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER, bool useTechDefaultIfFilterNotFound=true);
|
||||
static string findFactionLogoFile(const GameSettings *settings, Logger *logger=NULL, string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER);
|
||||
static string findFactionLogoFile(const GameSettings *settings, Logger *logger=NULL, const string &factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER);
|
||||
static string extractScenarioLogoFile(const GameSettings *settings, string &result, bool &loadingImageUsed, Logger *logger=NULL, string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER);
|
||||
static string extractFactionLogoFile(bool &loadingImageUsed, string factionName, string scenarioDir, string techName, Logger *logger=NULL, string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER);
|
||||
static string extractTechLogoFile(string scenarioDir, string techName, bool &loadingImageUsed, Logger *logger=NULL,string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER);
|
||||
static string extractFactionLogoFile(bool &loadingImageUsed, const string &factionName, string scenarioDir, const string &techName, Logger *logger=NULL, string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER);
|
||||
static string extractTechLogoFile(string scenarioDir, const string &techName, bool &loadingImageUsed, Logger *logger=NULL,const string &factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER);
|
||||
|
||||
void loadHudTexture(const GameSettings *settings);
|
||||
|
||||
|
@ -332,7 +332,7 @@ public:
|
|||
void stopStreamingVideo(const string &playVideo);
|
||||
void stopAllVideo();
|
||||
|
||||
string saveGame(string name, string path="saved/");
|
||||
string saveGame(string name, const string &path="saved/");
|
||||
static void loadGame(string name,Program *programPtr,bool isMasterserverMode, const GameSettings *joinGameSettings=NULL);
|
||||
|
||||
void addNetworkCommandToReplayList(NetworkCommand* networkCommand,int worldFrameCount);
|
||||
|
|
|
@ -176,7 +176,7 @@ public:
|
|||
void loadGame(const XmlNode *rootNode);
|
||||
|
||||
private:
|
||||
void setClampBounds(bool value) { clampBounds = value; }
|
||||
//void setClampBounds(bool value) { clampBounds = value; }
|
||||
void resetPosition();
|
||||
void setClampDisabled(bool value) { clampDisable = value; };
|
||||
void clampPosXYZ(float x1, float x2, float y1, float y2, float z1, float z2);
|
||||
|
|
|
@ -205,7 +205,7 @@ public:
|
|||
enum Enum { NORTH, EAST, SOUTH, WEST, COUNT };
|
||||
|
||||
CardinalDir() : value(NORTH) {}
|
||||
CardinalDir(Enum v) : value(v) {}
|
||||
explicit CardinalDir(Enum v) : value(v) {}
|
||||
explicit CardinalDir(int v) {
|
||||
assertDirValid(v);
|
||||
value = static_cast<Enum>(v);
|
||||
|
|
|
@ -451,7 +451,7 @@ public:
|
|||
|
||||
this->networkPlayerGameStatus[factionIndex]= status;
|
||||
}
|
||||
void setNetworkPlayerLanguages(int factionIndex, string language) {
|
||||
void setNetworkPlayerLanguages(int factionIndex, const string &language) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
|
@ -536,7 +536,7 @@ public:
|
|||
void setTilesetCRC(uint32 value) { tilesetCRC = value; }
|
||||
void setTechCRC(uint32 value) { techCRC = value; }
|
||||
|
||||
void setFactionCRCList(vector<pair<string,uint32> > value) { factionCRCList = value; }
|
||||
void setFactionCRCList(const vector<pair<string,uint32> > &value) { factionCRCList = value; }
|
||||
|
||||
int getAiAcceptSwitchTeamPercentChance() const { return aiAcceptSwitchTeamPercentChance;}
|
||||
void setAiAcceptSwitchTeamPercentChance(int value) { aiAcceptSwitchTeamPercentChance = value; }
|
||||
|
|
|
@ -31,7 +31,7 @@ ScriptManagerMessage::ScriptManagerMessage() : text(""), header("") {
|
|||
this->messageNotTranslated = true;
|
||||
}
|
||||
|
||||
ScriptManagerMessage::ScriptManagerMessage(string textIn, string headerIn,
|
||||
ScriptManagerMessage::ScriptManagerMessage(const string &textIn, const string &headerIn,
|
||||
int factionIndex,int teamIndex, bool messageNotTranslated) :
|
||||
text(textIn), header(headerIn) {
|
||||
this->factionIndex = factionIndex;
|
||||
|
@ -1357,9 +1357,7 @@ void ScriptManager::unregisterCellTriggerEvent(int eventId) {
|
|||
if(unRegisterCellTriggerEventList.empty() == false) {
|
||||
for(int i = 0; i < (int)unRegisterCellTriggerEventList.size(); ++i) {
|
||||
int delayedEventId = unRegisterCellTriggerEventList[i];
|
||||
if(CellTriggerEventList.find(delayedEventId) != CellTriggerEventList.end()) {
|
||||
CellTriggerEventList.erase(delayedEventId);
|
||||
}
|
||||
CellTriggerEventList.erase(delayedEventId);
|
||||
}
|
||||
unRegisterCellTriggerEventList.clear();
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ private:
|
|||
|
||||
public:
|
||||
ScriptManagerMessage();
|
||||
ScriptManagerMessage(string text, string header, int factionIndex=-1,int teamIndex=-1,bool messageNotTranslated=false);
|
||||
ScriptManagerMessage(const string &text, const string &header, int factionIndex=-1,int teamIndex=-1,bool messageNotTranslated=false);
|
||||
const string &getText() const {return text;}
|
||||
const string &getHeader() const {return header;}
|
||||
int getFactionIndex() const {return factionIndex;}
|
||||
|
|
|
@ -142,12 +142,12 @@ public:
|
|||
void die(int diedFactionIndex, bool isDeathCounted);
|
||||
void produce(int producerFactionIndex, bool isProductionCounted);
|
||||
void harvest(int harvesterFactionIndex, int amount);
|
||||
void setPlayerName(int playerIndex, string value) {playerStats[playerIndex].playerName = value; }
|
||||
void setPlayerName(int playerIndex, const string &value) {playerStats[playerIndex].playerName = value; }
|
||||
void setPlayerColor(int playerIndex, Vec3f value) {playerStats[playerIndex].playerColor = value; }
|
||||
|
||||
void addFramesToCalculatePlaytime() {this->framesToCalculatePlaytime++; }
|
||||
|
||||
void setTechName(string name) { techName = name; }
|
||||
void setTechName(const string &name) { techName = name; }
|
||||
string getTechName() const { return techName; }
|
||||
|
||||
string getStats() const;
|
||||
|
|
|
@ -1175,7 +1175,7 @@ void CoreData::unRegisterFontChangedCallback(std::string entityName) {
|
|||
void CoreData::triggerFontChangedCallbacks(std::string fontUniqueId, Font *font) {
|
||||
for (std::map<std::string, std::vector<FontChangedCallbackInterface *> >::const_iterator iterMap =
|
||||
registeredFontChangedCallbacks.begin();
|
||||
iterMap != registeredFontChangedCallbacks.end(); iterMap++) {
|
||||
iterMap != registeredFontChangedCallbacks.end(); ++iterMap) {
|
||||
for (unsigned int index = 0; index < iterMap->second.size(); ++index) {
|
||||
//printf("Font Callback detected calling: Control [%s] for Font: [%s] value [%p]\n",iterMap->first.c_str(),fontUniqueId.c_str(),font);
|
||||
FontChangedCallbackInterface *cb = iterMap->second[index];
|
||||
|
|
|
@ -2547,9 +2547,9 @@ void Renderer::renderResourceStatus() {
|
|||
twoRessourceLines, rt, rowsRendered, resourceCountRendered);
|
||||
}
|
||||
}
|
||||
if(resourceCountRendered > 0) {
|
||||
rowsRendered++;
|
||||
}
|
||||
//if(resourceCountRendered > 0) {
|
||||
// rowsRendered++;
|
||||
//}
|
||||
}
|
||||
|
||||
glPopAttrib();
|
||||
|
@ -4305,9 +4305,9 @@ void Renderer::MapRenderer::Layer::render(VisibleQuadContainerCache &qCache) {
|
|||
return;
|
||||
}
|
||||
|
||||
const bool renderOnlyVisibleQuad = true;
|
||||
|
||||
if(renderOnlyVisibleQuad == true) {
|
||||
// const bool renderOnlyVisibleQuad = true;
|
||||
//
|
||||
// if(renderOnlyVisibleQuad == true) {
|
||||
vector<pair<int,int> > rowsToRender;
|
||||
|
||||
if(rowsToRenderCache.find(qCache.lastVisibleQuad) != rowsToRenderCache.end()) {
|
||||
|
@ -4363,20 +4363,20 @@ void Renderer::MapRenderer::Layer::render(VisibleQuadContainerCache &qCache) {
|
|||
glDrawRangeElements(GL_TRIANGLES,rowsToRender[i].first,rowsToRender[i].second,indexCount,GL_UNSIGNED_INT,_bindVBO(vbo_indices,indices,GL_ELEMENT_ARRAY_BUFFER_ARB));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
glVertexPointer(3,GL_FLOAT,0,_bindVBO(vbo_vertices,vertices));
|
||||
glNormalPointer(GL_FLOAT,0,_bindVBO(vbo_normals,normals));
|
||||
|
||||
glClientActiveTexture(Renderer::fowTexUnit);
|
||||
glTexCoordPointer(2,GL_FLOAT,0,_bindVBO(vbo_fowTexCoords,fowTexCoords));
|
||||
|
||||
glClientActiveTexture(Renderer::baseTexUnit);
|
||||
glBindTexture(GL_TEXTURE_2D,textureHandle);
|
||||
glTexCoordPointer(2,GL_FLOAT,0,_bindVBO(vbo_surfTexCoords,surfTexCoords));
|
||||
|
||||
glDrawElements(GL_TRIANGLES,indexCount,GL_UNSIGNED_INT,_bindVBO(vbo_indices,indices,GL_ELEMENT_ARRAY_BUFFER_ARB));
|
||||
}
|
||||
// }
|
||||
// else {
|
||||
// glVertexPointer(3,GL_FLOAT,0,_bindVBO(vbo_vertices,vertices));
|
||||
// glNormalPointer(GL_FLOAT,0,_bindVBO(vbo_normals,normals));
|
||||
//
|
||||
// glClientActiveTexture(Renderer::fowTexUnit);
|
||||
// glTexCoordPointer(2,GL_FLOAT,0,_bindVBO(vbo_fowTexCoords,fowTexCoords));
|
||||
//
|
||||
// glClientActiveTexture(Renderer::baseTexUnit);
|
||||
// glBindTexture(GL_TEXTURE_2D,textureHandle);
|
||||
// glTexCoordPointer(2,GL_FLOAT,0,_bindVBO(vbo_surfTexCoords,surfTexCoords));
|
||||
//
|
||||
// glDrawElements(GL_TRIANGLES,indexCount,GL_UNSIGNED_INT,_bindVBO(vbo_indices,indices,GL_ELEMENT_ARRAY_BUFFER_ARB));
|
||||
// }
|
||||
}
|
||||
|
||||
void Renderer::MapRenderer::renderVisibleLayers(const Map* map,float coordStep,VisibleQuadContainerCache &qCache) {
|
||||
|
@ -7133,9 +7133,9 @@ void Renderer::selectUsingFrustumSelection(Selection::UnitContainer &units,
|
|||
object->getPos().x, object->getPos().y, object->getPos().z, 1);
|
||||
if(insideQuad == true) {
|
||||
obj = object;
|
||||
if(withObjectSelection == true) {
|
||||
break;
|
||||
}
|
||||
//if(withObjectSelection == true) {
|
||||
break;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9327,12 +9327,12 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame,
|
|||
}
|
||||
}
|
||||
else {
|
||||
bool insideQuad = false;
|
||||
//bool insideQuad = false;
|
||||
|
||||
if( !insideQuad) {
|
||||
//if( !insideQuad) {
|
||||
SurfaceCell *sc = map->getSurfaceCell(pos.x, pos.y);
|
||||
insideQuad = CubeInFrustum(quadCache.frustumData, sc->getVertex().x, sc->getVertex().y, sc->getVertex().z, 0);
|
||||
}
|
||||
bool insideQuad = CubeInFrustum(quadCache.frustumData, sc->getVertex().x, sc->getVertex().y, sc->getVertex().z, 0);
|
||||
//}
|
||||
if( !insideQuad) {
|
||||
SurfaceCell *sc = map->getSurfaceCell(pos.x+1, pos.y);
|
||||
insideQuad = CubeInFrustum(quadCache.frustumData, sc->getVertex().x, sc->getVertex().y, sc->getVertex().z, 0);
|
||||
|
|
|
@ -371,12 +371,16 @@ private:
|
|||
|
||||
const Map* map;
|
||||
struct Layer {
|
||||
inline Layer(int th):
|
||||
inline explicit Layer(int th):
|
||||
vbo_vertices(0), vbo_normals(0),
|
||||
vbo_fowTexCoords(0), vbo_surfTexCoords(0),
|
||||
vbo_indices(0), indexCount(0),
|
||||
textureHandle(th),textureCRC(0) {}
|
||||
|
||||
inline explicit Layer(Layer &obj) {
|
||||
*this = obj;
|
||||
}
|
||||
|
||||
inline Layer & operator=(Layer &obj) {
|
||||
this->vertices = obj.vertices;
|
||||
this->normals = obj.normals;
|
||||
|
|
|
@ -102,7 +102,7 @@ Gui::Gui(){
|
|||
activeCommandType= NULL;
|
||||
activeCommandClass= ccStop;
|
||||
selectingBuilding= false;
|
||||
selectedBuildingFacing = CardinalDir::NORTH;
|
||||
selectedBuildingFacing = CardinalDir(CardinalDir::NORTH);
|
||||
selectingPos= false;
|
||||
selectingMeetingPoint= false;
|
||||
activePos= invalidPos;
|
||||
|
@ -203,7 +203,7 @@ void Gui::invalidatePosObjWorld(){
|
|||
|
||||
void Gui::resetState(){
|
||||
selectingBuilding= false;
|
||||
selectedBuildingFacing = CardinalDir::NORTH;
|
||||
selectedBuildingFacing = CardinalDir(CardinalDir::NORTH);
|
||||
selectingPos= false;
|
||||
selectingMeetingPoint= false;
|
||||
activePos= invalidPos;
|
||||
|
@ -736,7 +736,7 @@ void Gui::mouseDownDisplayUnitBuild(int posDisplay) {
|
|||
|
||||
choosenBuildingType = ut;
|
||||
selectingPos = true;
|
||||
selectedBuildingFacing = CardinalDir::NORTH;
|
||||
selectedBuildingFacing = CardinalDir(CardinalDir::NORTH);
|
||||
activePos = posDisplay;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ private:
|
|||
void renderModelBackground();
|
||||
|
||||
public:
|
||||
Intro(Program *program);
|
||||
explicit Intro(Program *program);
|
||||
virtual ~Intro();
|
||||
|
||||
virtual void update();
|
||||
|
|
|
@ -458,7 +458,7 @@ void generate_stack_trace(string &out, CONTEXT ctx, int skip) {
|
|||
}
|
||||
|
||||
struct UntypedException {
|
||||
UntypedException(const EXCEPTION_RECORD & er)
|
||||
explicit UntypedException(const EXCEPTION_RECORD & er)
|
||||
: exception_object(reinterpret_cast<void *>(er.ExceptionInformation[1])),
|
||||
type_array(reinterpret_cast<_ThrowInfo *>(er.ExceptionInformation[2])->pCatchableTypeArray)
|
||||
{}
|
||||
|
@ -639,7 +639,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
|
|||
printf("\n** Already in error handler aborting, msg [%s]\n",msg);
|
||||
fflush(stdout);
|
||||
abort();
|
||||
return;
|
||||
//return;
|
||||
}
|
||||
inErrorNow = true;
|
||||
|
||||
|
@ -1787,7 +1787,7 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName,
|
|||
bool showDuplicateFiles, bool gitPurgeFiles,double &purgedMegaBytes) {
|
||||
Checksum checksum;
|
||||
|
||||
bool techtree_errors = false;
|
||||
//bool techtree_errors = false;
|
||||
|
||||
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||
vector<string> pathList;
|
||||
|
@ -2113,9 +2113,9 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName,
|
|||
}
|
||||
}
|
||||
|
||||
if(techtree_errors == false) {
|
||||
printf("\nValidation found NO ERRORS for tilesetPath [%s] tilesetName [%s]:\n",tilesetPath.c_str(), tilesetName.c_str());
|
||||
}
|
||||
//if(techtree_errors == false) {
|
||||
printf("\nValidation found NO ERRORS for tilesetPath [%s] tilesetName [%s]:\n",tilesetPath.c_str(), tilesetName.c_str());
|
||||
//}
|
||||
|
||||
printf("----------------------------------------------------------------");
|
||||
}
|
||||
|
@ -3307,7 +3307,6 @@ Steam & initSteamInstance() {
|
|||
}
|
||||
|
||||
void setupSteamSettings(bool steamEnabled) {
|
||||
bool needToSaveConfig=false;
|
||||
Config &config = Config::getInstance();
|
||||
config.setBool("SteamEnabled",steamEnabled,true);
|
||||
if(steamEnabled) {
|
||||
|
@ -3321,6 +3320,7 @@ void setupSteamSettings(bool steamEnabled) {
|
|||
string steamLang = steam.lang();
|
||||
printf("Steam Integration Enabled!\nSteam User Name is [%s] Language is [%s]\n", steamPlayerName.c_str(), steamLang.c_str());
|
||||
|
||||
bool needToSaveConfig=false;
|
||||
string currentPLayerName = config.getString("NetPlayerName","");
|
||||
if( currentPLayerName == "newbie" || currentPLayerName == "" ) {
|
||||
config.setString("NetPlayerName",steamPlayerName);
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
void showLanguages();
|
||||
|
||||
public:
|
||||
MainWindow(Program *program);
|
||||
explicit MainWindow(Program *program);
|
||||
~MainWindow();
|
||||
|
||||
void setProgram(Program *program);
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
static const char *MAIN_PROGRAM_RENDER_KEY;
|
||||
|
||||
ProgramState(Program *program);
|
||||
explicit ProgramState(Program *program);
|
||||
virtual ~ProgramState(){};
|
||||
|
||||
int getFps() const { return fps; }
|
||||
|
|
|
@ -62,8 +62,8 @@ private:
|
|||
void initBackgroundVideo();
|
||||
|
||||
public:
|
||||
MainMenu(Program *program);
|
||||
~MainMenu();
|
||||
explicit MainMenu(Program *program);
|
||||
virtual ~MainMenu();
|
||||
|
||||
MenuBackground *getMenuBackground() {return &menuBackground;}
|
||||
const MenuBackground *getConstMenuBackground() const {return &menuBackground;}
|
||||
|
|
|
@ -1698,7 +1698,7 @@ void MenuStateCustomGame::updateResourceMultiplier(const int index) {
|
|||
//printf("Line: %d multiplier index: %d index: %d\n",__LINE__,listBoxRMultiplier[index].getSelectedItemIndex(),index);
|
||||
}
|
||||
|
||||
void MenuStateCustomGame::loadGameSettings(std::string fileName) {
|
||||
void MenuStateCustomGame::loadGameSettings(const std::string &fileName) {
|
||||
// Ensure we have set the gamesettings at least once
|
||||
GameSettings gameSettings = loadGameSettingsFromFile(fileName);
|
||||
if(gameSettings.getMap() == "") {
|
||||
|
|
|
@ -279,7 +279,7 @@ private:
|
|||
void loadFactionTexture(string filepath);
|
||||
|
||||
GameSettings loadGameSettingsFromFile(std::string fileName);
|
||||
void loadGameSettings(std::string fileName);
|
||||
void loadGameSettings(const std::string &fileName);
|
||||
void RestoreLastGameSettings();
|
||||
void PlayNow(bool saveGame);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ protected:
|
|||
virtual void setQuitStatus(bool value);
|
||||
|
||||
public:
|
||||
ClientInterfaceThread(ClientInterface *client);
|
||||
explicit ClientInterfaceThread(ClientInterface *client);
|
||||
virtual ~ClientInterfaceThread();
|
||||
virtual void execute();
|
||||
|
||||
|
|
|
@ -1393,7 +1393,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
double maxClientLagTimeAllowed = 8;
|
||||
|
||||
// New lag check
|
||||
if((maxFrameCountLagAllowed > 0 && clientLagCount > maxFrameCountLagAllowed) ||
|
||||
if((clientLagCount > maxFrameCountLagAllowed) ||
|
||||
(maxClientLagTimeAllowed > 0 && clientLagTime > maxClientLagTimeAllowed)) {
|
||||
|
||||
waitForLaggingClient = true;
|
||||
|
|
|
@ -96,7 +96,7 @@ protected:
|
|||
void slotUpdateTask(ConnectionSlotEvent *event);
|
||||
|
||||
public:
|
||||
ConnectionSlotThread(int slotIndex);
|
||||
explicit ConnectionSlotThread(int slotIndex);
|
||||
ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex);
|
||||
virtual ~ConnectionSlotThread();
|
||||
|
||||
|
|
|
@ -412,7 +412,7 @@ private:
|
|||
FileTransferInfo info;
|
||||
|
||||
public:
|
||||
FileTransferSocketThread(FileTransferInfo fileInfo);
|
||||
explicit FileTransferSocketThread(FileTransferInfo fileInfo);
|
||||
virtual void execute();
|
||||
};
|
||||
|
||||
|
|
|
@ -1725,7 +1725,7 @@ const char * NetworkMessageCommandList::getPackedMessageFormatDetail() const {
|
|||
|
||||
unsigned int NetworkMessageCommandList::getPackedSizeDetail(int count) {
|
||||
unsigned int result = 0;
|
||||
if(result == 0) {
|
||||
//if(result == 0) {
|
||||
for(unsigned int i = 0; i < (unsigned int)count; ++i) {
|
||||
NetworkCommand packedData;
|
||||
unsigned char *buf = new unsigned char[sizeof(NetworkCommand)*3];
|
||||
|
@ -1746,7 +1746,7 @@ unsigned int NetworkMessageCommandList::getPackedSizeDetail(int count) {
|
|||
packedData.unitCommandGroupId);
|
||||
delete [] buf;
|
||||
}
|
||||
}
|
||||
//}
|
||||
return result;
|
||||
}
|
||||
void NetworkMessageCommandList::unpackMessageDetail(unsigned char *buf,int count) {
|
||||
|
|
|
@ -285,7 +285,7 @@ protected:
|
|||
|
||||
public:
|
||||
NetworkMessageReady();
|
||||
NetworkMessageReady(uint32 checksum);
|
||||
explicit NetworkMessageReady(uint32 checksum);
|
||||
|
||||
virtual size_t getDataSize() const { return sizeof(Data); }
|
||||
|
||||
|
@ -464,7 +464,7 @@ protected:
|
|||
unsigned char * packMessageDetail(uint16 totalCommand);
|
||||
|
||||
public:
|
||||
NetworkMessageCommandList(int32 frameCount= -1);
|
||||
explicit NetworkMessageCommandList(int32 frameCount= -1);
|
||||
|
||||
virtual size_t getDataSize() const { return sizeof(Data); }
|
||||
virtual unsigned char * getData();
|
||||
|
@ -652,7 +652,7 @@ protected:
|
|||
|
||||
public:
|
||||
NetworkMessageSynchNetworkGameData() {};
|
||||
NetworkMessageSynchNetworkGameData(const GameSettings *gameSettings);
|
||||
explicit NetworkMessageSynchNetworkGameData(const GameSettings *gameSettings);
|
||||
|
||||
virtual size_t getDataSize() const { return sizeof(Data); }
|
||||
|
||||
|
@ -847,7 +847,7 @@ protected:
|
|||
|
||||
public:
|
||||
NetworkMessageSynchNetworkGameDataFileGet();
|
||||
NetworkMessageSynchNetworkGameDataFileGet(const string fileName);
|
||||
explicit NetworkMessageSynchNetworkGameDataFileGet(const string fileName);
|
||||
|
||||
virtual size_t getDataSize() const { return sizeof(Data); }
|
||||
|
||||
|
@ -972,7 +972,7 @@ protected:
|
|||
virtual unsigned char * packMessage();
|
||||
|
||||
public:
|
||||
PlayerIndexMessage( int16 playerIndex);
|
||||
explicit PlayerIndexMessage( int16 playerIndex);
|
||||
|
||||
virtual size_t getDataSize() const { return sizeof(Data); }
|
||||
|
||||
|
@ -1038,7 +1038,7 @@ protected:
|
|||
|
||||
public:
|
||||
NetworkMessageLoadingStatus();
|
||||
NetworkMessageLoadingStatus(uint32 status);
|
||||
explicit NetworkMessageLoadingStatus(uint32 status);
|
||||
|
||||
virtual size_t getDataSize() const { return sizeof(Data); }
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ long double unpack754(unsigned long long int i, unsigned bits, unsigned expbits)
|
|||
while(shift < 0) { result /= 2.0; shift++; }
|
||||
|
||||
// sign it
|
||||
result *= (i>>(bits-1))&1? -1.0: 1.0;
|
||||
result *= ((i>>(bits-1))&1) ? -1.0: 1.0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -345,10 +345,10 @@ void FactionThread::execute() {
|
|||
codeLocation = "7";
|
||||
//Config &config= Config::getInstance();
|
||||
//bool sortedUnitsAllowed = config.getBool("AllowGroupedUnitCommands","true");
|
||||
bool sortedUnitsAllowed = false;
|
||||
if(sortedUnitsAllowed == true) {
|
||||
this->faction->sortUnitsByCommandGroups();
|
||||
}
|
||||
//bool sortedUnitsAllowed = false;
|
||||
//if(sortedUnitsAllowed == true) {
|
||||
this->faction->sortUnitsByCommandGroups();
|
||||
//}
|
||||
|
||||
codeLocation = "8";
|
||||
static string mutexOwnerId2 = string(__FILE__) + string("_") + intToStr(__LINE__);
|
||||
|
@ -1976,7 +1976,7 @@ Unit * Faction::findClosestUnitWithSkillClass( const Vec2i &pos,const CommandCla
|
|||
}
|
||||
*/
|
||||
|
||||
if(result == NULL) {
|
||||
//if(result == NULL) {
|
||||
for(int i = 0; i < getUnitCount(); ++i) {
|
||||
Unit *curUnit = getUnit(i);
|
||||
|
||||
|
@ -2014,7 +2014,7 @@ Unit * Faction::findClosestUnitWithSkillClass( const Vec2i &pos,const CommandCla
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ protected:
|
|||
virtual bool canShutdown(bool deleteSelfIfShutdownDelayed=false);
|
||||
|
||||
public:
|
||||
FactionThread(Faction *faction);
|
||||
explicit FactionThread(Faction *faction);
|
||||
virtual ~FactionThread();
|
||||
virtual void execute();
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos,
|
|||
changedActiveCommandFrame = 0;
|
||||
|
||||
lastSynchDataString="";
|
||||
modelFacing = CardinalDir::NORTH;
|
||||
modelFacing = CardinalDir(CardinalDir::NORTH);
|
||||
lastStuckFrame = 0;
|
||||
lastStuckPos = Vec2i(0,0);
|
||||
lastPathfindFailedFrame = 0;
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
static string findPath(const string &techName, const vector<string> &pathTechList);
|
||||
static bool exists(const string &techName, const vector<string> &pathTechList);
|
||||
|
||||
TechTree(const vector<string> pathList);
|
||||
explicit TechTree(const vector<string> pathList);
|
||||
~TechTree();
|
||||
Checksum * getChecksumValue() { return &checksumValue; }
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ Cell::Cell() {
|
|||
|
||||
void Cell::saveGame(XmlNode *rootNode, int index) const {
|
||||
bool saveCell = false;
|
||||
if(saveCell == false) {
|
||||
//if(saveCell == false) {
|
||||
for(unsigned int i = 0; i < fieldCount; ++i) {
|
||||
if(units[i] != NULL) {
|
||||
saveCell = true;
|
||||
|
@ -68,7 +68,7 @@ void Cell::saveGame(XmlNode *rootNode, int index) const {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
if(saveCell == true) {
|
||||
std::map<string,string> mapTagReplacements;
|
||||
|
@ -723,9 +723,9 @@ bool Map::isResourceNear(int frameIndex,const Vec2i &pos, const ResourceType *rt
|
|||
|
||||
//printf("!!!! unit [%s - %d] resPos = [%s] resourceClickPos->dist(resPos) [%f] distanceFromClick [%f] unit->getCenteredPos().dist(resPos) [%f] distanceFromUnit [%f]\n",unit->getFullName().c_str(),unit->getId(),resPos.getString().c_str(),resourceClickPos->dist(resPos),distanceFromClick,unit->getCenteredPos().dist(resPos),distanceFromUnit);
|
||||
if(distanceFromClick < 0 || resourceClickPos->dist(resPos) <= distanceFromClick) {
|
||||
if(resourceClickPos != NULL) {
|
||||
distanceFromClick = resourceClickPos->dist(resPos);
|
||||
}
|
||||
//if(resourceClickPos != NULL) {
|
||||
distanceFromClick = resourceClickPos->dist(resPos);
|
||||
//}
|
||||
if(unit != NULL) {
|
||||
distanceFromUnit = unit->getCenteredPos().dist(resPos);
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ public:
|
|||
|
||||
class FastAINodeCache {
|
||||
public:
|
||||
FastAINodeCache(Unit *unit) {
|
||||
explicit FastAINodeCache(Unit *unit) {
|
||||
this->unit = unit;
|
||||
}
|
||||
Unit *unit;
|
||||
|
|
|
@ -47,7 +47,7 @@ private:
|
|||
const Texture2D *texture;
|
||||
|
||||
public:
|
||||
SurfaceInfo(const Pixmap2D *center);
|
||||
explicit SurfaceInfo(const Pixmap2D *center);
|
||||
SurfaceInfo(const Pixmap2D *lu, const Pixmap2D *ru, const Pixmap2D *ld, const Pixmap2D *rd);
|
||||
bool operator==(const SurfaceInfo &si) const;
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ namespace Glest{ namespace Game{
|
|||
// class UnitUpdater
|
||||
// =====================================================
|
||||
|
||||
time_t UnitRangeCellsLookupItem::lastDebug = 0;
|
||||
|
||||
// ===================== PUBLIC ========================
|
||||
|
||||
UnitUpdater::UnitUpdater() : mutexAttackWarnings(new Mutex(CODE_AT_LINE)),
|
||||
|
@ -418,7 +420,7 @@ Unit* UnitUpdater::spawnUnit(Unit *unit,string spawnUnit,Vec2i spawnPos) {
|
|||
|
||||
Unit *spawned= new Unit(world->getNextUnitId(unit->getFaction()), newpath,
|
||||
Vec2i(0), spawnUnitType, unit->getFaction(),
|
||||
world->getMap(), CardinalDir::NORTH);
|
||||
world->getMap(), CardinalDir(CardinalDir::NORTH));
|
||||
|
||||
bool placedSpawnUnit=world->placeUnit(_spawnPos, 10, spawned);
|
||||
|
||||
|
@ -2095,7 +2097,7 @@ void UnitUpdater::updateRepair(Unit *unit, int frameIndex) {
|
|||
|
||||
const CommandType *ctbuild = unit->getType()->getFirstCtOfClass(ccBuild);
|
||||
NetworkCommand networkCommand(this->world,nctGiveCommand, unit->getId(), ctbuild->getId(), command->getPos(),
|
||||
command->getUnitType()->getId(), -1, CardinalDir::NORTH, true, command->getStateType(),
|
||||
command->getUnitType()->getId(), -1, CardinalDir(CardinalDir::NORTH), true, command->getStateType(),
|
||||
command->getStateValue());
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
@ -2369,7 +2371,7 @@ void UnitUpdater::updateProduce(Unit *unit, int frameIndex) {
|
|||
throw megaglest_runtime_error("detected unsupported pathfinder type!");
|
||||
}
|
||||
|
||||
produced= new Unit(world->getNextUnitId(unit->getFaction()), newpath, Vec2i(0), pct->getProducedUnit(), unit->getFaction(), world->getMap(), CardinalDir::NORTH);
|
||||
produced= new Unit(world->getNextUnitId(unit->getFaction()), newpath, Vec2i(0), pct->getProducedUnit(), unit->getFaction(), world->getMap(), CardinalDir(CardinalDir::NORTH));
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] about to place unit for unit [%s]\n",__FILE__,__FUNCTION__,__LINE__,produced->toString(false).c_str());
|
||||
|
||||
|
|
|
@ -1288,7 +1288,7 @@ void World::morphToUnit(int unitId,const string &morphName,bool ignoreRequiremen
|
|||
}
|
||||
|
||||
const UnitType* unitType = mct->getMorphUnit();
|
||||
cr = this->game->getCommander()->tryGiveCommand(unit, mct,unit->getPos(), unitType,CardinalDir::NORTH);
|
||||
cr = this->game->getCommander()->tryGiveCommand(unit, mct,unit->getPos(), unitType,CardinalDir(CardinalDir::NORTH));
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
@ -1337,7 +1337,7 @@ void World::createUnit(const string &unitName, int factionIndex, const Vec2i &po
|
|||
throw megaglest_runtime_error("detected unsupported pathfinder type!",true);
|
||||
}
|
||||
|
||||
Unit* unit= new Unit(getNextUnitId(faction), newpath, pos, ut, faction, &map, CardinalDir::NORTH);
|
||||
Unit* unit= new Unit(getNextUnitId(faction), newpath, pos, ut, faction, &map, CardinalDir(CardinalDir::NORTH));
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unit created for unit [%s]\n",__FILE__,__FUNCTION__,__LINE__,unit->toString().c_str());
|
||||
|
||||
|
@ -2269,7 +2269,7 @@ void World::initUnits() {
|
|||
throw megaglest_runtime_error("detected unsupported pathfinder type!");
|
||||
}
|
||||
|
||||
Unit *unit= new Unit(getNextUnitId(f), newpath, Vec2i(0), ut, f, &map, CardinalDir::NORTH);
|
||||
Unit *unit= new Unit(getNextUnitId(f), newpath, Vec2i(0), ut, f, &map, CardinalDir(CardinalDir::NORTH));
|
||||
int startLocationIndex= f->getStartLocationIndex();
|
||||
placeUnitAtLocation(map.getStartLocation(startLocationIndex), generationArea, unit, true);
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ bool isdir(const char *path);
|
|||
bool fileExists(const string &path);
|
||||
inline bool folderExists(const string &path) { return isdir(path.c_str()); }
|
||||
|
||||
void findDirs(string path, vector<string> &results, bool errorOnNotFound,bool keepDuplicates);
|
||||
void findDirs(const string &path, vector<string> &results, bool errorOnNotFound,bool keepDuplicates);
|
||||
void findDirs(const vector<string> &paths, vector<string> &results, bool errorOnNotFound=false,bool keepDuplicates=false);
|
||||
void findAll(const vector<string> &paths, const string &fileFilter, vector<string> &results, bool cutExtension=false, bool errorOnNotFound=true,bool keepDuplicates=false);
|
||||
void findAll(const string &path, vector<string> &results, bool cutExtension=false, bool errorOnNotFound=true);
|
||||
|
@ -195,24 +195,24 @@ vector<string> getFolderTreeContentsListRecursively(const string &path, const st
|
|||
|
||||
string getGameVersion();
|
||||
string getGameGITVersion();
|
||||
void setGameVersion(string version);
|
||||
void setGameGITVersion(string git);
|
||||
void setGameVersion(const string &version);
|
||||
void setGameGITVersion(const string &git);
|
||||
|
||||
string getCRCCacheFilePath();
|
||||
void setCRCCacheFilePath(string path);
|
||||
void setCRCCacheFilePath(const string &path);
|
||||
|
||||
std::pair<string,string> getFolderTreeContentsCheckSumCacheKey(vector<string> paths, string pathSearchString, const string &filterFileExt);
|
||||
void clearFolderTreeContentsCheckSum(vector<string> paths, string pathSearchString, const string &filterFileExt);
|
||||
std::pair<string,string> getFolderTreeContentsCheckSumCacheKey(vector<string> paths, const string &pathSearchString, const string &filterFileExt);
|
||||
void clearFolderTreeContentsCheckSum(vector<string> paths, const string &pathSearchString, const string &filterFileExt);
|
||||
uint32 getFolderTreeContentsCheckSumRecursively(vector<string> paths, string pathSearchString, const string &filterFileExt, Checksum *recursiveChecksum,bool forceNoCache=false);
|
||||
time_t getFolderTreeContentsCheckSumRecursivelyLastGenerated(vector<string> paths, string pathSearchString, const string &filterFileExt);
|
||||
time_t getFolderTreeContentsCheckSumRecursivelyLastGenerated(const vector<string> &paths, string pathSearchString, const string &filterFileExt);
|
||||
|
||||
std::pair<string,string> getFolderTreeContentsCheckSumCacheKey(const string &path, const string &filterFileExt);
|
||||
void clearFolderTreeContentsCheckSum(const string &path, const string &filterFileExt);
|
||||
uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string &filterFileExt, Checksum *recursiveChecksum,bool forceNoCache=false);
|
||||
|
||||
std::pair<string,string> getFolderTreeContentsCheckSumListCacheKey(vector<string> paths, string pathSearchString, const string &filterFileExt);
|
||||
void clearFolderTreeContentsCheckSumList(vector<string> paths, string pathSearchString, const string &filterFileExt);
|
||||
vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(vector<string> paths, string pathSearchString, const string &filterFileExt, vector<std::pair<string,uint32> > *recursiveMap);
|
||||
std::pair<string,string> getFolderTreeContentsCheckSumListCacheKey(vector<string> paths, const string &pathSearchString, const string &filterFileExt);
|
||||
void clearFolderTreeContentsCheckSumList(vector<string> paths, const string &pathSearchString, const string &filterFileExt);
|
||||
vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(vector<string> paths, const string &pathSearchString, const string &filterFileExt, vector<std::pair<string,uint32> > *recursiveMap);
|
||||
|
||||
std::pair<string,string> getFolderTreeContentsCheckSumListCacheKey(const string &path, const string &filterFileExt);
|
||||
void clearFolderTreeContentsCheckSumList(const string &path, const string &filterFileExt);
|
||||
|
@ -303,7 +303,7 @@ string getFullFileArchiveCompressCommand(string fileArchiveCompressCommand,
|
|||
string fileArchiveCompressCommandParameters, string archivename, string archivefiles);
|
||||
|
||||
bool executeShellCommand(string cmd,int expectedResult=IGNORE_CMD_RESULT_VALUE,ShellCommandOutputCallbackInterface *cb=NULL);
|
||||
string executable_path(string exeName,bool includeExeNameInPath=false);
|
||||
string executable_path(const string &exeName,bool includeExeNameInPath=false);
|
||||
|
||||
void saveDataToFile(string filename, string data);
|
||||
|
||||
|
|
|
@ -2090,14 +2090,9 @@ void BaseColorPickEntity::recycleUniqueColor() {
|
|||
|
||||
if(usedColorIDList.empty() == false) {
|
||||
string color_key = getColorDescription();
|
||||
if(usedColorIDList.find(color_key) != usedColorIDList.end()) {
|
||||
usedColorIDList.erase(color_key);
|
||||
|
||||
//printf("REMOVING used Color [%s] usedColorIDList = %d nextColorIDReuseList = %d!\n",color_key.c_str(),(int)usedColorIDList.size(),(int)nextColorIDReuseList.size());
|
||||
}
|
||||
else {
|
||||
printf("Line ref: %d *WARNING* color [%s] used count: %d NOT FOUND in history list!\n",__LINE__,color_key.c_str(),(int)usedColorIDList.size());
|
||||
}
|
||||
usedColorIDList.erase(color_key);
|
||||
//printf("REMOVING used Color [%s] usedColorIDList = %d nextColorIDReuseList = %d!\n",color_key.c_str(),(int)usedColorIDList.size(),(int)nextColorIDReuseList.size());
|
||||
//printf("Line ref: %d *WARNING* color [%s] used count: %d NOT FOUND in history list!\n",__LINE__,color_key.c_str(),(int)usedColorIDList.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ void Tokenize(const string& str,vector<string>& tokens,const string& delimiters)
|
|||
|
||||
}
|
||||
|
||||
void findDirs(string path, vector<string> &results, bool errorOnNotFound,bool keepDuplicates) {
|
||||
void findDirs(const string &path, vector<string> &results, bool errorOnNotFound,bool keepDuplicates) {
|
||||
results.clear();
|
||||
string currentPath = path;
|
||||
endPathWithSlash(currentPath);
|
||||
|
@ -687,7 +687,7 @@ string getCRCCacheFilePath() {
|
|||
return crcCachePath;
|
||||
}
|
||||
|
||||
void setCRCCacheFilePath(string path) {
|
||||
void setCRCCacheFilePath(const string &path) {
|
||||
crcCachePath = path;
|
||||
}
|
||||
|
||||
|
@ -697,10 +697,10 @@ string getGameVersion() {
|
|||
string getGameGITVersion() {
|
||||
return gameGITVersion;
|
||||
}
|
||||
void setGameVersion(string version) {
|
||||
void setGameVersion(const string &version) {
|
||||
gameVersion = version;
|
||||
}
|
||||
void setGameGITVersion(string git) {
|
||||
void setGameGITVersion(const string &git) {
|
||||
gameGITVersion = git;
|
||||
}
|
||||
|
||||
|
@ -718,7 +718,7 @@ string getFormattedCRCCacheFileName(std::pair<string,string> cacheKeys) {
|
|||
string result = getCRCCacheFilePath() + "CRC_CACHE_" + uIntToStr(checksum.getSum());
|
||||
return result;
|
||||
}
|
||||
std::pair<string,string> getFolderTreeContentsCheckSumCacheKey(vector<string> paths, string pathSearchString, const string &filterFileExt) {
|
||||
std::pair<string,string> getFolderTreeContentsCheckSumCacheKey(vector<string> paths, const string &pathSearchString, const string &filterFileExt) {
|
||||
string cacheLookupId = CacheManager::getFolderTreeContentsCheckSumRecursivelyCacheLookupKey1;
|
||||
|
||||
string cacheKey = "";
|
||||
|
@ -886,15 +886,14 @@ void writeCachedFileCRCValue(string crcCacheFile, uint32 &crcValue, string actua
|
|||
}
|
||||
}
|
||||
|
||||
void clearFolderTreeContentsCheckSum(vector<string> paths, string pathSearchString, const string &filterFileExt) {
|
||||
void clearFolderTreeContentsCheckSum(vector<string> paths, const string &pathSearchString, const string &filterFileExt) {
|
||||
std::pair<string,string> cacheKeys = getFolderTreeContentsCheckSumCacheKey(paths, pathSearchString, filterFileExt);
|
||||
string cacheLookupId = cacheKeys.first;
|
||||
std::map<string,uint32> &crcTreeCache = CacheManager::getCachedItem< std::map<string,uint32> >(cacheLookupId);
|
||||
|
||||
string cacheKey = cacheKeys.second;
|
||||
if(crcTreeCache.find(cacheKey) != crcTreeCache.end()) {
|
||||
crcTreeCache.erase(cacheKey);
|
||||
}
|
||||
crcTreeCache.erase(cacheKey);
|
||||
|
||||
for(unsigned int idx = 0; idx < paths.size(); ++idx) {
|
||||
string path = paths[idx];
|
||||
clearFolderTreeContentsCheckSum(path, filterFileExt);
|
||||
|
@ -908,7 +907,7 @@ void clearFolderTreeContentsCheckSum(vector<string> paths, string pathSearchStri
|
|||
}
|
||||
}
|
||||
|
||||
time_t getFolderTreeContentsCheckSumRecursivelyLastGenerated(vector<string> paths, string pathSearchString, const string &filterFileExt) {
|
||||
time_t getFolderTreeContentsCheckSumRecursivelyLastGenerated(const vector<string> &paths, string pathSearchString, const string &filterFileExt) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"-------------- In [%s::%s Line: %d] Calculating CRC for [%s] -----------\n",__FILE__,__FUNCTION__,__LINE__,pathSearchString.c_str());
|
||||
|
||||
std::pair<string,string> cacheKeys = getFolderTreeContentsCheckSumCacheKey(paths, pathSearchString, filterFileExt);
|
||||
|
@ -1013,9 +1012,8 @@ void clearFolderTreeContentsCheckSum(const string &path, const string &filterFil
|
|||
std::map<string,uint32> &crcTreeCache = CacheManager::getCachedItem< std::map<string,uint32> >(cacheLookupId);
|
||||
|
||||
string cacheKey = cacheKeys.second;
|
||||
if(crcTreeCache.find(cacheKey) != crcTreeCache.end()) {
|
||||
crcTreeCache.erase(cacheKey);
|
||||
}
|
||||
crcTreeCache.erase(cacheKey);
|
||||
|
||||
string crcCacheFile = getFormattedCRCCacheFileName(cacheKeys);
|
||||
if(fileExists(crcCacheFile) == true) {
|
||||
bool result = removeFile(crcCacheFile);
|
||||
|
@ -1166,7 +1164,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
|
|||
}
|
||||
|
||||
|
||||
std::pair<string,string> getFolderTreeContentsCheckSumListCacheKey(vector<string> paths, string pathSearchString, const string &filterFileExt) {
|
||||
std::pair<string,string> getFolderTreeContentsCheckSumListCacheKey(vector<string> paths, const string &pathSearchString, const string &filterFileExt) {
|
||||
string cacheLookupId = CacheManager::getFolderTreeContentsCheckSumListRecursivelyCacheLookupKey1;
|
||||
|
||||
string cacheKey = "";
|
||||
|
@ -1177,15 +1175,14 @@ std::pair<string,string> getFolderTreeContentsCheckSumListCacheKey(vector<string
|
|||
return make_pair(cacheLookupId,cacheKey);
|
||||
}
|
||||
|
||||
void clearFolderTreeContentsCheckSumList(vector<string> paths, string pathSearchString, const string &filterFileExt) {
|
||||
void clearFolderTreeContentsCheckSumList(vector<string> paths, const string &pathSearchString, const string &filterFileExt) {
|
||||
std::pair<string,string> cacheKeys = getFolderTreeContentsCheckSumListCacheKey(paths, pathSearchString, filterFileExt);
|
||||
string cacheLookupId = cacheKeys.first;
|
||||
std::map<string,vector<std::pair<string,uint32> > > &crcTreeCache = CacheManager::getCachedItem< std::map<string,vector<std::pair<string,uint32> > > >(cacheLookupId);
|
||||
|
||||
string cacheKey = cacheKeys.second;
|
||||
if(crcTreeCache.find(cacheKey) != crcTreeCache.end()) {
|
||||
crcTreeCache.erase(cacheKey);
|
||||
}
|
||||
crcTreeCache.erase(cacheKey);
|
||||
|
||||
for(unsigned int idx = 0; idx < paths.size(); ++idx) {
|
||||
string path = paths[idx];
|
||||
clearFolderTreeContentsCheckSumList(path, filterFileExt);
|
||||
|
@ -1197,7 +1194,7 @@ void clearFolderTreeContentsCheckSumList(vector<string> paths, string pathSearch
|
|||
}
|
||||
}
|
||||
|
||||
vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(vector<string> paths, string pathSearchString, const string &filterFileExt, vector<std::pair<string,uint32> > *recursiveMap) {
|
||||
vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(vector<string> paths, const string &pathSearchString, const string &filterFileExt, vector<std::pair<string,uint32> > *recursiveMap) {
|
||||
std::pair<string,string> cacheKeys = getFolderTreeContentsCheckSumListCacheKey(paths, pathSearchString, filterFileExt);
|
||||
string cacheLookupId = cacheKeys.first;
|
||||
std::map<string,vector<std::pair<string,uint32> > > &crcTreeCache = CacheManager::getCachedItem< std::map<string,vector<std::pair<string,uint32> > > >(cacheLookupId);
|
||||
|
@ -1360,9 +1357,8 @@ void clearFolderTreeContentsCheckSumList(const string &path, const string &filte
|
|||
std::map<string,vector<std::pair<string,uint32> > > &crcTreeCache = CacheManager::getCachedItem< std::map<string,vector<std::pair<string,uint32> > > >(cacheLookupId);
|
||||
|
||||
string cacheKey = cacheKeys.second;
|
||||
if(crcTreeCache.find(cacheKey) != crcTreeCache.end()) {
|
||||
crcTreeCache.erase(cacheKey);
|
||||
}
|
||||
crcTreeCache.erase(cacheKey);
|
||||
|
||||
string crcCacheFile = getFormattedCRCCacheFileName(cacheKeys);
|
||||
if(fileExists(crcCacheFile) == true) {
|
||||
bool result = removeFile(crcCacheFile);
|
||||
|
@ -2001,7 +1997,7 @@ off_t getFileSize(string filename) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
string executable_path(string exeName, bool includeExeNameInPath) {
|
||||
string executable_path(const string &exeName, bool includeExeNameInPath) {
|
||||
string value = "";
|
||||
#ifdef _WIN32
|
||||
char path[MAX_PATH]="";
|
||||
|
|
|
@ -807,7 +807,7 @@ void Socket::getLocalIPAddressListForPlatform(std::vector<std::string> &ipList)
|
|||
PIP_ADAPTER_UNICAST_ADDRESS pUnicast = NULL;
|
||||
LPSOCKADDR addr = NULL;
|
||||
pCurrAddresses = pAddresses;
|
||||
char buff[100];
|
||||
//char buff[100];
|
||||
DWORD bufflen=100;
|
||||
while (pCurrAddresses) {
|
||||
if (pCurrAddresses->OperStatus != IfOperStatusUp) {
|
||||
|
|
Loading…
Reference in New Issue