- a few minor bug fixes related to code warnings
- code cleanup based on additional gcc warnings - enabled additional gcc compiler warnings
This commit is contained in:
parent
642a26bdb5
commit
9268aaf279
|
@ -119,10 +119,10 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
|||
IF(NOT MINGW)
|
||||
# For tons of verbose warnings add: -Wall
|
||||
# ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -rdynamic")
|
||||
ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -rdynamic")
|
||||
ADD_DEFINITIONS("-Wuninitialized -Wsign-compare -Wunused-function -Wunused-variable -Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -rdynamic")
|
||||
ELSE()
|
||||
# ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -DUNICODE")
|
||||
ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -DUNICODE")
|
||||
ADD_DEFINITIONS("-Wuninitialized -Wsign-compare -Wunused-function -Wunused-variable -Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -DUNICODE")
|
||||
ENDIF()
|
||||
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
|
||||
|
|
|
@ -285,10 +285,16 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
|||
: wxFrame(NULL, -1, ToUnicode(winHeader),
|
||||
wxPoint(Renderer::windowX, Renderer::windowY),
|
||||
wxSize(Renderer::windowW, Renderer::windowH)),
|
||||
model(NULL), glCanvas(NULL), renderer(NULL),
|
||||
initTextureManager(true), timer(NULL),
|
||||
startupSettingsInited(false),
|
||||
fileDialog(NULL),colorPicker(NULL)
|
||||
glCanvas(NULL),
|
||||
renderer(NULL),
|
||||
timer(NULL),
|
||||
menu(NULL),
|
||||
fileDialog(NULL),
|
||||
colorPicker(NULL),
|
||||
model(NULL),
|
||||
initTextureManager(true),
|
||||
startupSettingsInited(false)
|
||||
|
||||
{
|
||||
this->appPath = appPath;
|
||||
Properties::setApplicationPath(executable_path(appPath));
|
||||
|
@ -599,6 +605,10 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
|||
// dc.DestroyClippingRegion();
|
||||
// }
|
||||
|
||||
static float autoScreenshotRender = -1;
|
||||
if(autoScreenShotAndExit == true && autoScreenshotRender >= 0) {
|
||||
anim = autoScreenshotRender;
|
||||
}
|
||||
// notice that we use GetSize() here and not GetClientSize() because
|
||||
// the latter doesn't return correct results for the minimized windows
|
||||
// (at least not under Windows)
|
||||
|
@ -613,6 +623,11 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
|||
viewportW = GetSize().x;
|
||||
viewportH = GetSize().y;
|
||||
|
||||
if(viewportH > 0) {
|
||||
//viewportH -= menu->GetSize().y;
|
||||
viewportH -= 22;
|
||||
}
|
||||
|
||||
printf("#2 %d x %d\n",viewportW,viewportH);
|
||||
}
|
||||
|
||||
|
@ -622,8 +637,6 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
|||
renderer->reset(viewportW, viewportH, playerColor);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
renderer->transform(rotX, rotY, zoom);
|
||||
renderer->renderGrid();
|
||||
|
||||
|
@ -654,6 +667,7 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
|||
fflush(stdout);
|
||||
|
||||
autoScreenShotAndExit = false;
|
||||
|
||||
saveScreenshot();
|
||||
Close();
|
||||
return;
|
||||
|
@ -662,6 +676,8 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
|||
glCanvas->SwapBuffers();
|
||||
|
||||
if(autoScreenShotAndExit == true && viewportW == 0 && viewportH == 0) {
|
||||
autoScreenshotRender = anim;
|
||||
|
||||
printf("Auto exiting desired but waiting for w x h > 0...\n");
|
||||
|
||||
return;
|
||||
|
@ -1161,7 +1177,7 @@ void MainWindow::loadUnit(string path, string skillName) {
|
|||
const XmlNode *skillsNode= unitNode->getChild("skills");
|
||||
for(unsigned int i = 0; foundSkillName == false && i < skillsNode->getChildCount(); ++i) {
|
||||
const XmlNode *sn= skillsNode->getChild("skill", i);
|
||||
const XmlNode *typeNode= sn->getChild("type");
|
||||
//const XmlNode *typeNode= sn->getChild("type");
|
||||
const XmlNode *nameNode= sn->getChild("name");
|
||||
string skillXmlName = nameNode->getAttribute("value")->getRestrictedValue();
|
||||
if(skillXmlName == lookipForSkillName) {
|
||||
|
@ -1545,7 +1561,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
|||
std::string unitXML = dir + folderDelimiter + extractFileFromDirectoryPath(dir) + ".xml";
|
||||
|
||||
int size = 1;
|
||||
int height = 1;
|
||||
//int height = 1;
|
||||
|
||||
if(fileExists(unitXML) == true) {
|
||||
XmlTree xmlTree;
|
||||
|
@ -1555,7 +1571,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
|||
//size
|
||||
size= parametersNode->getChild("size")->getAttribute("value")->getIntValue();
|
||||
//height
|
||||
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
||||
//height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
||||
}
|
||||
|
||||
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||
|
@ -1582,7 +1598,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
|||
SplashParticleSystem *ps = (*it)->create(NULL);
|
||||
|
||||
if(size > 0) {
|
||||
Vec3f vec = Vec3f(0.f, height / 2.f, 0.f);
|
||||
//Vec3f vec = Vec3f(0.f, height / 2.f, 0.f);
|
||||
//ps->setPos(vec);
|
||||
|
||||
//Vec3f vec2 = Vec3f(size * 2.f, height * 2.f, height * 2.f); // <------- removed relative projectile
|
||||
|
|
|
@ -717,7 +717,7 @@ void Ai::addExpansion(const Vec2i &pos) {
|
|||
expansionPositions.push_front(pos);
|
||||
|
||||
//remove expansion if queue is list is full
|
||||
if(expansionPositions.size() > maxExpansions){
|
||||
if((int)expansionPositions.size() > maxExpansions){
|
||||
expansionPositions.pop_back();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1276,7 +1276,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,producers.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
if(prIndex >= producers.size()) {
|
||||
if(prIndex >= (int)producers.size()) {
|
||||
char szBuf[8096]="";
|
||||
printf("In [%s::%s Line: %d] prIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER " \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,producers.size());
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,producers.size());
|
||||
|
@ -1341,7 +1341,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,backupProducers.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
if(prIndex >= backupProducers.size()) {
|
||||
if(prIndex >= (int)backupProducers.size()) {
|
||||
char szBuf[8096]="";
|
||||
printf("In [%s::%s Line: %d] prIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER " \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,backupProducers.size());
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,backupProducers.size());
|
||||
|
@ -1613,7 +1613,7 @@ void AiRuleBuild::buildGeneric(const BuildTask *bt) {
|
|||
}
|
||||
|
||||
if(aiInterface->isLogLevelEnabled(4) == true) {
|
||||
for(int i = 0; i < buildings.size(); ++i) {
|
||||
for(int i = 0; i < (int)buildings.size(); ++i) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In buildGeneric i = %d unit type: [%s]\n",i,buildings[i]->getName().c_str());
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
@ -1642,7 +1642,7 @@ void AiRuleBuild::buildBestBuilding(const vector<const UnitType*> &buildings){
|
|||
if(i>0){
|
||||
|
||||
//Defensive buildings have priority
|
||||
for(int j=0; j<buildings.size() && !buildingFound; ++j){
|
||||
for(int j=0; j < (int)buildings.size() && buildingFound == false; ++j){
|
||||
const UnitType *building= buildings[j];
|
||||
if(ai->getCountOfType(building)<=i+1 && isDefensive(building)) {
|
||||
|
||||
|
|
|
@ -457,6 +457,9 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(minorDebugPathfinderPerformance && chrono.getMillis() >= 1) printf("Unit [%d - %s] astar took [%lld] msecs, ts = %d searched_node_count = %d.\n",unit->getId(),unit->getType()->getName(false).c_str(),(long long int)chrono.getMillis(),ts,searched_node_count);
|
||||
|
||||
|
@ -570,7 +573,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
|
|||
|
||||
if(canMoveToCells == true) {
|
||||
path->clear();
|
||||
UnitPathBasic *basicPathFinder = dynamic_cast<UnitPathBasic *>(path);
|
||||
//UnitPathBasic *basicPathFinder = dynamic_cast<UnitPathBasic *>(path);
|
||||
|
||||
int unitPrecachePathSize = (int)faction.precachedPath[unit->getId()].size();
|
||||
|
||||
|
@ -873,7 +876,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
|
|||
path->clear();
|
||||
}
|
||||
|
||||
UnitPathBasic *basicPathFinder = dynamic_cast<UnitPathBasic *>(path);
|
||||
//UnitPathBasic *basicPathFinder = dynamic_cast<UnitPathBasic *>(path);
|
||||
|
||||
currNode= firstNode;
|
||||
|
||||
|
@ -1133,11 +1136,11 @@ void PathFinder::saveGame(XmlNode *rootNode) {
|
|||
|
||||
pathfinderNode->addAttribute("pathFindNodesMax",intToStr(pathFindNodesMax), mapTagReplacements);
|
||||
pathfinderNode->addAttribute("pathFindNodesAbsoluteMax",intToStr(pathFindNodesAbsoluteMax), mapTagReplacements);
|
||||
for(unsigned int i = 0; i < factions.size(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)factions.size(); ++i) {
|
||||
FactionState &factionState = factions.getFactionState(i);
|
||||
XmlNode *factionsNode = pathfinderNode->addChild("factions");
|
||||
|
||||
for(unsigned int j = 0; j < factionState.nodePool.size(); ++j) {
|
||||
for(unsigned int j = 0; j < (unsigned int)factionState.nodePool.size(); ++j) {
|
||||
Node *curNode = &factionState.nodePool[j];
|
||||
XmlNode *nodePoolNode = factionsNode->addChild("nodePool");
|
||||
|
||||
|
@ -1160,12 +1163,12 @@ void PathFinder::loadGame(const XmlNode *rootNode) {
|
|||
const XmlNode *pathfinderNode = rootNode->getChild("PathFinder");
|
||||
|
||||
vector<XmlNode *> factionsNodeList = pathfinderNode->getChildList("factions");
|
||||
for(unsigned int i = 0; i < factionsNodeList.size(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)factionsNodeList.size(); ++i) {
|
||||
XmlNode *factionsNode = factionsNodeList[i];
|
||||
|
||||
FactionState &factionState = factions.getFactionState(i);
|
||||
vector<XmlNode *> nodePoolListNode = factionsNode->getChildList("nodePool");
|
||||
for(unsigned int j = 0; j < nodePoolListNode.size() && j < pathFindNodesAbsoluteMax; ++j) {
|
||||
for(unsigned int j = 0; j < (unsigned int)nodePoolListNode.size() && j < (unsigned int)pathFindNodesAbsoluteMax; ++j) {
|
||||
XmlNode *nodePoolNode = nodePoolListNode[j];
|
||||
|
||||
Node *curNode = &factionState.nodePool[j];
|
||||
|
|
|
@ -213,7 +213,7 @@ private:
|
|||
TravelState aStar(Unit *unit, const Vec2i &finalPos, bool inBailout,
|
||||
int frameIndex, int maxNodeCount=-1,uint32 *searched_node_count=NULL);
|
||||
inline static Node *newNode(FactionState &faction, int maxNodeCount) {
|
||||
if( faction.nodePoolCount < faction.nodePool.size() &&
|
||||
if( faction.nodePoolCount < (int)faction.nodePool.size() &&
|
||||
faction.nodePoolCount < maxNodeCount) {
|
||||
Node *node= &(faction.nodePool[faction.nodePoolCount]);
|
||||
node->clear();
|
||||
|
|
|
@ -74,7 +74,7 @@ void GraphicComponent::clearRegisterGraphicComponent(std::string containerName,
|
|||
}
|
||||
|
||||
void GraphicComponent::clearRegisterGraphicComponent(std::string containerName, std::vector<std::string> objNameList) {
|
||||
for(int idx = 0; idx < objNameList.size(); ++idx) {
|
||||
for(int idx = 0; idx < (int)objNameList.size(); ++idx) {
|
||||
GraphicComponent::clearRegisterGraphicComponent(containerName, objNameList[idx]);
|
||||
}
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ void GraphicListBox::init(int x, int y, int w, int h, Vec3f textColor){
|
|||
const string & GraphicListBox::getTextNativeTranslation() {
|
||||
if(this->translated_items.empty() == true ||
|
||||
this->selectedItemIndex < 0 ||
|
||||
this->selectedItemIndex >= this->translated_items.size() ||
|
||||
this->selectedItemIndex >= (int)this->translated_items.size() ||
|
||||
this->items.size() != this->translated_items.size()) {
|
||||
return this->text;
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ void GraphicListBox::setItems(const vector<string> &items, const vector<string>
|
|||
}
|
||||
|
||||
void GraphicListBox::setSelectedItemIndex(int index, bool errorOnMissing){
|
||||
if(errorOnMissing == true && (index < 0 || index >= items.size())) {
|
||||
if(errorOnMissing == true && (index < 0 || index >= (int)items.size())) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Index not found in listbox name: [%s] value index: %d size: %lu",this->instanceName.c_str(),index,(unsigned long)items.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -505,7 +505,7 @@ void GraphicListBox::setSelectedItem(string item, bool errorOnMissing){
|
|||
|
||||
if(iter==items.end()) {
|
||||
if(errorOnMissing == true) {
|
||||
for(int idx = 0; idx < items.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)items.size(); idx++) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\ninstanceName [%s] idx = %d items[idx] = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,instanceName.c_str(),idx,items[idx].c_str());
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
|||
if(advanceToItemStartingWith != "") {
|
||||
for(int i = selectedItemIndex - 1; i >= 0; --i) {
|
||||
string item = items[i];
|
||||
if(translated_items.size()>i) item=translated_items[i];
|
||||
if((int)translated_items.size() > i) item = translated_items[i];
|
||||
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||
bFound = true;
|
||||
selectedItemIndex = i;
|
||||
|
@ -554,7 +554,7 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
|||
if(bFound == false) {
|
||||
for(int i = (int)items.size() - 1; i >= selectedItemIndex; --i) {
|
||||
string item = items[i];
|
||||
if(translated_items.size()>i) item=translated_items[i];
|
||||
if((int)translated_items.size() > i) item = translated_items[i];
|
||||
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
||||
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||
bFound = true;
|
||||
|
@ -574,9 +574,9 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
|||
else if(b2) {
|
||||
bool bFound = false;
|
||||
if(advanceToItemStartingWith != "") {
|
||||
for(int i = selectedItemIndex + 1; i < items.size(); ++i) {
|
||||
for(int i = selectedItemIndex + 1; i < (int)items.size(); ++i) {
|
||||
string item = items[i];
|
||||
if(translated_items.size()>i) item=translated_items[i];
|
||||
if((int)translated_items.size() > i) item = translated_items[i];
|
||||
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
||||
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||
bFound = true;
|
||||
|
@ -587,7 +587,7 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
|||
if(bFound == false) {
|
||||
for(int i = 0; i <= selectedItemIndex; ++i) {
|
||||
string item = items[i];
|
||||
if(translated_items.size()>i) item=translated_items[i];
|
||||
if((int)translated_items.size() > i) item = translated_items[i];
|
||||
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
||||
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||
bFound = true;
|
||||
|
@ -600,7 +600,7 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
|||
if(bFound == false) {
|
||||
selectedItemIndex++;
|
||||
}
|
||||
if(selectedItemIndex>=items.size()){
|
||||
if(selectedItemIndex >= (int)items.size()) {
|
||||
selectedItemIndex=0;
|
||||
}
|
||||
}
|
||||
|
@ -789,11 +789,14 @@ bool GraphicCheckBox::mouseMove(int x, int y){
|
|||
|
||||
bool GraphicCheckBox::mouseClick(int x, int y){
|
||||
bool result=GraphicComponent::mouseClick( x, y);
|
||||
if(result)
|
||||
if(value)
|
||||
if(result == true) {
|
||||
if(value) {
|
||||
value=false;
|
||||
else
|
||||
}
|
||||
else {
|
||||
value=true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ string formatString(string str) {
|
|||
}
|
||||
|
||||
bool afterSeparator= false;
|
||||
for(int i= 0; i<str.size(); ++i){
|
||||
for(int i= 0; i < (int)str.size(); ++i){
|
||||
if(outStr[i]=='_'){
|
||||
outStr[i]= ' ';
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
|||
|
||||
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
|
||||
const GameSettings *settings = gameNetworkInterface->getGameSettings();
|
||||
for(unsigned int factionIndex = 0; factionIndex < settings->getFactionCount(); ++factionIndex) {
|
||||
for(unsigned int factionIndex = 0; factionIndex < (unsigned int)settings->getFactionCount(); ++factionIndex) {
|
||||
string playerName = settings->getNetworkPlayerName(factionIndex);
|
||||
if(playerName.length() > autoCompleteName.length() &&
|
||||
StartsWith(toLower(playerName), toLower(autoCompleteName)) == true) {
|
||||
|
@ -217,7 +217,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
|||
}
|
||||
if(matchedIndexes.empty() == false) {
|
||||
int newMatchedIndex = -1;
|
||||
for(unsigned int index = 0; index < matchedIndexes.size(); ++index) {
|
||||
for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) {
|
||||
int possibleMatchIndex = matchedIndexes[index];
|
||||
if(replaceCurrentAutoCompleteName < 0 ||
|
||||
(replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex > replaceCurrentAutoCompleteName)) {
|
||||
|
@ -226,7 +226,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
|||
}
|
||||
}
|
||||
if(newMatchedIndex < 0) {
|
||||
for(unsigned int index = 0; index < matchedIndexes.size(); ++index) {
|
||||
for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) {
|
||||
int possibleMatchIndex = matchedIndexes[index];
|
||||
if(replaceCurrentAutoCompleteName < 0 ||
|
||||
(replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex < replaceCurrentAutoCompleteName)) {
|
||||
|
@ -244,7 +244,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
|||
if(autoCompleteResult == "") {
|
||||
replaceCurrentAutoCompleteName = -1;
|
||||
matchedIndexes.clear();
|
||||
for(unsigned int index = 0; index < autoCompleteTextList.size(); ++index) {
|
||||
for(unsigned int index = 0; index < (unsigned int)autoCompleteTextList.size(); ++index) {
|
||||
string autoText = autoCompleteTextList[index];
|
||||
|
||||
//printf("CHECKING #2 autoText.length() = %d [%s] autoCompleteName.length() = %d [%s]\n",autoText.length(),autoText.c_str(),autoCompleteName.length(),currentAutoCompleteName.c_str());
|
||||
|
@ -265,7 +265,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
|||
}
|
||||
if(matchedIndexes.empty() == false) {
|
||||
int newMatchedIndex = -1;
|
||||
for(unsigned int index = 0; index < matchedIndexes.size(); ++index) {
|
||||
for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) {
|
||||
int possibleMatchIndex = matchedIndexes[index];
|
||||
if(replaceCurrentAutoCompleteName < 0 ||
|
||||
(replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex > replaceCurrentAutoCompleteName)) {
|
||||
|
@ -274,7 +274,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
|||
}
|
||||
}
|
||||
if(newMatchedIndex < 0) {
|
||||
for(unsigned int index = 0; index < matchedIndexes.size(); ++index) {
|
||||
for(unsigned int index = 0; index < (unsigned int)matchedIndexes.size(); ++index) {
|
||||
int possibleMatchIndex = matchedIndexes[index];
|
||||
if(replaceCurrentAutoCompleteName < 0 ||
|
||||
(replaceCurrentAutoCompleteName >= 0 && possibleMatchIndex < replaceCurrentAutoCompleteName)) {
|
||||
|
@ -327,7 +327,7 @@ void ChatManager::keyPress(SDL_KeyboardEvent c) {
|
|||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,c.keysym.sym,c.keysym.sym);
|
||||
|
||||
int maxTextLenAllowed = (customCB != NULL ? this->maxCustomTextLength : maxTextLenght);
|
||||
if(editEnabled && text.size() < maxTextLenAllowed) {
|
||||
if(editEnabled && (int)text.size() < maxTextLenAllowed) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,c.keysym.sym,c.keysym.sym);
|
||||
//space is the first meaningful code
|
||||
wchar_t key = extractKeyPressedUnicode(c);
|
||||
|
@ -350,15 +350,15 @@ void ChatManager::switchOnEdit(CustomInputCallbackInterface *customCB,int maxCus
|
|||
}
|
||||
|
||||
void ChatManager::deleteText(int deleteCount,bool addToAutoCompleteBuffer) {
|
||||
if(text.empty() == false) {
|
||||
for(unsigned int i = 0; i < deleteCount; ++i) {
|
||||
if(text.empty() == false && deleteCount >= 0) {
|
||||
for(unsigned int i = 0; i < (unsigned int)deleteCount; ++i) {
|
||||
if(textCharLength.empty() == false) {
|
||||
//printf("BEFORE DEL textCharLength.size() = %d textCharLength[textCharLength.size()-1] = %d text.length() = %d\n",textCharLength.size(),textCharLength[textCharLength.size()-1],text.length());
|
||||
|
||||
if(textCharLength[textCharLength.size()-1] > (int)text.length()) {
|
||||
textCharLength[(int)textCharLength.size()-1] = (int)text.length();
|
||||
}
|
||||
for(unsigned int i = 0; i < textCharLength[textCharLength.size()-1]; ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)textCharLength[textCharLength.size()-1]; ++i) {
|
||||
text.erase(text.end() -1);
|
||||
}
|
||||
//printf("AFTER DEL textCharLength.size() = %d textCharLength[textCharLength.size()-1] = %d text.length() = %d\n",textCharLength.size(),textCharLength[textCharLength.size()-1],text.length());
|
||||
|
@ -428,7 +428,7 @@ void ChatManager::updateAutoCompleteBuffer() {
|
|||
|
||||
void ChatManager::addText(string text) {
|
||||
int maxTextLenAllowed = (customCB != NULL ? this->maxCustomTextLength : maxTextLenght);
|
||||
if(editEnabled && text.size() + this->text.size() < maxTextLenAllowed) {
|
||||
if(editEnabled && (int)text.size() + (int)this->text.size() < maxTextLenAllowed) {
|
||||
this->text += text;
|
||||
}
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ void ChatManager::updateNetwork() {
|
|||
Lang &lang= Lang::getInstance();
|
||||
|
||||
std::vector<ChatMsgInfo> chatList = gameNetworkInterface->getChatTextList(true);
|
||||
for(int idx = 0; idx < chatList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)chatList.size(); idx++) {
|
||||
const ChatMsgInfo msg = chatList[idx];
|
||||
int teamIndex= msg.chatTeamIndex;
|
||||
|
||||
|
|
|
@ -433,7 +433,7 @@ std::pair<CommandResult,string> Commander::computeResult(const CommandResultCont
|
|||
case 1:
|
||||
return results.front();
|
||||
default:
|
||||
for(int i = 0; i < results.size(); ++i) {
|
||||
for(int i = 0; i < (int)results.size(); ++i) {
|
||||
if(results[i].first != crSuccess) {
|
||||
return std::pair<CommandResult,string>(crSomeFailed,results[i].second);
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ bool Commander::getReplayCommandListForFrame(int worldFrameCount) {
|
|||
replayCommandList.erase(replayCommandList.begin(),replayCommandList.begin() + replayList.size());
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("worldFrameCount = %d GIVING COMMANDS replayList.size() = " MG_SIZE_T_SPECIFIER "\n",worldFrameCount,replayList.size());
|
||||
for(int i= 0; i < replayList.size(); ++i){
|
||||
for(int i= 0; i < (int)replayList.size(); ++i){
|
||||
giveNetworkCommand(&replayList[i]);
|
||||
}
|
||||
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
|
||||
|
|
|
@ -108,12 +108,12 @@ void Console::addLine(string line, bool playSound, int playerIndex, Vec3f textCo
|
|||
storedLines.clear();
|
||||
}
|
||||
lines.insert(lines.begin(), info);
|
||||
if(lines.size() > maxLines) {
|
||||
if((int)lines.size() > maxLines) {
|
||||
lines.pop_back();
|
||||
}
|
||||
if(onlyChatMessagesInStoredLines==false || info.PlayerIndex!=-1) {
|
||||
storedLines.insert(storedLines.begin(), info);
|
||||
if(storedLines.size() > maxStoredLines) {
|
||||
if((int)storedLines.size() > maxStoredLines) {
|
||||
storedLines.pop_back();
|
||||
}
|
||||
}
|
||||
|
@ -144,11 +144,11 @@ void Console::addLine(string line, bool playSound, string playerName, Vec3f text
|
|||
//printf("info.PlayerIndex = %d, line [%s]\n",info.PlayerIndex,info.originalPlayerName.c_str());
|
||||
|
||||
lines.insert(lines.begin(), info);
|
||||
if(lines.size() > maxLines) {
|
||||
if((int)lines.size() > maxLines) {
|
||||
lines.pop_back();
|
||||
}
|
||||
storedLines.insert(storedLines.begin(), info);
|
||||
if(storedLines.size() > maxStoredLines) {
|
||||
if((int)storedLines.size() > maxStoredLines) {
|
||||
storedLines.pop_back();
|
||||
}
|
||||
}
|
||||
|
@ -181,25 +181,25 @@ bool Console::isEmpty() {
|
|||
}
|
||||
|
||||
string Console::getLine(int i) const {
|
||||
if(i < 0 || i >= lines.size())
|
||||
if(i < 0 || i >= (int)lines.size())
|
||||
throw megaglest_runtime_error("i >= Lines.size()");
|
||||
return lines[i].text;
|
||||
}
|
||||
|
||||
string Console::getStoredLine(int i) const {
|
||||
if(i < 0 || i >= storedLines.size())
|
||||
if(i < 0 || i >= (int)storedLines.size())
|
||||
throw megaglest_runtime_error("i >= storedLines.size()");
|
||||
return storedLines[i].text;
|
||||
}
|
||||
|
||||
ConsoleLineInfo Console::getLineItem(int i) const {
|
||||
if(i < 0 || i >= lines.size())
|
||||
if(i < 0 || i >= (int)lines.size())
|
||||
throw megaglest_runtime_error("i >= Lines.size()");
|
||||
return lines[i];
|
||||
}
|
||||
|
||||
ConsoleLineInfo Console::getStoredLineItem(int i) const {
|
||||
if(i < 0 || i >= storedLines.size())
|
||||
if(i < 0 || i >= (int)storedLines.size())
|
||||
throw megaglest_runtime_error("i >= storedLines.size()");
|
||||
return storedLines[i];
|
||||
}
|
||||
|
|
|
@ -618,8 +618,8 @@ string Game::extractFactionLogoFile(bool &loadingImageUsed, string factionName,
|
|||
}
|
||||
else {
|
||||
Config &config = Config::getInstance();
|
||||
vector<string> pathList=config.getPathListForType(ptTechs,scenarioDir);
|
||||
for(int idx = 0; idx < pathList.size(); idx++) {
|
||||
vector<string> pathList = config.getPathListForType(ptTechs,scenarioDir);
|
||||
for(int idx = 0; idx < (int)pathList.size(); idx++) {
|
||||
string currentPath = pathList[idx];
|
||||
endPathWithSlash(currentPath);
|
||||
//string path = currentPath + techName + "/" + "factions" + "/" + settings->getFactionTypeName(i);
|
||||
|
@ -642,7 +642,7 @@ string Game::extractFactionLogoFile(bool &loadingImageUsed, string factionName,
|
|||
int bestMinHeightDiff = INT_MAX;
|
||||
// Now find the best texture for our screen
|
||||
// Texture2D *result = preloadTexture(logoFilename);
|
||||
for(unsigned int logoIndex = 0; logoIndex < loadScreenList.size(); ++logoIndex) {
|
||||
for(unsigned int logoIndex = 0; logoIndex < (unsigned int)loadScreenList.size(); ++logoIndex) {
|
||||
string factionLogo = path + loadScreenList[logoIndex];
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] looking for loading screen '%s'\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,factionLogo.c_str());
|
||||
|
||||
|
@ -786,7 +786,7 @@ string Game::extractTechLogoFile(string scenarioDir, string techName,
|
|||
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();
|
||||
vector<string> pathList = config.getPathListForType(ptTechs, scenarioDir);
|
||||
for(int idx = 0; idx < pathList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)pathList.size(); idx++) {
|
||||
string currentPath = pathList[idx];
|
||||
endPathWithSlash(currentPath);
|
||||
string path = currentPath + techName;
|
||||
|
@ -838,7 +838,7 @@ void Game::loadHudTexture(const GameSettings *settings)
|
|||
bool hudFound = false;
|
||||
Config &config= Config::getInstance();
|
||||
vector<string> pathList= config.getPathListForType(ptTechs, scenarioDir);
|
||||
for(int idx= 0; hudFound == false && idx < pathList.size(); idx++){
|
||||
for(int idx= 0; hudFound == false && idx < (int)pathList.size(); idx++){
|
||||
string currentPath= pathList[idx];
|
||||
endPathWithSlash(currentPath);
|
||||
|
||||
|
@ -847,7 +847,7 @@ void Game::loadHudTexture(const GameSettings *settings)
|
|||
endPathWithSlash(path);
|
||||
findAll(path + GameConstants::HUD_SCREEN_FILE_FILTER, hudList, false, false);
|
||||
if(hudList.empty() == false){
|
||||
for(unsigned int hudIdx = 0; hudFound == false && hudIdx < hudList.size(); ++hudIdx) {
|
||||
for(unsigned int hudIdx = 0; hudFound == false && hudIdx < (unsigned int)hudList.size(); ++hudIdx) {
|
||||
string hudImageFileName= path + hudList[hudIdx];
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] looking for a HUD [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,hudImageFileName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled)
|
||||
|
@ -934,13 +934,13 @@ vector<Texture2D *> Game::processTech(string techName) {
|
|||
|
||||
vector<string> factions;
|
||||
vector<string> techPaths = Config::getInstance().getPathListForType(ptTechs);
|
||||
for(int idx = 0; idx < techPaths.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)techPaths.size(); idx++) {
|
||||
string &techPath = techPaths[idx];
|
||||
endPathWithSlash(techPath);
|
||||
findAll(techPath + techName + "/factions/*.", factions, false, false);
|
||||
|
||||
if(factions.empty() == false) {
|
||||
for(unsigned int factionIdx = 0; factionIdx < factions.size(); ++factionIdx) {
|
||||
for(unsigned int factionIdx = 0; factionIdx < (unsigned int)factions.size(); ++factionIdx) {
|
||||
bool loadingImageUsed = false;
|
||||
string currentFactionName_factionPreview = factions[factionIdx];
|
||||
|
||||
|
@ -1877,7 +1877,7 @@ void Game::update() {
|
|||
|
||||
if(receivedTooEarlyInFrames[index]==-1){
|
||||
// we need to check if we already received something for next frame
|
||||
if(lastNetworkFrameFromServer > 0 && lastNetworkFrameFromServer > world.getFrameCount()) {
|
||||
if(lastNetworkFrameFromServer > 0 && lastNetworkFrameFromServer > (uint64)world.getFrameCount()) {
|
||||
receivedTooEarlyInFrames[index]= lastNetworkFrameFromServer-world.getFrameCount();
|
||||
}
|
||||
}
|
||||
|
@ -3426,7 +3426,7 @@ void Game::tick() {
|
|||
|
||||
int Game::getFirstUnusedTeamNumber() {
|
||||
std::map<int,bool> uniqueTeamNumbersUsed;
|
||||
for(unsigned int i = 0; i < world.getFactionCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)world.getFactionCount(); ++i) {
|
||||
Faction *faction = world.getFaction(i);
|
||||
uniqueTeamNumbersUsed[faction->getTeam()]=true;
|
||||
}
|
||||
|
@ -3669,7 +3669,7 @@ void Game::mouseDownLeft(int x, int y) {
|
|||
switchTeamIndexMap.clear();
|
||||
std::map<int,bool> uniqueTeamNumbersUsed;
|
||||
std::vector<string> menuItems;
|
||||
for(unsigned int i = 0; i < world.getFactionCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)world.getFactionCount(); ++i) {
|
||||
Faction *faction = world.getFaction(i);
|
||||
|
||||
if(faction->getPersonalityType() != fpt_Observer &&
|
||||
|
@ -3718,7 +3718,7 @@ void Game::mouseDownLeft(int x, int y) {
|
|||
}
|
||||
disconnectPlayerIndexMap.clear();
|
||||
std::vector<string> menuItems;
|
||||
for(unsigned int i = 0; i < world.getFactionCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)world.getFactionCount(); ++i) {
|
||||
Faction *faction = world.getFaction(i);
|
||||
|
||||
//printf("faction->getPersonalityType() = %d index [%d,%d] control [%d] networkstatus [%d]\n",faction->getPersonalityType(),world.getThisFaction()->getIndex(),faction->getIndex(),faction->getControlType(),this->gameSettings.getNetworkPlayerStatuses(i));
|
||||
|
@ -4058,7 +4058,7 @@ void Game::mouseDownLeft(int x, int y) {
|
|||
Vec2i screenPos(x,y-60);
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
renderer.computePosition(screenPos, targetPos);
|
||||
Vec2i surfaceCellPos = map->toSurfCoords(targetPos);
|
||||
//Vec2i surfaceCellPos = map->toSurfCoords(targetPos);
|
||||
|
||||
|
||||
MarkedCell mc(targetPos,world.getThisFaction(),"none",world.getThisFaction()->getStartLocationIndex());
|
||||
|
@ -5285,7 +5285,7 @@ string Game::getDebugStats(std::map<int,string> &factionDebugInfo) {
|
|||
if(this->masterserverMode == false) {
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
Quad2i visibleQuad= renderer.getVisibleQuad();
|
||||
Quad2i visibleQuadCamera= renderer.getVisibleQuadFromCamera();
|
||||
//Quad2i visibleQuadCamera= renderer.getVisibleQuadFromCamera();
|
||||
|
||||
str+= "Visible quad: ";
|
||||
for(int i= 0; i<4; ++i){
|
||||
|
@ -6577,7 +6577,7 @@ void Game::loadGame(string name,Program *programPtr,bool isMasterserverMode,cons
|
|||
minimapNode->clearChild("fowPixmap1");
|
||||
|
||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||
NetworkRole role = networkManager.getNetworkRole();
|
||||
//NetworkRole role = networkManager.getNetworkRole();
|
||||
ClientInterface *clientInterface = dynamic_cast<ClientInterface *>(networkManager.getClientInterface());
|
||||
|
||||
for(int i= 0; i<newGameSettings.getFactionCount(); ++i) {
|
||||
|
|
|
@ -237,7 +237,7 @@ Quad2i GameCamera::computeVisibleQuad() {
|
|||
|
||||
result = Quad2i(p1, p2, p3, p4);
|
||||
if(MaxVisibleQuadItemCache != 0 &&
|
||||
(MaxVisibleQuadItemCache < 0 || cacheVisibleQuad[fov][hAng].size() <= MaxVisibleQuadItemCache)) {
|
||||
(MaxVisibleQuadItemCache < 0 || (int)cacheVisibleQuad[fov][hAng].size() <= MaxVisibleQuadItemCache)) {
|
||||
cacheVisibleQuad[fov][hAng][pos] = result;
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ Quad2i GameCamera::computeVisibleQuad() {
|
|||
|
||||
result = Quad2i(p3, p1, p4, p2);
|
||||
if(MaxVisibleQuadItemCache != 0 &&
|
||||
(MaxVisibleQuadItemCache < 0 || cacheVisibleQuad[fov][hAng].size() <= MaxVisibleQuadItemCache)) {
|
||||
(MaxVisibleQuadItemCache < 0 || (int)cacheVisibleQuad[fov][hAng].size() <= MaxVisibleQuadItemCache)) {
|
||||
cacheVisibleQuad[fov][hAng][pos] = result;
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ Quad2i GameCamera::computeVisibleQuad() {
|
|||
|
||||
result = Quad2i(p2, p4, p1, p3);
|
||||
if(MaxVisibleQuadItemCache != 0 &&
|
||||
(MaxVisibleQuadItemCache < 0 || cacheVisibleQuad[fov][hAng].size() <= MaxVisibleQuadItemCache)) {
|
||||
(MaxVisibleQuadItemCache < 0 || (int)cacheVisibleQuad[fov][hAng].size() <= MaxVisibleQuadItemCache)) {
|
||||
cacheVisibleQuad[fov][hAng][pos] = result;
|
||||
}
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ Quad2i GameCamera::computeVisibleQuad() {
|
|||
|
||||
result = Quad2i(p4, p3, p2, p1);
|
||||
if(MaxVisibleQuadItemCache != 0 &&
|
||||
(MaxVisibleQuadItemCache < 0 || cacheVisibleQuad[fov][hAng].size() <= MaxVisibleQuadItemCache)) {
|
||||
(MaxVisibleQuadItemCache < 0 || (int)cacheVisibleQuad[fov][hAng].size() <= MaxVisibleQuadItemCache)) {
|
||||
cacheVisibleQuad[fov][hAng][pos] = Quad2i(p4, p3, p2, p1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ enum FlagTypes1 {
|
|||
//ft1_xx = 0x40,
|
||||
};
|
||||
|
||||
static bool isFlagType1BitEnabled(uint32 flagValue,FlagTypes1 type) {
|
||||
inline static bool isFlagType1BitEnabled(uint32 flagValue,FlagTypes1 type) {
|
||||
return ((flagValue & type) == type);
|
||||
}
|
||||
|
||||
|
|
|
@ -886,18 +886,18 @@ void ScriptManager::onCellTriggerEvent(Unit *movingUnit) {
|
|||
|
||||
// ========================== lua wrappers ===============================================
|
||||
|
||||
string ScriptManager::wrapString(const string &str, int wrapCount){
|
||||
string ScriptManager::wrapString(const string &str, int wrapCount) {
|
||||
string returnString;
|
||||
|
||||
int letterCount= 0;
|
||||
for(int i= 0; i<str.size(); ++i){
|
||||
if(letterCount>wrapCount && str[i]==' '){
|
||||
returnString+= '\n';
|
||||
for(int i= 0; i < (int)str.size(); ++i){
|
||||
if(letterCount>wrapCount && str[i]==' ') {
|
||||
returnString += '\n';
|
||||
letterCount= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnString+= str[i];
|
||||
returnString += str[i];
|
||||
}
|
||||
++letterCount;
|
||||
}
|
||||
|
@ -1296,7 +1296,7 @@ void ScriptManager::unregisterCellTriggerEvent(int eventId) {
|
|||
|
||||
if(inCellTriggerEvent == false) {
|
||||
if(unRegisterCellTriggerEventList.empty() == false) {
|
||||
for(int i = 0; i < unRegisterCellTriggerEventList.size(); ++i) {
|
||||
for(int i = 0; i < (int)unRegisterCellTriggerEventList.size(); ++i) {
|
||||
int delayedEventId = unRegisterCellTriggerEventList[i];
|
||||
if(CellTriggerEventList.find(delayedEventId) != CellTriggerEventList.end()) {
|
||||
CellTriggerEventList.erase(delayedEventId);
|
||||
|
|
|
@ -157,10 +157,10 @@ string Stats::getStats() const {
|
|||
result += "Max Concurrent Units: " + intToStr(maxConcurrentUnitCount) + "\n";
|
||||
result += "Total EndGame Concurrent Unit Count: " + intToStr(totalEndGameConcurrentUnitCount) + "\n";
|
||||
|
||||
for(unsigned int i = 0; i < factionCount; ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)factionCount; ++i) {
|
||||
const PlayerStats &player = playerStats[i];
|
||||
|
||||
result += "player #" + intToStr(i) + " " + player.getStats() + "\n";
|
||||
result += "player #" + uIntToStr(i) + " " + player.getStats() + "\n";
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -395,7 +395,7 @@ void CoreData::loadTextures(string data_path) {
|
|||
+ CORE_MENU_TEXTURES_PATH + "logo*.*";
|
||||
vector<string> logoFilenames;
|
||||
findAll(logosPath, logoFilenames, false, false);
|
||||
for (int i = 0; i < logoFilenames.size(); ++i) {
|
||||
for (int i = 0; i < (int)logoFilenames.size(); ++i) {
|
||||
string logo = logoFilenames[i];
|
||||
if (strcmp("logo.tga", logo.c_str()) != 0) {
|
||||
Texture2D* logoTextureExtra = renderer.newTexture2D(rsGlobal);
|
||||
|
@ -419,7 +419,7 @@ void CoreData::loadTextures(string data_path) {
|
|||
logosPath = data_path + CORE_MENU_TEXTURES_PATH + "logo*.*";
|
||||
vector<string> logoFilenames;
|
||||
findAll(logosPath, logoFilenames, false, false);
|
||||
for (int i = 0; i < logoFilenames.size(); ++i) {
|
||||
for (int i = 0; i < (int)logoFilenames.size(); ++i) {
|
||||
string logo = logoFilenames[i];
|
||||
if (strcmp("logo.tga", logo.c_str()) != 0) {
|
||||
Texture2D* logoTextureExtra = renderer.newTexture2D(rsGlobal);
|
||||
|
@ -444,7 +444,7 @@ void CoreData::loadTextures(string data_path) {
|
|||
+ CORE_MENU_TEXTURES_PATH + "intro*.*";
|
||||
vector<string> introFilenames;
|
||||
findAll(introPath, introFilenames, false, false);
|
||||
for (int i = 0; i < introFilenames.size(); ++i) {
|
||||
for (int i = 0; i < (int)introFilenames.size(); ++i) {
|
||||
string logo = introFilenames[i];
|
||||
//if(strcmp("logo.tga",logo.c_str()) != 0) {
|
||||
Texture2D* logoTextureExtra = renderer.newTexture2D(rsGlobal);
|
||||
|
@ -468,7 +468,7 @@ void CoreData::loadTextures(string data_path) {
|
|||
introPath = data_path + CORE_MENU_TEXTURES_PATH + "intro*.*";
|
||||
vector<string> introFilenames;
|
||||
findAll(introPath, introFilenames, false, false);
|
||||
for (int i = 0; i < introFilenames.size(); ++i) {
|
||||
for (int i = 0; i < (int)introFilenames.size(); ++i) {
|
||||
string logo = introFilenames[i];
|
||||
//if(strcmp("logo.tga",logo.c_str()) != 0) {
|
||||
Texture2D* logoTextureExtra = renderer.newTexture2D(rsGlobal);
|
||||
|
@ -708,7 +708,7 @@ void CoreData::loadIntroMedia(string data_path) {
|
|||
+ CORE_MENU_VIDEOS_PATH + "intro.*";
|
||||
vector<string> introVideos;
|
||||
findAll(introVideoPath, introVideos, false, false);
|
||||
for (int i = 0; i < introVideos.size(); ++i) {
|
||||
for (int i = 0; i < (int)introVideos.size(); ++i) {
|
||||
string video = getGameCustomCoreDataPath(data_path, "")
|
||||
+ CORE_MENU_VIDEOS_PATH + introVideos[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
@ -727,7 +727,7 @@ void CoreData::loadIntroMedia(string data_path) {
|
|||
introVideoPath = data_path + CORE_MENU_VIDEOS_PATH + "intro.*";
|
||||
introVideos.clear();
|
||||
findAll(introVideoPath, introVideos, false, false);
|
||||
for (int i = 0; i < introVideos.size(); ++i) {
|
||||
for (int i = 0; i < (int)introVideos.size(); ++i) {
|
||||
string video = data_path + CORE_MENU_VIDEOS_PATH
|
||||
+ introVideos[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
@ -758,7 +758,7 @@ void CoreData::loadMainMenuMedia(string data_path) {
|
|||
+ CORE_MENU_VIDEOS_PATH + "main.*";
|
||||
vector<string> mainVideos;
|
||||
findAll(mainVideoPath, mainVideos, false, false);
|
||||
for (int i = 0; i < mainVideos.size(); ++i) {
|
||||
for (int i = 0; i < (int)mainVideos.size(); ++i) {
|
||||
string video = getGameCustomCoreDataPath(data_path, "")
|
||||
+ CORE_MENU_VIDEOS_PATH + mainVideos[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
@ -778,7 +778,7 @@ void CoreData::loadMainMenuMedia(string data_path) {
|
|||
mainVideoPath = data_path + CORE_MENU_VIDEOS_PATH + "main.*";
|
||||
mainVideos.clear();
|
||||
findAll(mainVideoPath, mainVideos, false, false);
|
||||
for (int i = 0; i < mainVideos.size(); ++i) {
|
||||
for (int i = 0; i < (int)mainVideos.size(); ++i) {
|
||||
string video = data_path + CORE_MENU_VIDEOS_PATH
|
||||
+ mainVideos[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
@ -809,7 +809,7 @@ void CoreData::loadBattleEndMedia(string data_path) {
|
|||
+ CORE_MENU_VIDEOS_PATH + "battle_end_win.*";
|
||||
vector<string> battleEndWinVideos;
|
||||
findAll(battleEndWinVideoPath, battleEndWinVideos, false, false);
|
||||
for (int i = 0; i < battleEndWinVideos.size(); ++i) {
|
||||
for (int i = 0; i < (int)battleEndWinVideos.size(); ++i) {
|
||||
string video = getGameCustomCoreDataPath(data_path, "")
|
||||
+ CORE_MENU_VIDEOS_PATH + battleEndWinVideos[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
@ -831,7 +831,7 @@ void CoreData::loadBattleEndMedia(string data_path) {
|
|||
+ "battle_end_win.*";
|
||||
battleEndWinVideos.clear();
|
||||
findAll(battleEndWinVideoPath, battleEndWinVideos, false, false);
|
||||
for (int i = 0; i < battleEndWinVideos.size(); ++i) {
|
||||
for (int i = 0; i < (int)battleEndWinVideos.size(); ++i) {
|
||||
string video = data_path + CORE_MENU_VIDEOS_PATH
|
||||
+ battleEndWinVideos[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
@ -857,7 +857,7 @@ void CoreData::loadBattleEndMedia(string data_path) {
|
|||
+ CORE_MENU_MUSIC_PATH + "battle_end_win.*";
|
||||
vector<string> battleEndWinMusic;
|
||||
findAll(battleEndWinPath, battleEndWinMusic, false, false);
|
||||
for (int i = 0; i < battleEndWinMusic.size(); ++i) {
|
||||
for (int i = 0; i < (int)battleEndWinMusic.size(); ++i) {
|
||||
string music = getGameCustomCoreDataPath(data_path, "")
|
||||
+ CORE_MENU_MUSIC_PATH + battleEndWinMusic[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
@ -879,7 +879,7 @@ void CoreData::loadBattleEndMedia(string data_path) {
|
|||
+ "battle_end_win.*";
|
||||
battleEndWinMusic.clear();
|
||||
findAll(battleEndWinPath, battleEndWinMusic, false, false);
|
||||
for (int i = 0; i < battleEndWinMusic.size(); ++i) {
|
||||
for (int i = 0; i < (int)battleEndWinMusic.size(); ++i) {
|
||||
string music = data_path + CORE_MENU_MUSIC_PATH
|
||||
+ battleEndWinMusic[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
@ -906,7 +906,7 @@ void CoreData::loadBattleEndMedia(string data_path) {
|
|||
+ CORE_MENU_VIDEOS_PATH + "battle_end_lose.*";
|
||||
vector<string> battleEndLoseVideos;
|
||||
findAll(battleEndLoseVideoPath, battleEndLoseVideos, false, false);
|
||||
for (int i = 0; i < battleEndLoseVideos.size(); ++i) {
|
||||
for (int i = 0; i < (int)battleEndLoseVideos.size(); ++i) {
|
||||
string video = getGameCustomCoreDataPath(data_path, "")
|
||||
+ CORE_MENU_VIDEOS_PATH + battleEndLoseVideos[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
@ -928,7 +928,7 @@ void CoreData::loadBattleEndMedia(string data_path) {
|
|||
+ "battle_end_lose.*";
|
||||
battleEndLoseVideos.clear();
|
||||
findAll(battleEndLoseVideoPath, battleEndLoseVideos, false, false);
|
||||
for (int i = 0; i < battleEndLoseVideos.size(); ++i) {
|
||||
for (int i = 0; i < (int)battleEndLoseVideos.size(); ++i) {
|
||||
string video = data_path + CORE_MENU_VIDEOS_PATH
|
||||
+ battleEndLoseVideos[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
@ -954,7 +954,7 @@ void CoreData::loadBattleEndMedia(string data_path) {
|
|||
+ CORE_MENU_MUSIC_PATH + "battle_end_lose.*";
|
||||
vector<string> battleEndLoseMusic;
|
||||
findAll(battleEndLosePath, battleEndLoseMusic, false, false);
|
||||
for (int i = 0; i < battleEndLoseMusic.size(); ++i) {
|
||||
for (int i = 0; i < (int)battleEndLoseMusic.size(); ++i) {
|
||||
string music = getGameCustomCoreDataPath(data_path, "")
|
||||
+ CORE_MENU_MUSIC_PATH + battleEndLoseMusic[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
@ -976,7 +976,7 @@ void CoreData::loadBattleEndMedia(string data_path) {
|
|||
+ "battle_end_lose.*";
|
||||
battleEndLoseMusic.clear();
|
||||
findAll(battleEndLosePath, battleEndLoseMusic, false, false);
|
||||
for (int i = 0; i < battleEndLoseMusic.size(); ++i) {
|
||||
for (int i = 0; i < (int)battleEndLoseMusic.size(); ++i) {
|
||||
string music = data_path + CORE_MENU_MUSIC_PATH
|
||||
+ battleEndLoseMusic[i];
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED)
|
||||
|
|
|
@ -91,7 +91,7 @@ void Lang::loadGameStrings(string uselanguage, bool loadFonts,
|
|||
// Example values:
|
||||
// DEFAULT_CHARSET (English) = 1
|
||||
// GB2312_CHARSET (Chinese) = 134
|
||||
Shared::Platform::charSet = strToInt(lang.getString("FONT_CHARSET"));
|
||||
Shared::Platform::PlatformContextGl::charSet = strToInt(lang.getString("FONT_CHARSET"));
|
||||
}
|
||||
if( lang.hasString("FONT_MULTIBYTE")) {
|
||||
Font::fontIsMultibyte = strToBool(lang.getString("FONT_MULTIBYTE"));
|
||||
|
@ -291,7 +291,7 @@ bool Lang::loadTechTreeStrings(string techTree,bool forceLoad) {
|
|||
string currentPath = "";
|
||||
Config &config = Config::getInstance();
|
||||
vector<string> techPaths = config.getPathListForType(ptTechs);
|
||||
for(int idx = 0; idx < techPaths.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)techPaths.size(); idx++) {
|
||||
string &techPath = techPaths[idx];
|
||||
endPathWithSlash(techPath);
|
||||
|
||||
|
@ -382,7 +382,7 @@ void Lang::loadTilesetStrings(string tileset) {
|
|||
string currentPath = "";
|
||||
Config &config = Config::getInstance();
|
||||
vector<string> tilesetPaths = config.getPathListForType(ptTilesets);
|
||||
for(int idx = 0; idx < tilesetPaths.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)tilesetPaths.size(); idx++) {
|
||||
string &tilesetPath = tilesetPaths[idx];
|
||||
endPathWithSlash(tilesetPath);
|
||||
|
||||
|
|
|
@ -1049,7 +1049,7 @@ void Renderer::setupLighting() {
|
|||
if(qCache.visibleQuadUnitList.empty() == false) {
|
||||
//bool modelRenderStarted = false;
|
||||
for(int visibleUnitIndex = 0;
|
||||
visibleUnitIndex < qCache.visibleQuadUnitList.size() && lightCount < maxLights;
|
||||
visibleUnitIndex < (int)qCache.visibleQuadUnitList.size() && lightCount < maxLights;
|
||||
++visibleUnitIndex) {
|
||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||
|
||||
|
@ -1405,7 +1405,7 @@ bool Renderer::PointInFrustum(vector<vector<float> > &frustum, float x, float y,
|
|||
|
||||
bool Renderer::SphereInFrustum(vector<vector<float> > &frustum, float x, float y, float z, float radius) {
|
||||
// Go through all the sides of the frustum
|
||||
for(int i = 0; i < frustum.size(); i++ ) {
|
||||
for(int i = 0; i < (int)frustum.size(); i++ ) {
|
||||
// If the center of the sphere is farther away from the plane than the radius
|
||||
if(frustum[i][0] * x + frustum[i][1] * y + frustum[i][2] * z + frustum[i][3] <= -radius ) {
|
||||
// The distance was greater than the radius so the sphere is outside of the frustum
|
||||
|
@ -3216,7 +3216,7 @@ void Renderer::renderCheckBox(const GraphicCheckBox *box) {
|
|||
int h= box->getH();
|
||||
int w= box->getW();
|
||||
|
||||
const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f);
|
||||
//const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f);
|
||||
|
||||
glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT);
|
||||
|
||||
|
@ -3316,7 +3316,7 @@ void Renderer::renderLine(const GraphicLine *line) {
|
|||
int h= line->getH();
|
||||
int w= line->getW();
|
||||
|
||||
const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f);
|
||||
//const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f);
|
||||
|
||||
glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT);
|
||||
|
||||
|
@ -3362,7 +3362,7 @@ void Renderer::renderScrollBar(const GraphicScrollBar *sb) {
|
|||
int h= sb->getH();
|
||||
int w= sb->getW();
|
||||
|
||||
const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f);
|
||||
//const Vec3f disabledTextColor= Vec3f(0.25f,0.25f,0.25f);
|
||||
|
||||
glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT);
|
||||
/////////////////////
|
||||
|
@ -3840,7 +3840,7 @@ void Renderer::MapRenderer::loadVisibleLayers(float coordStep,VisibleQuadContain
|
|||
int totalCellCount = 0;
|
||||
// we create a layer for each visible texture in the map
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
visibleIndex < (int)qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
Vec2i &pos = qCache.visibleScaledCellList[visibleIndex];
|
||||
|
||||
totalCellCount++;
|
||||
|
@ -4064,7 +4064,7 @@ void Renderer::MapRenderer::Layer::render(VisibleQuadContainerCache &qCache) {
|
|||
int lastValidIndex = -1;
|
||||
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
visibleIndex < (int)qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
Vec2i &pos = qCache.visibleScaledCellList[visibleIndex];
|
||||
|
||||
if(cellToIndicesMap.find(pos) != cellToIndicesMap.end()) {
|
||||
|
@ -4293,7 +4293,7 @@ void Renderer::renderSurface(const int renderFps) {
|
|||
|
||||
std::map<int,int> uniqueVisibleTextures;
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
visibleIndex < (int)qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
Vec2i &pos = qCache.visibleScaledCellList[visibleIndex];
|
||||
SurfaceCell *tc00= map->getSurfaceCell(pos.x, pos.y);
|
||||
int cellTex= static_cast<const Texture2DGl*>(tc00->getSurfaceTexture())->getHandle();
|
||||
|
@ -4304,7 +4304,7 @@ void Renderer::renderSurface(const int renderFps) {
|
|||
//printf("Current renders = %d possible = %d\n",qCache.visibleScaledCellList.size(),uniqueVisibleTextures.size());
|
||||
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
visibleIndex < (int)qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
Vec2i &pos = qCache.visibleScaledCellList[visibleIndex];
|
||||
|
||||
SurfaceCell *tc00= map->getSurfaceCell(pos.x, pos.y);
|
||||
|
@ -4452,7 +4452,7 @@ void Renderer::renderSurface(const int renderFps) {
|
|||
|
||||
int lastSurfaceDataIndex = -1;
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
visibleIndex < (int)qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
Vec2i &pos = qCache.visibleScaledCellList[visibleIndex];
|
||||
|
||||
SurfaceCell *tc00= map->getSurfaceCell(pos.x, pos.y);
|
||||
|
@ -4542,7 +4542,7 @@ void Renderer::renderSurface(const int renderFps) {
|
|||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
|
||||
for(int i = 0; i < surface->size(); ++i) {
|
||||
for(int i = 0; i < (int)surface->size(); ++i) {
|
||||
SurfaceData &data = (*surface)[i];
|
||||
|
||||
if(useVBOs == true) {
|
||||
|
@ -4636,7 +4636,7 @@ void Renderer::renderObjects(const int renderFps) {
|
|||
}
|
||||
|
||||
const World *world= game->getWorld();
|
||||
const Map *map= world->getMap();
|
||||
//const Map *map= world->getMap();
|
||||
|
||||
Config &config= Config::getInstance();
|
||||
int tilesetObjectsToAnimate=config.getInt("AnimatedTilesetObjects","-1");
|
||||
|
@ -4901,7 +4901,7 @@ void Renderer::renderTeamColorCircle(){
|
|||
glLineWidth(2.f);
|
||||
|
||||
for(int visibleUnitIndex = 0;
|
||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||
Vec3f currVec= unit->getCurrVectorFlat();
|
||||
Vec3f color=unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0);
|
||||
|
@ -4930,7 +4930,7 @@ void Renderer::renderSpecialHighlightUnits(std::map<int,HighlightSpecialUnitInfo
|
|||
glLineWidth(2.f);
|
||||
|
||||
for(int visibleUnitIndex = 0;
|
||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||
|
||||
std::map<int,HighlightSpecialUnitInfo>::iterator iterFindSpecialUnit = unitHighlightList.find(unit->getId());
|
||||
|
@ -4980,7 +4980,7 @@ void Renderer::renderTeamColorPlane(){
|
|||
glEnable(GL_COLOR_MATERIAL);
|
||||
const Texture2D *texture=CoreData::getInstance().getTeamColorTexture();
|
||||
for(int visibleUnitIndex = 0;
|
||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex){
|
||||
visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex){
|
||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||
Vec3f currVec= unit->getCurrVectorFlat();
|
||||
renderTeamColorEffect(currVec,visibleUnitIndex,unit->getType()->getSize(),
|
||||
|
@ -5068,7 +5068,7 @@ void Renderer::renderUnits(const int renderFps) {
|
|||
if(qCache.visibleQuadUnitList.empty() == false) {
|
||||
bool modelRenderStarted = false;
|
||||
for(int visibleUnitIndex = 0;
|
||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||
|
||||
meshCallbackTeamColor.setTeamTexture(unit->getFaction()->getTexture());
|
||||
|
@ -5187,7 +5187,7 @@ void Renderer::renderUnitsToBuild(const int renderFps) {
|
|||
modelRenderer->begin(true, true, false, false);
|
||||
|
||||
for(int visibleUnitIndex = 0;
|
||||
visibleUnitIndex < qCache.visibleQuadUnitBuildList.size(); ++visibleUnitIndex) {
|
||||
visibleUnitIndex < (int)qCache.visibleQuadUnitBuildList.size(); ++visibleUnitIndex) {
|
||||
const UnitBuildInfo &buildUnit = qCache.visibleQuadUnitBuildList[visibleUnitIndex];
|
||||
//Vec4f modelColor= Vec4f(0.f, 1.f, 0.f, 0.5f);
|
||||
const Vec3f teamColor = buildUnit.unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0);
|
||||
|
@ -5245,7 +5245,7 @@ void Renderer::renderMorphEffects(){
|
|||
bool initialized=false;
|
||||
int frameCycle=0;
|
||||
for(int visibleUnitIndex = 0;
|
||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||
if(unit->getCurrSkill() != NULL && unit->getCurrSkill()->getClass() == scMorph) {
|
||||
Command *command= unit->getCurrCommand();
|
||||
|
@ -5355,7 +5355,7 @@ void Renderer::renderSelectionEffects() {
|
|||
vector<Vec2i> pathList = dynamic_cast<const UnitPathBasic *>(path)->getQueue();
|
||||
|
||||
Vec2i lastPosValue;
|
||||
for(int i = 0; i < pathList.size(); ++i) {
|
||||
for(int i = 0; i < (int)pathList.size(); ++i) {
|
||||
Vec2i curPosValue = pathList[i];
|
||||
if(i == 0) {
|
||||
lastPosValue = curPosValue;
|
||||
|
@ -5857,9 +5857,9 @@ void Renderer::renderMinimap(){
|
|||
visibleUnitList.clear();
|
||||
|
||||
const World *world= game->getWorld();
|
||||
for(unsigned int i = 0; i < world->getFactionCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)world->getFactionCount(); ++i) {
|
||||
const Faction *faction = world->getFaction(i);
|
||||
for(unsigned int j = 0; j < faction->getUnitCount(); ++j) {
|
||||
for(unsigned int j = 0; j < (unsigned int)faction->getUnitCount(); ++j) {
|
||||
Unit *unit = faction->getUnit(j);
|
||||
visibleUnitList.push_back(unit);
|
||||
}
|
||||
|
@ -5874,7 +5874,7 @@ void Renderer::renderMinimap(){
|
|||
unit_colors.resize(visibleUnitList.size()*4);
|
||||
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < visibleUnitList.size(); ++visibleIndex) {
|
||||
visibleIndex < (int)visibleUnitList.size(); ++visibleIndex) {
|
||||
Unit *unit = visibleUnitList[visibleIndex];
|
||||
if (unit->isAlive() == false) {
|
||||
continue;
|
||||
|
@ -5981,7 +5981,7 @@ void Renderer::renderHighlightedCellsOnMinimap() {
|
|||
static_cast<float>(mw)/ pixmap->getW()/2,
|
||||
static_cast<float>(mh)/ pixmap->getH()/2);
|
||||
|
||||
for(int i = 0;i < highlightedCells->size(); i++) {
|
||||
for(int i = 0;i < (int)highlightedCells->size(); i++) {
|
||||
const MarkedCell *mc=&highlightedCells->at(i);
|
||||
if(mc->getFaction() == NULL || (mc->getFaction()->getTeam() == game->getWorld()->getThisFaction()->getTeam())) {
|
||||
const Texture2D *texture= game->getHighlightCellTexture();
|
||||
|
@ -6717,7 +6717,7 @@ void Renderer::selectUsingFrustumSelection(Selection::UnitContainer &units,
|
|||
VisibleQuadContainerCache &qCache = getQuadCache();
|
||||
if(qCache.visibleQuadUnitList.empty() == false) {
|
||||
for(int visibleUnitIndex = 0;
|
||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||
if(unit != NULL && unit->isAlive()) {
|
||||
Vec3f unitPos = unit->getCurrVector();
|
||||
|
@ -6733,7 +6733,7 @@ void Renderer::selectUsingFrustumSelection(Selection::UnitContainer &units,
|
|||
if(withObjectSelection == true) {
|
||||
if(qCache.visibleObjectList.empty() == false) {
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleObjectList.size(); ++visibleIndex) {
|
||||
visibleIndex < (int)qCache.visibleObjectList.size(); ++visibleIndex) {
|
||||
Object *object = qCache.visibleObjectList[visibleIndex];
|
||||
if(object != NULL) {
|
||||
bool insideQuad = CubeInFrustum(quadSelectionCacheItem.frustumData,
|
||||
|
@ -6913,7 +6913,7 @@ void Renderer::selectUsingColorPicking(Selection::UnitContainer &units,
|
|||
int index = pickedList[i];
|
||||
//printf("In [%s::%s] Line: %d searching for selected object i = %d index = %d units = %d objects = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,index,rendererUnits.size(),rendererObjects.size());
|
||||
|
||||
if(rendererUnits.empty() == false && index < rendererUnits.size()) {
|
||||
if(rendererUnits.empty() == false && index < (int)rendererUnits.size()) {
|
||||
Unit *unit = rendererUnits[index];
|
||||
if(unit != NULL && unit->isAlive()) {
|
||||
unitFound=true;
|
||||
|
@ -6941,7 +6941,7 @@ void Renderer::selectUsingColorPicking(Selection::UnitContainer &units,
|
|||
int index = pickedList[i];
|
||||
//printf("In [%s::%s] Line: %d searching for selected object i = %d index = %d units = %d objects = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,index,rendererUnits.size(),rendererObjects.size());
|
||||
|
||||
if(rendererObjects.empty() == false && index < rendererObjects.size()) {
|
||||
if(rendererObjects.empty() == false && index < (int)rendererObjects.size()) {
|
||||
Object *object = rendererObjects[index];
|
||||
//printf("In [%s::%s] Line: %d searching for selected object i = %d index = %d [%p]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,index,object);
|
||||
|
||||
|
@ -7182,7 +7182,7 @@ string Renderer::getGlMoreInfo(){
|
|||
|
||||
string extensions= getGlExtensions();
|
||||
int charCount= 0;
|
||||
for(int i=0; i<extensions.size(); ++i){
|
||||
for(int i = 0; i < (int)extensions.size(); ++i) {
|
||||
infoStr+= extensions[i];
|
||||
if(charCount>120 && extensions[i]==' '){
|
||||
infoStr+= "\n ";
|
||||
|
@ -7197,7 +7197,7 @@ string Renderer::getGlMoreInfo(){
|
|||
|
||||
charCount= 0;
|
||||
string platformExtensions= getGlPlatformExtensions();
|
||||
for(int i=0; i<platformExtensions.size(); ++i){
|
||||
for(int i = 0; i < (int)platformExtensions.size(); ++i) {
|
||||
infoStr+= platformExtensions[i];
|
||||
if(charCount>120 && platformExtensions[i]==' '){
|
||||
infoStr+= "\n ";
|
||||
|
@ -7402,7 +7402,7 @@ vector<Unit *> Renderer::renderUnitsFast(bool renderingShadows, bool colorPickin
|
|||
}
|
||||
|
||||
assert(game != NULL);
|
||||
const World *world= game->getWorld();
|
||||
//const World *world= game->getWorld();
|
||||
assert(world != NULL);
|
||||
|
||||
VisibleQuadContainerCache &qCache = getQuadCache();
|
||||
|
@ -7424,7 +7424,7 @@ vector<Unit *> Renderer::renderUnitsFast(bool renderingShadows, bool colorPickin
|
|||
renderOnlyBuildings=false;
|
||||
}
|
||||
for(int visibleUnitIndex = 0;
|
||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||
|
||||
if(renderOnlyBuildings==true && unit->getType()->hasSkillClass(scMove)){
|
||||
|
@ -7539,7 +7539,7 @@ vector<Object *> Renderer::renderObjectsFast(bool renderingShadows, bool resour
|
|||
|
||||
bool modelRenderStarted = false;
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleObjectList.size(); ++visibleIndex) {
|
||||
visibleIndex < (int)qCache.visibleObjectList.size(); ++visibleIndex) {
|
||||
Object *o = qCache.visibleObjectList[visibleIndex];
|
||||
|
||||
if(modelRenderStarted == false) {
|
||||
|
@ -8440,7 +8440,7 @@ void Renderer::renderUnitTitles3D(Font3D *font, Vec3f color) {
|
|||
if(visibleFrameUnitList.empty() == false) {
|
||||
//printf("Render Unit titles ON\n");
|
||||
|
||||
for(int idx = 0; idx < visibleFrameUnitList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)visibleFrameUnitList.size(); idx++) {
|
||||
const Unit *unit = visibleFrameUnitList[idx];
|
||||
if(unit != NULL) {
|
||||
if(unit->getVisible() == true) {
|
||||
|
@ -8494,7 +8494,7 @@ void Renderer::renderUnitTitles(Font2D *font, Vec3f color) {
|
|||
if(visibleFrameUnitList.empty() == false) {
|
||||
//printf("Render Unit titles ON\n");
|
||||
|
||||
for(int idx = 0; idx < visibleFrameUnitList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)visibleFrameUnitList.size(); idx++) {
|
||||
const Unit *unit = visibleFrameUnitList[idx];
|
||||
if(unit != NULL) {
|
||||
if(unit->getCurrentUnitTitle() != "") {
|
||||
|
@ -8539,7 +8539,7 @@ void Renderer::renderUnitTitles(Font2D *font, Vec3f color) {
|
|||
void Renderer::removeObjectFromQuadCache(const Object *o) {
|
||||
VisibleQuadContainerCache &qCache = getQuadCache();
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleObjectList.size(); ++visibleIndex) {
|
||||
visibleIndex < (int)qCache.visibleObjectList.size(); ++visibleIndex) {
|
||||
Object *currentObj = qCache.visibleObjectList[visibleIndex];
|
||||
if(currentObj == o) {
|
||||
qCache.visibleObjectList.erase(qCache.visibleObjectList.begin() + visibleIndex);
|
||||
|
@ -8551,7 +8551,7 @@ void Renderer::removeObjectFromQuadCache(const Object *o) {
|
|||
void Renderer::removeUnitFromQuadCache(const Unit *unit) {
|
||||
VisibleQuadContainerCache &qCache = getQuadCache();
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleQuadUnitList.size(); ++visibleIndex) {
|
||||
visibleIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleIndex) {
|
||||
Unit *currentUnit = qCache.visibleQuadUnitList[visibleIndex];
|
||||
if(currentUnit == unit) {
|
||||
qCache.visibleQuadUnitList.erase(qCache.visibleQuadUnitList.begin() + visibleIndex);
|
||||
|
@ -8559,7 +8559,7 @@ void Renderer::removeUnitFromQuadCache(const Unit *unit) {
|
|||
}
|
||||
}
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleUnitList.size(); ++visibleIndex) {
|
||||
visibleIndex < (int)qCache.visibleUnitList.size(); ++visibleIndex) {
|
||||
Unit *currentUnit = qCache.visibleUnitList[visibleIndex];
|
||||
if(currentUnit == unit) {
|
||||
qCache.visibleUnitList.erase(qCache.visibleUnitList.begin() + visibleIndex);
|
||||
|
@ -8678,7 +8678,7 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame,
|
|||
const Map *map= world->getMap();
|
||||
// clear visibility of old objects
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < quadCache.visibleObjectList.size(); ++visibleIndex){
|
||||
visibleIndex < (int)quadCache.visibleObjectList.size(); ++visibleIndex){
|
||||
quadCache.visibleObjectList[visibleIndex]->setVisible(false);
|
||||
}
|
||||
quadCache.clearNonVolatileCacheData();
|
||||
|
@ -9260,7 +9260,7 @@ uint64 Renderer::getCurrentPixelByteCount(ResourceScope rs) const {
|
|||
for(int i = (rs == rsCount ? 0 : rs); i < rsCount; ++i) {
|
||||
if(textureManager[i] != NULL) {
|
||||
const Shared::Graphics::TextureContainer &textures = textureManager[i]->getTextures();
|
||||
for(int j = 0; j < textures.size(); ++j) {
|
||||
for(int j = 0; j < (int)textures.size(); ++j) {
|
||||
const Texture *texture = textures[j];
|
||||
result += texture->getPixelByteCount();
|
||||
}
|
||||
|
|
|
@ -1236,7 +1236,7 @@ bool Gui::computeTarget(const Vec2i &screenPos, Vec2i &targetPos, const Unit *&t
|
|||
|
||||
Unit* Gui::getRelevantObjectFromSelection(Selection::UnitContainer *uc){
|
||||
Unit *resultUnit=NULL;
|
||||
for(int i= 0; i < uc->size(); ++i){
|
||||
for(int i= 0; i < (int)uc->size(); ++i) {
|
||||
resultUnit= uc->at(i);
|
||||
if(resultUnit->getType()->hasSkillClass(scMove)){// moving units are more relevant than non moving ones
|
||||
break;
|
||||
|
|
|
@ -41,14 +41,14 @@ bool Selection::select(Unit *unit) {
|
|||
bool result = false;
|
||||
//check size
|
||||
//if(selectedUnits.size() >= maxUnits){
|
||||
if(selectedUnits.size() >= Config::getInstance().getInt("MaxUnitSelectCount",intToStr(maxUnits).c_str())) {
|
||||
if((int)selectedUnits.size() >= Config::getInstance().getInt("MaxUnitSelectCount",intToStr(maxUnits).c_str())) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Fix Bug reported on sourceforge.net: Glest::Game::Selection::select crash with NULL pointer - ID: 3608835
|
||||
if(unit != NULL) {
|
||||
//check if already selected
|
||||
for(int i=0; i < selectedUnits.size(); ++i) {
|
||||
for(int i=0; i < (int)selectedUnits.size(); ++i) {
|
||||
if(selectedUnits[i ]== unit) {
|
||||
return true;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ bool Selection::select(Unit *unit) {
|
|||
|
||||
int unitTypeId=unit->getType()->getId();
|
||||
bool inserted=false;
|
||||
for(int i=0; i < selectedUnits.size(); ++i) {
|
||||
for(int i=0; i < (int)selectedUnits.size(); ++i) {
|
||||
int currentTypeId=selectedUnits[i]->getType()->getId();
|
||||
|
||||
if(unitTypeId<=currentTypeId) {
|
||||
|
@ -120,8 +120,8 @@ void Selection::unSelect(const UnitContainer &units){
|
|||
|
||||
//add units to gui
|
||||
for(UnitIterator it= units.begin(); it!=units.end(); ++it){
|
||||
for(int i=0; i<selectedUnits.size(); ++i){
|
||||
if(selectedUnits[i]==*it){
|
||||
for(int i = 0; i < (int)selectedUnits.size(); ++i) {
|
||||
if(selectedUnits[i] == *it) {
|
||||
unSelect(i);
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ bool Selection::isUniform() const{
|
|||
|
||||
const UnitType *ut= selectedUnits.front()->getType();
|
||||
|
||||
for(int i=0; i<selectedUnits.size(); ++i){
|
||||
for(int i = 0; i < (int)selectedUnits.size(); ++i) {
|
||||
if(selectedUnits[i]->getType()!=ut){
|
||||
return false;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ void Selection::recallGroup(int groupIndex){
|
|||
}
|
||||
|
||||
clear();
|
||||
for(int i=0; i<groups[groupIndex].size(); ++i) {
|
||||
for(int i = 0; i < (int)groups[groupIndex].size(); ++i) {
|
||||
select(groups[groupIndex][i]);
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ void Selection::unitEvent(UnitObserver::Event event, const Unit *unit) {
|
|||
if(event==UnitObserver::eKill){
|
||||
|
||||
//remove from selection
|
||||
for(int i=0; i<selectedUnits.size(); ++i){
|
||||
for(int i = 0; i < (int)selectedUnits.size(); ++i) {
|
||||
if(selectedUnits[i]==unit){
|
||||
selectedUnits.erase(selectedUnits.begin()+i);
|
||||
break;
|
||||
|
@ -268,7 +268,7 @@ void Selection::unitEvent(UnitObserver::Event event, const Unit *unit) {
|
|||
|
||||
//remove from groups
|
||||
for(int i=0; i<maxGroups; ++i){
|
||||
for(int j=0; j<groups[i].size(); ++j){
|
||||
for(int j = 0; j < (int)groups[i].size(); ++j) {
|
||||
if(groups[i][j]==unit){
|
||||
groups[i].erase(groups[i].begin()+j);
|
||||
break;
|
||||
|
|
|
@ -206,7 +206,7 @@ Intro::Intro(Program *program):
|
|||
string introPath = getGameCustomCoreDataPath(data_path, "") + "data/core/menu/main_model/intro*.g3d";
|
||||
vector<string> introModels;
|
||||
findAll(introPath, introModels, false, false);
|
||||
for(int i = 0; i < introModels.size(); ++i) {
|
||||
for(int i = 0; i < (int)introModels.size(); ++i) {
|
||||
string logo = introModels[i];
|
||||
Model *model= renderer.newModel(rsMenu);
|
||||
if(model) {
|
||||
|
@ -220,7 +220,7 @@ Intro::Intro(Program *program):
|
|||
introPath = data_path + "data/core/menu/main_model/intro*.g3d";
|
||||
//vector<string> introModels;
|
||||
findAll(introPath, introModels, false, false);
|
||||
for(int i = 0; i < introModels.size(); ++i) {
|
||||
for(int i = 0; i < (int)introModels.size(); ++i) {
|
||||
string logo = introModels[i];
|
||||
Model *model= renderer.newModel(rsMenu);
|
||||
if(model) {
|
||||
|
@ -429,7 +429,7 @@ Intro::Intro(Program *program):
|
|||
srand((unsigned int)seed.getCurTicks());
|
||||
int failedLookups=0;
|
||||
std::map<int,bool> usedIndex;
|
||||
for(;intoTexList.size() < showIntroPics;) {
|
||||
for(;(int)intoTexList.size() < showIntroPics;) {
|
||||
int picIndex = rand() % coreData.getMiscTextureList().size();
|
||||
if(usedIndex.find(picIndex) != usedIndex.end()) {
|
||||
failedLookups++;
|
||||
|
@ -456,8 +456,8 @@ Intro::Intro(Program *program):
|
|||
}
|
||||
else {
|
||||
for(unsigned int i = 0;
|
||||
i < coreData.getMiscTextureList().size() &&
|
||||
i < showIntroPics; ++i) {
|
||||
i < (unsigned int)coreData.getMiscTextureList().size() &&
|
||||
i < (unsigned int)showIntroPics; ++i) {
|
||||
Texture2D *tex = coreData.getMiscTextureList()[i];
|
||||
intoTexList.push_back(tex);
|
||||
}
|
||||
|
@ -628,7 +628,7 @@ void Intro::renderModelBackground() {
|
|||
if(difTime > 0) {
|
||||
if(difTime > ((modelIndex+1) * individualModelShowTime)) {
|
||||
//int oldmodelIndex = modelIndex;
|
||||
if(modelIndex+1 < models.size()) {
|
||||
if(modelIndex + 1 < (int)models.size()) {
|
||||
modelIndex++;
|
||||
|
||||
//position
|
||||
|
@ -681,7 +681,7 @@ void Intro::render() {
|
|||
|
||||
renderer.reset2d();
|
||||
|
||||
for(int i = 0; i < texts.size(); ++i) {
|
||||
for(int i = 0; i < (int)texts.size(); ++i) {
|
||||
Text *text= texts[i];
|
||||
|
||||
int difTime= 1000 * timer / GameConstants::updateFps - text->getTime();
|
||||
|
|
|
@ -239,7 +239,7 @@ static void cleanupProcessObjects() {
|
|||
|
||||
printf("Waiting for the following threads to exit [" MG_SIZE_T_SPECIFIER "]:\n",Thread::getThreadList().size());
|
||||
|
||||
for(int i = 0; i < Thread::getThreadList().size(); ++i) {
|
||||
for(int i = 0; i < (int)Thread::getThreadList().size(); ++i) {
|
||||
BaseThread *baseThread = dynamic_cast<BaseThread *>(Thread::getThreadList()[i]);
|
||||
printf("Thread index: %d ptr [%p] isBaseThread: %d, Name: [%s]\n",i,baseThread,(baseThread != NULL ? 1 : 0),(baseThread != NULL ? baseThread->getUniqueID().c_str() : "<na>"));
|
||||
}
|
||||
|
@ -1870,7 +1870,7 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName,
|
|||
string duplicateFile = fileList[idx];
|
||||
string fileExt = extractExtension(duplicateFile);
|
||||
if(fileExt == "wav" || fileExt == "ogg") {
|
||||
off_t fileSize = getFileSize(duplicateFile);
|
||||
//off_t fileSize = getFileSize(duplicateFile);
|
||||
if(idx == 0) {
|
||||
newCommonFileName = "$COMMONDATAPATH/sounds/" + extractFileFromDirectoryPath(duplicateFile);
|
||||
break;
|
||||
|
@ -1932,7 +1932,7 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
if(factionsList.empty() == false) {
|
||||
Checksum checksum;
|
||||
set<string> factions;
|
||||
for(int j = 0; j < factionsList.size(); ++j) {
|
||||
for(int j = 0; j < (int)factionsList.size(); ++j) {
|
||||
if( filteredFactionList.empty() == true ||
|
||||
std::find(filteredFactionList.begin(),filteredFactionList.end(),factionsList[j]) != filteredFactionList.end()) {
|
||||
factions.insert(factionsList[j]);
|
||||
|
@ -1941,7 +1941,7 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
|
||||
printf("\n----------------------------------------------------------------");
|
||||
printf("\nChecking techPath [%s] techName [%s] total faction count = %d\n",techPath.c_str(), techName.c_str(),(int)factionsList.size());
|
||||
for(int j = 0; j < factionsList.size(); ++j) {
|
||||
for(int j = 0; j < (int)factionsList.size(); ++j) {
|
||||
if( filteredFactionList.empty() == true ||
|
||||
std::find(filteredFactionList.begin(),filteredFactionList.end(),factionsList[j]) != filteredFactionList.end()) {
|
||||
printf("Using faction [%s]\n",factionsList[j].c_str());
|
||||
|
@ -2008,7 +2008,7 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
techtree_errors = true;
|
||||
// Display the validation errors
|
||||
string errorText = "\nErrors were detected:\n=====================\n";
|
||||
for(int i = 0; i < resultErrors.size(); ++i) {
|
||||
for(int i = 0; i < (int)resultErrors.size(); ++i) {
|
||||
if(i > 0) {
|
||||
errorText += "\n";
|
||||
}
|
||||
|
@ -2030,7 +2030,7 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
techtree_errors = true;
|
||||
// Display the validation errors
|
||||
string errorText = "\nErrors were detected:\n=====================\n";
|
||||
for(int i = 0; i < resultErrors.size(); ++i) {
|
||||
for(int i = 0; i < (int)resultErrors.size(); ++i) {
|
||||
if(i > 0) {
|
||||
errorText += "\n";
|
||||
}
|
||||
|
@ -2352,7 +2352,7 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
string duplicateFile = fileList[idx];
|
||||
string fileExt = extractExtension(duplicateFile);
|
||||
if(fileExt == "wav" || fileExt == "ogg") {
|
||||
off_t fileSize = getFileSize(duplicateFile);
|
||||
//off_t fileSize = getFileSize(duplicateFile);
|
||||
if(idx == 0) {
|
||||
newCommonFileName = "$COMMONDATAPATH/sounds/" + extractFileFromDirectoryPath(duplicateFile);
|
||||
break;
|
||||
|
@ -2440,7 +2440,7 @@ void runTechTranslationExtractionForPath(string techPath, string techName,
|
|||
if(factionsList.empty() == false) {
|
||||
Checksum checksum;
|
||||
set<string> factions;
|
||||
for(int j = 0; j < factionsList.size(); ++j) {
|
||||
for(int j = 0; j < (int)factionsList.size(); ++j) {
|
||||
if( filteredFactionList.empty() == true ||
|
||||
std::find(filteredFactionList.begin(),filteredFactionList.end(),factionsList[j]) != filteredFactionList.end()) {
|
||||
factions.insert(factionsList[j]);
|
||||
|
@ -2449,7 +2449,7 @@ void runTechTranslationExtractionForPath(string techPath, string techName,
|
|||
|
||||
printf("\n----------------------------------------------------------------");
|
||||
printf("\nChecking techPath [%s] techName [%s] total faction count = %d\n",techPath.c_str(), techName.c_str(),(int)factionsList.size());
|
||||
for(int j = 0; j < factionsList.size(); ++j) {
|
||||
for(int j = 0; j < (int)factionsList.size(); ++j) {
|
||||
if( filteredFactionList.empty() == true ||
|
||||
std::find(filteredFactionList.begin(),filteredFactionList.end(),factionsList[j]) != filteredFactionList.end()) {
|
||||
printf("Using faction [%s]\n",factionsList[j].c_str());
|
||||
|
@ -2488,21 +2488,21 @@ void runTechTranslationExtractionForPath(string techPath, string techName,
|
|||
|
||||
txFile << "; --------------" << std::endl;
|
||||
txFile << "; Types of Armor" << std::endl;
|
||||
for(unsigned int index = 0; index < techtree->getArmorTypeCount(); ++index) {
|
||||
for(int index = 0; index < techtree->getArmorTypeCount(); ++index) {
|
||||
const ArmorType *at = techtree->getArmorTypeByIndex(index);
|
||||
txFile << "ArmorTypeName_" << at->getName(false) << "=" << at->getName(false) << std::endl;
|
||||
}
|
||||
|
||||
txFile << "; -------------- " << std::endl;
|
||||
txFile << "; Types of Attack" << std::endl;
|
||||
for(unsigned int index = 0; index < techtree->getAttackTypeCount(); ++index) {
|
||||
for(int index = 0; index < techtree->getAttackTypeCount(); ++index) {
|
||||
const AttackType *at = techtree->getAttackTypeByIndex(index);
|
||||
txFile << "AttackTypeName_" << at->getName(false) << "=" << at->getName(false) << std::endl;
|
||||
}
|
||||
|
||||
txFile << "; ------------------" << std::endl;
|
||||
txFile << "; Types of Resources" << std::endl;
|
||||
for(unsigned int index = 0; index < techtree->getResourceTypeCount(); ++index) {
|
||||
for(int index = 0; index < techtree->getResourceTypeCount(); ++index) {
|
||||
const ResourceType *rt = techtree->getResourceType(index);
|
||||
txFile << "ResourceTypeName_" << rt->getName(false) << "=" << rt->getName(false) << std::endl;
|
||||
}
|
||||
|
@ -2512,33 +2512,33 @@ void runTechTranslationExtractionForPath(string techPath, string techName,
|
|||
txFile << "FactionName_" << GameConstants::OBSERVER_SLOTNAME << "=" << GameConstants::OBSERVER_SLOTNAME << std::endl;
|
||||
txFile << "FactionName_" << GameConstants::RANDOMFACTION_SLOTNAME << "=" << GameConstants::RANDOMFACTION_SLOTNAME << std::endl;
|
||||
|
||||
for(unsigned int index = 0; index < techtree->getTypeCount(); ++index) {
|
||||
for(int index = 0; index < techtree->getTypeCount(); ++index) {
|
||||
const FactionType *ft = techtree->getType(index);
|
||||
txFile << "FactionName_" << ft->getName(false) << "=" << ft->getName(false) << std::endl;
|
||||
|
||||
txFile << "; ----------------------------------" << std::endl;
|
||||
txFile << "; Types of Upgrades for this Faction" << std::endl;
|
||||
for(unsigned int upgradeIndex = 0; upgradeIndex < ft->getUpgradeTypeCount(); ++upgradeIndex) {
|
||||
for(int upgradeIndex = 0; upgradeIndex < ft->getUpgradeTypeCount(); ++upgradeIndex) {
|
||||
const UpgradeType *upt = ft->getUpgradeType(upgradeIndex);
|
||||
txFile << "UpgradeTypeName_" << upt->getName(false) << "=" << upt->getName(false) << std::endl;
|
||||
}
|
||||
|
||||
txFile << "; -------------------------------" << std::endl;
|
||||
txFile << "; Types of Units for this Faction" << std::endl;
|
||||
for(unsigned int unitIndex = 0; unitIndex < ft->getUnitTypeCount(); ++unitIndex) {
|
||||
for(int unitIndex = 0; unitIndex < ft->getUnitTypeCount(); ++unitIndex) {
|
||||
const UnitType *ut = ft->getUnitType(unitIndex);
|
||||
txFile << "UnitTypeName_" << ut->getName(false) << "=" << ut->getName(false) << std::endl;
|
||||
|
||||
txFile << "; --------------------" << std::endl;
|
||||
txFile << "; Levels for this Unit" << std::endl;
|
||||
for(unsigned int levelIndex = 0; levelIndex < ut->getLevelCount(); ++levelIndex) {
|
||||
for(int levelIndex = 0; levelIndex < ut->getLevelCount(); ++levelIndex) {
|
||||
const Level *level = ut->getLevel(levelIndex);
|
||||
txFile << "LevelName_" << level->getName(false) << "=" << level->getName(false) << std::endl;
|
||||
}
|
||||
|
||||
txFile << "; -------------------------------" << std::endl;
|
||||
txFile << "; Types of Commands for this Unit" << std::endl;
|
||||
for(unsigned int commandIndex = 0; commandIndex < ut->getCommandTypeCount(); ++commandIndex) {
|
||||
for(int commandIndex = 0; commandIndex < ut->getCommandTypeCount(); ++commandIndex) {
|
||||
const CommandType *ct = ut->getCommandType(commandIndex);
|
||||
txFile << "CommandName_" << ct->getName(false) << "=" << ct->getName(false) << std::endl;
|
||||
}
|
||||
|
@ -2592,7 +2592,7 @@ void runTechTranslationExtraction(int argc, char** argv) {
|
|||
|
||||
if(filteredTechTreeList.empty() == false) {
|
||||
printf("Filtering techtrees and only looking for the following:\n");
|
||||
for(int idx = 0; idx < filteredTechTreeList.size(); ++idx) {
|
||||
for(int idx = 0; idx < (int)filteredTechTreeList.size(); ++idx) {
|
||||
filteredTechTreeList[idx] = trim(filteredTechTreeList[idx]);
|
||||
printf("%s\n",filteredTechTreeList[idx].c_str());
|
||||
}
|
||||
|
@ -2605,11 +2605,11 @@ void runTechTranslationExtraction(int argc, char** argv) {
|
|||
World world;
|
||||
|
||||
vector<string> techPaths = config.getPathListForType(ptTechs);
|
||||
for(int idx = 0; idx < techPaths.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)techPaths.size(); idx++) {
|
||||
string &techPath = techPaths[idx];
|
||||
endPathWithSlash(techPath);
|
||||
|
||||
for(int idx2 = 0; idx2 < techTreeFiles.size(); idx2++) {
|
||||
for(int idx2 = 0; idx2 < (int)techTreeFiles.size(); idx2++) {
|
||||
string &techName = techTreeFiles[idx2];
|
||||
|
||||
if( filteredTechTreeList.empty() == true ||
|
||||
|
@ -2668,13 +2668,13 @@ void runTechValidationReport(int argc, char** argv) {
|
|||
std::vector<string> filteredFactionList;
|
||||
|
||||
vector<string> scenarioPaths = config.getPathListForType(ptScenarios);
|
||||
for(int idx = 0; idx < scenarioPaths.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)scenarioPaths.size(); idx++) {
|
||||
string &scenarioPath = scenarioPaths[idx];
|
||||
endPathWithSlash(scenarioPath);
|
||||
|
||||
vector<string> scenarioList;
|
||||
findDirs(scenarioPath, scenarioList, false, false);
|
||||
for(int idx2 = 0; idx2 < scenarioList.size(); idx2++) {
|
||||
for(int idx2 = 0; idx2 < (int)scenarioList.size(); idx2++) {
|
||||
string &scenarioName = scenarioList[idx2];
|
||||
|
||||
if(scenarioName == validateScenarioName) {
|
||||
|
@ -2701,7 +2701,7 @@ void runTechValidationReport(int argc, char** argv) {
|
|||
}
|
||||
else {
|
||||
vector<string> techPaths = config.getPathListForType(ptTechs);
|
||||
for(int idx = 0; idx < techPaths.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)techPaths.size(); idx++) {
|
||||
string &techPath = techPaths[idx];
|
||||
endPathWithSlash(techPath);
|
||||
scenarioTechtree = techPath + "/" + techName + "/" + techName + ".xml";
|
||||
|
@ -2747,7 +2747,7 @@ void runTechValidationReport(int argc, char** argv) {
|
|||
|
||||
if(filteredFactionList.empty() == false) {
|
||||
printf("Filtering factions and only looking for the following:\n");
|
||||
for(int idx = 0; idx < filteredFactionList.size(); ++idx) {
|
||||
for(int idx = 0; idx < (int)filteredFactionList.size(); ++idx) {
|
||||
filteredFactionList[idx] = trim(filteredFactionList[idx]);
|
||||
printf("%s\n",filteredFactionList[idx].c_str());
|
||||
}
|
||||
|
@ -2778,7 +2778,7 @@ void runTechValidationReport(int argc, char** argv) {
|
|||
|
||||
if(filteredTechTreeList.empty() == false) {
|
||||
printf("Filtering techtrees and only looking for the following:\n");
|
||||
for(int idx = 0; idx < filteredTechTreeList.size(); ++idx) {
|
||||
for(int idx = 0; idx < (int)filteredTechTreeList.size(); ++idx) {
|
||||
filteredTechTreeList[idx] = trim(filteredTechTreeList[idx]);
|
||||
printf("%s\n",filteredTechTreeList[idx].c_str());
|
||||
}
|
||||
|
@ -2846,11 +2846,11 @@ void runTechValidationReport(int argc, char** argv) {
|
|||
World world;
|
||||
|
||||
vector<string> techPaths = config.getPathListForType(ptTechs);
|
||||
for(int idx = 0; idx < techPaths.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)techPaths.size(); idx++) {
|
||||
string &techPath = techPaths[idx];
|
||||
endPathWithSlash(techPath);
|
||||
|
||||
for(int idx2 = 0; idx2 < techTreeFiles.size(); idx2++) {
|
||||
for(int idx2 = 0; idx2 < (int)techTreeFiles.size(); idx2++) {
|
||||
string &techName = techTreeFiles[idx2];
|
||||
|
||||
if( filteredTechTreeList.empty() == true ||
|
||||
|
@ -2905,13 +2905,13 @@ void runTilesetValidationReport(int argc, char** argv) {
|
|||
bool tilesetFound = false;
|
||||
|
||||
vector<string> tilesetPaths = config.getPathListForType(ptTilesets);
|
||||
for(int idx = 0; idx < tilesetPaths.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)tilesetPaths.size(); idx++) {
|
||||
string &tilesetPath = tilesetPaths[idx];
|
||||
endPathWithSlash(tilesetPath);
|
||||
|
||||
vector<string> tilesetList;
|
||||
findDirs(tilesetPath, tilesetList, false, false);
|
||||
for(int idx2 = 0; idx2 < tilesetList.size(); idx2++) {
|
||||
for(int idx2 = 0; idx2 < (int)tilesetList.size(); idx2++) {
|
||||
string &tilesetName = tilesetList[idx2];
|
||||
if(tilesetName == validateTilesetName) {
|
||||
tilesetFound = true;
|
||||
|
@ -2955,7 +2955,7 @@ void ShowINISettings(int argc, char **argv,Config &config,Config &configKeys) {
|
|||
|
||||
if(filteredPropertyList.empty() == false) {
|
||||
printf("Filtering properties and only looking for the following:\n");
|
||||
for(int idx = 0; idx < filteredPropertyList.size(); ++idx) {
|
||||
for(int idx = 0; idx < (int)filteredPropertyList.size(); ++idx) {
|
||||
filteredPropertyList[idx] = trim(filteredPropertyList[idx]);
|
||||
printf("%s\n",filteredPropertyList[idx].c_str());
|
||||
}
|
||||
|
@ -2970,7 +2970,7 @@ void ShowINISettings(int argc, char **argv,Config &config,Config &configKeys) {
|
|||
|
||||
// Figure out the max # of tabs we need to format display nicely
|
||||
int tabCount = 1;
|
||||
for(int i = 0; i < mergedMainSettings.size(); ++i) {
|
||||
for(int i = 0; i < (int)mergedMainSettings.size(); ++i) {
|
||||
const pair<string,string> &nameValue = mergedMainSettings[i];
|
||||
|
||||
bool displayProperty = false;
|
||||
|
@ -2993,7 +2993,7 @@ void ShowINISettings(int argc, char **argv,Config &config,Config &configKeys) {
|
|||
}
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < mergedKeySettings.size(); ++i) {
|
||||
for(int i = 0; i < (int)mergedKeySettings.size(); ++i) {
|
||||
const pair<string,string> &nameValue = mergedKeySettings[i];
|
||||
|
||||
bool displayProperty = false;
|
||||
|
@ -3018,7 +3018,7 @@ void ShowINISettings(int argc, char **argv,Config &config,Config &configKeys) {
|
|||
}
|
||||
|
||||
// Output the properties
|
||||
for(int i = 0; i < mergedMainSettings.size(); ++i) {
|
||||
for(int i = 0; i < (int)mergedMainSettings.size(); ++i) {
|
||||
const pair<string,string> &nameValue = mergedMainSettings[i];
|
||||
|
||||
bool displayProperty = false;
|
||||
|
@ -3051,7 +3051,7 @@ void ShowINISettings(int argc, char **argv,Config &config,Config &configKeys) {
|
|||
printf("\n\nMain key binding settings report\n");
|
||||
printf("====================================\n");
|
||||
|
||||
for(int i = 0; i < mergedKeySettings.size(); ++i) {
|
||||
for(int i = 0; i < (int)mergedKeySettings.size(); ++i) {
|
||||
const pair<string,string> &nameValue = mergedKeySettings[i];
|
||||
|
||||
bool displayProperty = false;
|
||||
|
@ -3099,7 +3099,7 @@ void CheckForDuplicateData() {
|
|||
}
|
||||
else if(invalidMapList.empty() == false) {
|
||||
string errorMsg = "Warning invalid maps were detected (will be ignored):\n";
|
||||
for(int i = 0; i < invalidMapList.size(); ++i) {
|
||||
for(int i = 0; i < (int)invalidMapList.size(); ++i) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"map [%s]\n",invalidMapList[i].c_str());
|
||||
|
||||
|
@ -3109,9 +3109,9 @@ void CheckForDuplicateData() {
|
|||
}
|
||||
|
||||
vector<string> duplicateMapsToRename;
|
||||
for(int i = 0; i < maps.size(); ++i) {
|
||||
for(int i = 0; i < (int)maps.size(); ++i) {
|
||||
string map1 = maps[i];
|
||||
for(int j = 0; j < maps.size(); ++j) {
|
||||
for(int j = 0; j < (int)maps.size(); ++j) {
|
||||
if(i != j) {
|
||||
string map2 = maps[j];
|
||||
|
||||
|
@ -3125,7 +3125,7 @@ void CheckForDuplicateData() {
|
|||
}
|
||||
if(duplicateMapsToRename.empty() == false) {
|
||||
string errorMsg = "Warning duplicate maps were detected and renamed:\n";
|
||||
for(int i = 0; i < duplicateMapsToRename.size(); ++i) {
|
||||
for(int i = 0; i < (int)duplicateMapsToRename.size(); ++i) {
|
||||
string currentPath = pathList[1];
|
||||
endPathWithSlash(currentPath);
|
||||
|
||||
|
@ -3162,9 +3162,9 @@ void CheckForDuplicateData() {
|
|||
}
|
||||
|
||||
vector<string> duplicateTilesetsToRename;
|
||||
for(int i = 0; i < tileSets.size(); ++i) {
|
||||
for(int i = 0; i < (int)tileSets.size(); ++i) {
|
||||
string tileSet1 = tileSets[i];
|
||||
for(int j = 0; j < tileSets.size(); ++j) {
|
||||
for(int j = 0; j < (int)tileSets.size(); ++j) {
|
||||
if(i != j) {
|
||||
string tileSet2= tileSets[j];
|
||||
if(tileSet1 == tileSet2) {
|
||||
|
@ -3178,7 +3178,7 @@ void CheckForDuplicateData() {
|
|||
if(duplicateTilesetsToRename.empty() == false) {
|
||||
string errorMsg = "Warning duplicate tilesets were detected and renamed:\n";
|
||||
|
||||
for(int i = 0; i < duplicateTilesetsToRename.size(); ++i) {
|
||||
for(int i = 0; i < (int)duplicateTilesetsToRename.size(); ++i) {
|
||||
string currentPath = tilesetPaths[1];
|
||||
endPathWithSlash(currentPath);
|
||||
|
||||
|
@ -3217,9 +3217,9 @@ void CheckForDuplicateData() {
|
|||
}
|
||||
|
||||
vector<string> duplicateTechtreesToRename;
|
||||
for(int i = 0; i < techTrees.size(); ++i) {
|
||||
for(int i = 0; i < (int)techTrees.size(); ++i) {
|
||||
string techtree1 = techTrees[i];
|
||||
for(int j = 0; j < techTrees.size(); ++j) {
|
||||
for(int j = 0; j < (int)techTrees.size(); ++j) {
|
||||
if(i != j) {
|
||||
string techtree2 = techTrees[j];
|
||||
if(techtree1 == techtree2) {
|
||||
|
@ -3233,7 +3233,7 @@ void CheckForDuplicateData() {
|
|||
if(duplicateTechtreesToRename.empty() == false) {
|
||||
string errorMsg = "Warning duplicate techtrees were detected and renamed:\n";
|
||||
|
||||
for(int i = 0; i < duplicateTechtreesToRename.size(); ++i) {
|
||||
for(int i = 0; i < (int)duplicateTechtreesToRename.size(); ++i) {
|
||||
string currentPath = techPaths[1];
|
||||
endPathWithSlash(currentPath);
|
||||
|
||||
|
@ -4587,7 +4587,7 @@ int glestMain(int argc, char** argv) {
|
|||
// Example values:
|
||||
// DEFAULT_CHARSET (English) = 1
|
||||
// GB2312_CHARSET (Chinese) = 134
|
||||
Shared::Platform::charSet = config.getInt("FONT_CHARSET",intToStr(Shared::Platform::charSet).c_str());
|
||||
Shared::Platform::PlatformContextGl::charSet = config.getInt("FONT_CHARSET",intToStr(Shared::Platform::PlatformContextGl::charSet).c_str());
|
||||
if(config.getBool("No2DMouseRendering","false") == false) {
|
||||
showCursor(false);
|
||||
}
|
||||
|
@ -4605,7 +4605,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__,Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::charSet,Shared::Graphics::Font::fontIsMultibyte, Shared::Graphics::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::PlatformContextGl::charSet,Shared::Graphics::Font::fontIsMultibyte, Shared::Graphics::Font::fontIsRightToLeft);
|
||||
|
||||
NetworkInterface::setDisplayMessageFunction(ExceptionHandler::DisplayMessage);
|
||||
MenuStateMasterserver::setDisplayMessageFunction(ExceptionHandler::DisplayMessage);
|
||||
|
@ -4774,8 +4774,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__,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);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::PlatformContextGl::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",__FILE__,__FUNCTION__,__LINE__,Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::PlatformContextGl::charSet,Shared::Graphics::Font::fontIsMultibyte,Shared::Graphics::Font::fontIsRightToLeft);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Using Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::PlatformContextGl::charSet = %d, Font::fontIsMultibyte = %d, Font::fontIsRightToLeft = %d\n",Shared::Graphics::Font::charCount,Shared::Graphics::Font::fontTypeName.c_str(),Shared::Platform::PlatformContextGl::charSet,Shared::Graphics::Font::fontIsMultibyte,Shared::Graphics::Font::fontIsRightToLeft);
|
||||
|
||||
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_USE_FONT]) == true) {
|
||||
int foundParamIndIndex = -1;
|
||||
|
|
|
@ -416,7 +416,7 @@ bool MenuState::keyPressEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInpu
|
|||
//if((c>='0' && c<='9') || (c>='a' && c<='z') || (c>='A' && c<='Z') ||
|
||||
// (c=='-') || (c=='(') || (c==')')) {
|
||||
if(isAllowedInputTextKey(key)) {
|
||||
if(activeInputLabel->getText().size() < maxTextSize) {
|
||||
if((int)activeInputLabel->getText().size() < maxTextSize) {
|
||||
string text= activeInputLabel->getText();
|
||||
|
||||
wchar_t keyW = extractKeyPressedUnicode(c);
|
||||
|
@ -540,7 +540,7 @@ bool MenuState::keyDownEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInput
|
|||
//}
|
||||
|
||||
//for(unsigned int i = 0; i < textCharLength[textCharLength.size()-2]; ++i) {
|
||||
for(unsigned int i = 0; i < activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-2]; ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-2]; ++i) {
|
||||
//printf("erase A1 i = %d [%s]\n",i,text.c_str());
|
||||
text.erase(text.end() -2);
|
||||
//printf("erase A2 i = %d [%s]\n",i,text.c_str());
|
||||
|
@ -556,7 +556,7 @@ bool MenuState::keyDownEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInput
|
|||
}
|
||||
else {
|
||||
//for(unsigned int i = 0; i < textCharLength[textCharLength.size()-1]; ++i) {
|
||||
for(unsigned int i = 0; i < activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-1]; ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)activeInputLabel->getTextCharLengthList()[activeInputLabel->getTextCharLengthList().size()-1]; ++i) {
|
||||
//printf("erase B1 i = %d [%s]\n",i,text.c_str());
|
||||
text.erase(text.end() -1);
|
||||
//printf("erase B2 i = %d [%s]\n",i,text.c_str());
|
||||
|
|
|
@ -252,14 +252,14 @@ void MenuStateAbout::render() {
|
|||
|
||||
for(int i= 0; i < teammateCount; ++i) {
|
||||
int characterPos = (i % teammateTopLineCount);
|
||||
if(characterPos < characterMenuScreenPositionListCache.size()) {
|
||||
if(characterPos < (int)characterMenuScreenPositionListCache.size()) {
|
||||
adjustModelText = false;
|
||||
|
||||
int xPos = characterMenuScreenPositionListCache[characterPos].x;
|
||||
if(i == 7 && characterPos+1 < characterMenuScreenPositionListCache.size()) {
|
||||
if(i == 7 && characterPos+1 < (int)characterMenuScreenPositionListCache.size()) {
|
||||
xPos += ((characterMenuScreenPositionListCache[characterPos+1].x - characterMenuScreenPositionListCache[characterPos].x) / 2);
|
||||
}
|
||||
else if(i == 8 && characterPos+1 < characterMenuScreenPositionListCache.size()) {
|
||||
else if(i == 8 && characterPos+1 < (int)characterMenuScreenPositionListCache.size()) {
|
||||
xPos = characterMenuScreenPositionListCache[characterPos+1].x;
|
||||
}
|
||||
|
||||
|
|
|
@ -461,7 +461,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||
vector<string> resultsScenarios;
|
||||
findDirs(dirList, resultsScenarios);
|
||||
// Filter out only scenarios with no network slots
|
||||
for(int i= 0; i < resultsScenarios.size(); ++i) {
|
||||
for(int i= 0; i < (int)resultsScenarios.size(); ++i) {
|
||||
string scenario = resultsScenarios[i];
|
||||
string file = Scenario::getScenarioPath(dirList, scenario);
|
||||
|
||||
|
@ -492,7 +492,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||
}
|
||||
}
|
||||
resultsScenarios.clear();
|
||||
for(int i = 0; i < scenarioFiles.size(); ++i) {
|
||||
for(int i = 0; i < (int)scenarioFiles.size(); ++i) {
|
||||
resultsScenarios.push_back(formatString(scenarioFiles[i]));
|
||||
}
|
||||
listBoxScenario.setItems(resultsScenarios);
|
||||
|
@ -1879,11 +1879,11 @@ void MenuStateConnectedGame::reloadFactions(bool keepExistingSelectedItem, strin
|
|||
|
||||
string scenarioDir = Scenario::getScenarioDir(dirList, scenario);
|
||||
vector<string> techPaths = config.getPathListForType(ptTechs,scenarioDir);
|
||||
for(int idx = 0; idx < techPaths.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)techPaths.size(); idx++) {
|
||||
string &techPath = techPaths[idx];
|
||||
endPathWithSlash(techPath);
|
||||
|
||||
if(listBoxTechTree.getSelectedItemIndex() >= 0 && listBoxTechTree.getSelectedItemIndex() < techTreeFiles.size()) {
|
||||
if(listBoxTechTree.getSelectedItemIndex() >= 0 && listBoxTechTree.getSelectedItemIndex() < (int)techTreeFiles.size()) {
|
||||
findDirs(techPath + techTreeFiles[listBoxTechTree.getSelectedItemIndex()] + "/factions/", results, false, false);
|
||||
}
|
||||
if(results.empty() == false) {
|
||||
|
@ -1899,7 +1899,7 @@ void MenuStateConnectedGame::reloadFactions(bool keepExistingSelectedItem, strin
|
|||
|
||||
vector<string> translatedFactionNames;
|
||||
factionFiles= results;
|
||||
for(int i = 0; i < results.size(); ++i) {
|
||||
for(int i = 0; i < (int)results.size(); ++i) {
|
||||
results[i]= formatString(results[i]);
|
||||
string translatedString=techTree->getTranslatedFactionName(techTreeFiles[listBoxTechTree.getSelectedItemIndex()],factionFiles[i]);
|
||||
if(toLower(translatedString)==toLower(results[i])){
|
||||
|
@ -1941,7 +1941,7 @@ void MenuStateConnectedGame::reloadFactions(bool keepExistingSelectedItem, strin
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(originalIndex < results.size()) {
|
||||
else if(originalIndex < (int)results.size()) {
|
||||
listBoxFactions[i].setSelectedItemIndex(originalIndex);
|
||||
}
|
||||
}
|
||||
|
@ -1975,7 +1975,7 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) {
|
|||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d] listBoxMap.getSelectedItemIndex() = %d, mapFiles.size() = " MG_SIZE_T_SPECIFIER ", getCurrentMapFile() [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,listBoxMap.getSelectedItemIndex(),mapFiles.size(),getCurrentMapFile().c_str());
|
||||
|
||||
if(listBoxMap.getSelectedItemIndex() >= 0 && listBoxMap.getSelectedItemIndex() < mapFiles.size()) {
|
||||
if(listBoxMap.getSelectedItemIndex() >= 0 && listBoxMap.getSelectedItemIndex() < (int)mapFiles.size()) {
|
||||
gameSettings->setDescription(formatString(getCurrentMapFile()));
|
||||
gameSettings->setMap(getCurrentMapFile());
|
||||
}
|
||||
|
@ -1997,7 +1997,7 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) {
|
|||
}
|
||||
}
|
||||
|
||||
if(listBoxTileset.getSelectedItemIndex() >= 0 && listBoxTileset.getSelectedItemIndex() < tilesetFiles.size()) {
|
||||
if(listBoxTileset.getSelectedItemIndex() >= 0 && listBoxTileset.getSelectedItemIndex() < (int)tilesetFiles.size()) {
|
||||
gameSettings->setTileset(tilesetFiles[listBoxTileset.getSelectedItemIndex()]);
|
||||
}
|
||||
else {
|
||||
|
@ -2019,7 +2019,7 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) {
|
|||
clientInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
}
|
||||
}
|
||||
if(listBoxTechTree.getSelectedItemIndex() >= 0 && listBoxTechTree.getSelectedItemIndex() < techTreeFiles.size()) {
|
||||
if(listBoxTechTree.getSelectedItemIndex() >= 0 && listBoxTechTree.getSelectedItemIndex() < (int)techTreeFiles.size()) {
|
||||
gameSettings->setTech(techTreeFiles[listBoxTechTree.getSelectedItemIndex()]);
|
||||
}
|
||||
else {
|
||||
|
@ -2787,7 +2787,7 @@ void MenuStateConnectedGame::update() {
|
|||
listBoxTechTree.getSelectedItemIndex() >= 0 &&
|
||||
listBoxTechTree.getSelectedItem() != Lang::getInstance().getString("DataMissing","",true)) {
|
||||
|
||||
time_t now = time(NULL);
|
||||
//time_t now = time(NULL);
|
||||
time_t lastUpdateDate = getFolderTreeContentsCheckSumRecursivelyLastGenerated(config.getPathListForType(ptTechs,""), string("/") + gameSettings->getTech() + string("/*"), ".xml");
|
||||
|
||||
const time_t REFRESH_CRC_DAY_SECONDS = 60 * 60 * 1;
|
||||
|
@ -2812,7 +2812,7 @@ void MenuStateConnectedGame::update() {
|
|||
factionName != Lang::getInstance().getString("DataMissing","",true)) {
|
||||
|
||||
uint32 factionCRC = 0;
|
||||
time_t now = time(NULL);
|
||||
//time_t now = time(NULL);
|
||||
time_t lastUpdateDate = getFolderTreeContentsCheckSumRecursivelyLastGenerated(config.getPathListForType(ptTechs,""), "/" + gameSettings->getTech() + "/factions/" + factionName + "/*", ".xml");
|
||||
|
||||
const time_t REFRESH_CRC_DAY_SECONDS = 60 * 60 * 24;
|
||||
|
@ -3100,7 +3100,7 @@ void MenuStateConnectedGame::update() {
|
|||
clientInterface->sendTextMessage("techtree CRC mismatch",-1,true,"");
|
||||
vector<string> reportLineTokens;
|
||||
Tokenize(report,reportLineTokens,"\n");
|
||||
for(int reportLine = 0; reportLine < reportLineTokens.size(); ++reportLine) {
|
||||
for(int reportLine = 0; reportLine < (int)reportLineTokens.size(); ++reportLine) {
|
||||
clientInterface->sendTextMessage(reportLineTokens[reportLine],-1,true,"");
|
||||
}
|
||||
}
|
||||
|
@ -3378,7 +3378,7 @@ bool MenuStateConnectedGame::loadFactions(const GameSettings *gameSettings, bool
|
|||
Config &config = Config::getInstance();
|
||||
|
||||
vector<string> techPaths = config.getPathListForType(ptTechs,scenarioDir);
|
||||
for(int idx = 0; idx < techPaths.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)techPaths.size(); idx++) {
|
||||
string &techPath = techPaths[idx];
|
||||
endPathWithSlash(techPath);
|
||||
//findAll(techPath + gameSettings->getTech() + "/factions/*.", results, false, false);
|
||||
|
@ -3402,7 +3402,7 @@ bool MenuStateConnectedGame::loadFactions(const GameSettings *gameSettings, bool
|
|||
results.push_back(Lang::getInstance().getString("DataMissing","",true));
|
||||
factionFiles = results;
|
||||
vector<string> translatedFactionNames;
|
||||
for(int i= 0; i < factionFiles.size(); ++i) {
|
||||
for(int i= 0; i < (int)factionFiles.size(); ++i) {
|
||||
results[i]= formatString(results[i]);
|
||||
string translatedString=techTree->getTranslatedFactionName(gameSettings->getTech(),factionFiles[i]);
|
||||
if(toLower(translatedString)==toLower(results[i])){
|
||||
|
@ -3445,7 +3445,7 @@ bool MenuStateConnectedGame::loadFactions(const GameSettings *gameSettings, bool
|
|||
|
||||
factionFiles= results;
|
||||
vector<string> translatedFactionNames;
|
||||
for(int i= 0; i < factionFiles.size(); ++i) {
|
||||
for(int i= 0; i < (int)factionFiles.size(); ++i) {
|
||||
results[i]= formatString(results[i]);
|
||||
string translatedString=techTree->getTranslatedFactionName(gameSettings->getTech(),factionFiles[i]);
|
||||
if(toLower(translatedString)==toLower(results[i])){
|
||||
|
@ -4098,7 +4098,7 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName,
|
|||
|
||||
vector<string> translatedTechs;
|
||||
std::vector<string> techsFormatted = techTreeFiles;
|
||||
for(int i= 0; i < techsFormatted.size(); i++){
|
||||
for(int i= 0; i < (int)techsFormatted.size(); i++){
|
||||
techsFormatted.at(i)= formatString(techsFormatted.at(i));
|
||||
|
||||
string txTech = techTree->getTranslatedName(techTreeFiles.at(i), true);
|
||||
|
@ -4111,7 +4111,7 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName,
|
|||
|
||||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)languageList.size(); ++i) {
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTechtreeFailDownload",languageList[i]) == true) {
|
||||
snprintf(szMsg,8096,lang.getString("DataMissingTechtreeFailDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),(itemName+"(.7z)").c_str(),curlVersion->version);
|
||||
|
@ -4157,7 +4157,7 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName,
|
|||
|
||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||
ClientInterface* clientInterface= networkManager.getClientInterface();
|
||||
const GameSettings *gameSettings = clientInterface->getGameSettings();
|
||||
//const GameSettings *gameSettings = clientInterface->getGameSettings();
|
||||
|
||||
if(result.first == ftp_crt_SUCCESS) {
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
@ -4806,7 +4806,7 @@ int MenuStateConnectedGame::setupMapList(string scenario) {
|
|||
std::for_each(formattedPlayerSortedMaps[0].begin(), formattedPlayerSortedMaps[0].end(), FormatString());
|
||||
|
||||
formattedMapFiles.clear();
|
||||
for(int i= 0; i < mapFiles.size(); i++){// fetch info and put map in right list
|
||||
for(int i= 0; i < (int)mapFiles.size(); i++){// fetch info and put map in right list
|
||||
loadMapInfo(Map::getMapPath(mapFiles.at(i), scenarioDir, false), &mapInfo, false);
|
||||
|
||||
if(GameConstants::maxPlayers+1 <= mapInfo.players) {
|
||||
|
|
|
@ -205,7 +205,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
|
|||
std::vector<std::string> ipList = Socket::getLocalIPAddressList();
|
||||
if(ipList.empty() == false) {
|
||||
ipText = "";
|
||||
for(int idx = 0; idx < ipList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)ipList.size(); idx++) {
|
||||
string ip = ipList[idx];
|
||||
if(ipText != "") {
|
||||
ipText += ", ";
|
||||
|
@ -376,7 +376,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
|
|||
vector<string> resultsScenarios;
|
||||
findDirs(dirList, resultsScenarios);
|
||||
// Filter out only scenarios with no network slots
|
||||
for(int i= 0; i < resultsScenarios.size(); ++i) {
|
||||
for(int i= 0; i < (int)resultsScenarios.size(); ++i) {
|
||||
string scenario = resultsScenarios[i];
|
||||
string file = Scenario::getScenarioPath(dirList, scenario);
|
||||
|
||||
|
@ -408,7 +408,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
|
|||
}
|
||||
}
|
||||
resultsScenarios.clear();
|
||||
for(int i = 0; i < scenarioFiles.size(); ++i) {
|
||||
for(int i = 0; i < (int)scenarioFiles.size(); ++i) {
|
||||
resultsScenarios.push_back(formatString(scenarioFiles[i]));
|
||||
}
|
||||
listBoxScenario.setItems(resultsScenarios);
|
||||
|
@ -716,7 +716,7 @@ void MenuStateCustomGame::reloadUI() {
|
|||
std::vector<std::string> ipList = Socket::getLocalIPAddressList();
|
||||
if(ipList.empty() == false) {
|
||||
ipText = "";
|
||||
for(int idx = 0; idx < ipList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)ipList.size(); idx++) {
|
||||
string ip = ipList[idx];
|
||||
if(ipText != "") {
|
||||
ipText += ", ";
|
||||
|
@ -2578,7 +2578,7 @@ void MenuStateCustomGame::update() {
|
|||
serverInterface->sendTextMessage("techtree CRC mismatch",-1,true,"");
|
||||
vector<string> reportLineTokens;
|
||||
Tokenize(report,reportLineTokens,"\n");
|
||||
for(int reportLine = 0; reportLine < reportLineTokens.size(); ++reportLine) {
|
||||
for(int reportLine = 0; reportLine < (int)reportLineTokens.size(); ++reportLine) {
|
||||
serverInterface->sendTextMessage(reportLineTokens[reportLine],-1,true,"");
|
||||
}
|
||||
}
|
||||
|
@ -3102,7 +3102,7 @@ void MenuStateCustomGame::simpleTaskForMasterServer(BaseThread *callingThread) {
|
|||
request += SystemFlags::escapeURL(iterMap->second,handle);
|
||||
|
||||
paramIndex++;
|
||||
if(paramIndex < newPublishToServerInfo.size()) {
|
||||
if(paramIndex < (int)newPublishToServerInfo.size()) {
|
||||
request += "&";
|
||||
}
|
||||
}
|
||||
|
@ -3703,7 +3703,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force
|
|||
if(masterserver_admin_found == false ) {
|
||||
for(int i=mapInfo.players; i < GameConstants::maxPlayers; ++i) {
|
||||
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
|
||||
ConnectionSlot *slot = serverInterface->getSlot(i);
|
||||
//ConnectionSlot *slot = serverInterface->getSlot(i);
|
||||
|
||||
if( serverInterface->getSlot(i) != NULL && serverInterface->getSlot(i)->isConnected()) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
@ -4734,7 +4734,7 @@ int MenuStateCustomGame::setupMapList(string scenario) {
|
|||
std::for_each(formattedPlayerSortedMaps[0].begin(), formattedPlayerSortedMaps[0].end(), FormatString());
|
||||
//printf("#5\n");
|
||||
|
||||
for(int i= 0; i < mapFiles.size(); i++){// fetch info and put map in right list
|
||||
for(int i= 0; i < (int)mapFiles.size(); i++){// fetch info and put map in right list
|
||||
loadMapInfo(Map::getMapPath(mapFiles.at(i), scenarioDir, false), &mapInfo, false);
|
||||
|
||||
if(GameConstants::maxPlayers+1 <= mapInfo.players) {
|
||||
|
@ -4836,7 +4836,7 @@ void MenuStateCustomGame::reloadFactions(bool keepExistingSelectedItem, string s
|
|||
//printf("#1 techPaths.size() = %d scenarioDir [%s] [%s]\n",techPaths.size(),scenario.c_str(),scenarioDir.c_str());
|
||||
|
||||
if(listBoxTechTree.getItemCount() > 0) {
|
||||
for(int idx = 0; idx < techPaths.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)techPaths.size(); idx++) {
|
||||
string &techPath = techPaths[idx];
|
||||
endPathWithSlash(techPath);
|
||||
string factionPath = techPath + techTreeFiles[listBoxTechTree.getSelectedItemIndex()] + "/factions/";
|
||||
|
@ -4870,7 +4870,7 @@ void MenuStateCustomGame::reloadFactions(bool keepExistingSelectedItem, string s
|
|||
|
||||
vector<string> translatedFactionNames;
|
||||
factionFiles= results;
|
||||
for(int i = 0; i < results.size(); ++i) {
|
||||
for(int i = 0; i < (int)results.size(); ++i) {
|
||||
results[i]= formatString(results[i]);
|
||||
|
||||
string translatedString = "";
|
||||
|
@ -4917,7 +4917,7 @@ void MenuStateCustomGame::reloadFactions(bool keepExistingSelectedItem, string s
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(originalIndex < results.size()) {
|
||||
else if(originalIndex < (int)results.size()) {
|
||||
listBoxFactions[i].setSelectedItemIndex(originalIndex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ void MenuStateJoinGame::DiscoveredServers(std::vector<string> serverList) {
|
|||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
for(int idx = 0; idx < serverList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)serverList.size(); idx++) {
|
||||
|
||||
vector<string> paramPartPortsTokens;
|
||||
Tokenize(serverList[idx],paramPartPortsTokens,":");
|
||||
|
@ -687,7 +687,7 @@ void MenuStateJoinGame::keyPress(SDL_KeyboardEvent c) {
|
|||
//if(c>='0' && c<='9') {
|
||||
if( (key >= SDLK_0 && key <= SDLK_9) ||
|
||||
(key >= SDLK_KP0 && key <= SDLK_KP9)) {
|
||||
if(labelServerIp.getText().size() < maxTextSize) {
|
||||
if((int)labelServerIp.getText().size() < maxTextSize) {
|
||||
string text= labelServerIp.getText();
|
||||
//text.insert(text.end()-1, key);
|
||||
char szCharText[20]="";
|
||||
|
@ -707,7 +707,7 @@ void MenuStateJoinGame::keyPress(SDL_KeyboardEvent c) {
|
|||
}
|
||||
//else if (c=='.') {
|
||||
else if (key == SDLK_PERIOD) {
|
||||
if(labelServerIp.getText().size() < maxTextSize) {
|
||||
if((int)labelServerIp.getText().size() < maxTextSize) {
|
||||
string text= labelServerIp.getText();
|
||||
if(text.size() > 0) {
|
||||
text.insert(text.end() -1, '.');
|
||||
|
|
|
@ -150,7 +150,7 @@ MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu,
|
|||
|
||||
//throw megaglest_runtime_error("Test!");
|
||||
|
||||
for(int i = 0; i < mergedProperties.size(); ++i) {
|
||||
for(int i = 0; i < (int)mergedProperties.size(); ++i) {
|
||||
|
||||
string keyName = mergedProperties[i].second;
|
||||
if(keyName.length() > 0) {
|
||||
|
@ -544,7 +544,7 @@ void MenuStateKeysetup::keyUp(SDL_KeyboardEvent key) {
|
|||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] keyName [%s] char [%d][%d]\n",__FILE__,__FUNCTION__,__LINE__,keyName.c_str(),hotkeyChar,key.keysym.sym);
|
||||
|
||||
SDLKey keysym = SDLK_UNKNOWN;
|
||||
//SDLKey keysym = SDLK_UNKNOWN;
|
||||
if(keyName == "unknown key" || keyName == "") {
|
||||
// Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
||||
// keysym = configKeys.translateSpecialStringToSDLKey(hotkeyChar);
|
||||
|
@ -569,7 +569,7 @@ void MenuStateKeysetup::keyUp(SDL_KeyboardEvent key) {
|
|||
|
||||
pair<string,string> &nameValuePair = mergedProperties[hotkeyIndex];
|
||||
bool isNewUserKeyEntry = true;
|
||||
for(int i = 0; i < userProperties.size(); ++i) {
|
||||
for(int i = 0; i < (int)userProperties.size(); ++i) {
|
||||
string hotKeyName = userProperties[i].first;
|
||||
if(nameValuePair.first == hotKeyName) {
|
||||
// if(keysym <= SDLK_ESCAPE || keysym > 255) {
|
||||
|
|
|
@ -218,7 +218,7 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
snprintf(szBuf,8096,lang.getString("LoadGameDeletingFile","",true).c_str(),filename.c_str());
|
||||
console.addLineOnly(szBuf);
|
||||
|
||||
for(int i = 0; i < slots.size(); i++) {
|
||||
for(int i = 0; i < (int)slots.size(); i++) {
|
||||
if(slots[i] == selectedButton) {
|
||||
if(removeFile(filename) == true) {
|
||||
removeFile(jpgfilename);
|
||||
|
@ -401,7 +401,7 @@ void MenuStateLoadGame::render() {
|
|||
renderer.renderButton(&deleteButton);
|
||||
renderer.renderButton(&loadButton);
|
||||
|
||||
for(int i=0; i<sizeof(lines) / sizeof(lines[0]); ++i){
|
||||
for(int i = 0; i < (int)sizeof(lines) / (int)sizeof(lines[0]); ++i){
|
||||
renderer.renderLine(&lines[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -756,7 +756,7 @@ void MenuStateMasterserver::render(){
|
|||
}
|
||||
safeMutexIRCPtr.ReleaseLock();
|
||||
|
||||
const Vec4f titleLabelColorList = YELLOW;
|
||||
//const Vec4f titleLabelColorList = YELLOW;
|
||||
|
||||
if(serverScrollBar.getElementCount()!=0 ) {
|
||||
for(int i = serverScrollBar.getVisibleStart(); i <= serverScrollBar.getVisibleEnd(); ++i) {
|
||||
|
@ -765,7 +765,7 @@ void MenuStateMasterserver::render(){
|
|||
}
|
||||
renderer.renderScrollBar(&serverScrollBar);
|
||||
|
||||
for(int i=0; i<sizeof(lines) / sizeof(lines[0]); ++i){
|
||||
for(int i = 0; i < (int)sizeof(lines) / (int)sizeof(lines[0]); ++i){
|
||||
renderer.renderLine(&lines[i]);
|
||||
}
|
||||
renderer.renderButton(&buttonRefresh);
|
||||
|
@ -845,7 +845,7 @@ void MenuStateMasterserver::update() {
|
|||
|
||||
if(isNew) {
|
||||
clearUserButtons();
|
||||
for(int i = 0; i < nickList.size(); ++i) {
|
||||
for(int i = 0; i < (int)nickList.size(); ++i) {
|
||||
GraphicButton *button=new GraphicButton();
|
||||
button->init(userButtonsXBase,userButtonsYBase,userButtonsWidth,userButtonsHeight);
|
||||
//button->init(userButtonsXBase,userButtonsYBase-userButtonsLineHeight*i,userButtonsWidth,userButtonsHeight);
|
||||
|
@ -1035,7 +1035,7 @@ void MenuStateMasterserver::rebuildServerLines(const string &serverInfo) {
|
|||
|
||||
std::vector<std::string> serverList;
|
||||
Tokenize(serverInfo,serverList,"\n");
|
||||
for(int i=0; i < serverList.size(); i++) {
|
||||
for(int i = 0; i < (int)serverList.size(); i++) {
|
||||
string &server = serverList[i];
|
||||
if(trim(server) == "") {
|
||||
continue;
|
||||
|
@ -1112,8 +1112,8 @@ void MenuStateMasterserver::rebuildServerLines(const string &serverInfo) {
|
|||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line %d] error during Internet game status update: [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
}
|
||||
|
||||
if(serverLines.size()>numberOfOldServerLines) {
|
||||
playServerFoundSound=true;
|
||||
if((int)serverLines.size() > numberOfOldServerLines) {
|
||||
playServerFoundSound = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -885,7 +885,7 @@ string MenuStateMods::refreshTechModInfo(string techInfo) {
|
|||
|
||||
void MenuStateMods::refreshTechs() {
|
||||
getTechsLocalList();
|
||||
for(int i=0; i < techListRemote.size(); i++) {
|
||||
for(int i=0; i < (int)techListRemote.size(); i++) {
|
||||
refreshTechModInfo(techListRemote[i]);
|
||||
}
|
||||
}
|
||||
|
@ -947,7 +947,7 @@ string MenuStateMods::refreshTilesetModInfo(string tilesetInfo) {
|
|||
|
||||
void MenuStateMods::refreshTilesets() {
|
||||
getTilesetsLocalList();
|
||||
for(int i=0; i < tilesetListRemote.size(); i++) {
|
||||
for(int i=0; i < (int)tilesetListRemote.size(); i++) {
|
||||
refreshTilesetModInfo(tilesetListRemote[i]);
|
||||
}
|
||||
}
|
||||
|
@ -1058,7 +1058,7 @@ string MenuStateMods::getMapCRC(string mapName) {
|
|||
|
||||
void MenuStateMods::refreshMaps() {
|
||||
getMapsLocalList();
|
||||
for(int i=0; i < mapListRemote.size(); i++) {
|
||||
for(int i=0; i < (int)mapListRemote.size(); i++) {
|
||||
refreshMapModInfo(mapListRemote[i]);
|
||||
}
|
||||
}
|
||||
|
@ -1115,7 +1115,7 @@ string MenuStateMods::refreshScenarioModInfo(string scenarioInfo) {
|
|||
|
||||
void MenuStateMods::refreshScenarios() {
|
||||
getScenariosLocalList();
|
||||
for(int i=0; i < scenarioListRemote.size(); i++) {
|
||||
for(int i=0; i < (int)scenarioListRemote.size(); i++) {
|
||||
refreshScenarioModInfo(scenarioListRemote[i]);
|
||||
}
|
||||
}
|
||||
|
@ -2302,7 +2302,7 @@ void MenuStateMods::render() {
|
|||
if(keyScenarioScrollBar.getElementCount() != 0) {
|
||||
for(int i = keyScenarioScrollBar.getVisibleStart();
|
||||
i <= keyScenarioScrollBar.getVisibleEnd(); ++i) {
|
||||
if(i >= keyScenarioButtons.size()) {
|
||||
if(i >= (int)keyScenarioButtons.size()) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"i >= keyScenarioButtons.size(), i = %d keyScenarioButtons.size() = %d",i,(int)keyScenarioButtons.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -2443,7 +2443,7 @@ void MenuStateMods::update() {
|
|||
if (keyTechScrollBar.getElementCount() != 0) {
|
||||
for (int i = keyTechScrollBar.getVisibleStart();
|
||||
i <= keyTechScrollBar.getVisibleEnd(); ++i) {
|
||||
if(i >= keyTechButtons.size()) {
|
||||
if(i >= (int)keyTechButtons.size()) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"i >= keyTechButtons.size(), i = %d, keyTechButtons.size() = %d",i,(int)keyTechButtons.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -2460,7 +2460,7 @@ void MenuStateMods::update() {
|
|||
if (keyTilesetScrollBar.getElementCount() != 0) {
|
||||
for (int i = keyTilesetScrollBar.getVisibleStart();
|
||||
i <= keyTilesetScrollBar.getVisibleEnd(); ++i) {
|
||||
if(i >= keyTilesetButtons.size()) {
|
||||
if(i >= (int)keyTilesetButtons.size()) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"i >= keyTilesetButtons.size(), i = %d, keyTilesetButtons.size() = %d",i,(int)keyTilesetButtons.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -2476,7 +2476,7 @@ void MenuStateMods::update() {
|
|||
if (keyMapScrollBar.getElementCount() != 0) {
|
||||
for (int i = keyMapScrollBar.getVisibleStart();
|
||||
i <= keyMapScrollBar.getVisibleEnd(); ++i) {
|
||||
if(i >= keyMapButtons.size()) {
|
||||
if(i >= (int)keyMapButtons.size()) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"i >= keyMapButtons.size(), i = %d, keyMapButtons.size() = %d",i,(int)keyMapButtons.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -2493,7 +2493,7 @@ void MenuStateMods::update() {
|
|||
if (keyScenarioScrollBar.getElementCount() != 0) {
|
||||
for (int i = keyScenarioScrollBar.getVisibleStart();
|
||||
i <= keyScenarioScrollBar.getVisibleEnd(); ++i) {
|
||||
if(i >= keyScenarioButtons.size()) {
|
||||
if(i >= (int)keyScenarioButtons.size()) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"i >= keyScenarioButtons.size(), i = %d, keyScenarioButtons.size() = %d",i,(int)keyScenarioButtons.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -2680,7 +2680,7 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName,
|
|||
|
||||
// Refresh CRC
|
||||
Config &config = Config::getInstance();
|
||||
uint32 CRCTechtreeValue = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), string("/") + itemName + string("/*"), ".xml", NULL, true);
|
||||
getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), string("/") + itemName + string("/*"), ".xml", NULL, true);
|
||||
safeMutexFTPProgress.ReleaseLock();
|
||||
|
||||
refreshTechs();
|
||||
|
@ -2726,7 +2726,7 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName,
|
|||
|
||||
// Refresh CRC
|
||||
Config &config = Config::getInstance();
|
||||
uint32 CRCScenarioValue = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptScenarios,""), string("/") + itemName + string("/*"), ".xml", NULL, true);
|
||||
getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptScenarios,""), string("/") + itemName + string("/*"), ".xml", NULL, true);
|
||||
safeMutexFTPProgress.ReleaseLock();
|
||||
|
||||
refreshScenarios();
|
||||
|
|
|
@ -131,7 +131,7 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
|
|||
|
||||
string currentPort=config.getString("PortServer", intToStr(GameConstants::serverPort).c_str());
|
||||
int portSelectionIndex=0;
|
||||
for(int idx = 0; idx < portList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)portList.size(); idx++) {
|
||||
if(portList[idx] != "" && IsNumeric(portList[idx].c_str(),false)) {
|
||||
listBoxServerPort.pushBackItem(portList[idx]);
|
||||
if(currentPort==portList[idx])
|
||||
|
|
|
@ -242,14 +242,14 @@ void MenuStateRoot::render() {
|
|||
coreData.getLogoTexture(), GraphicComponent::getFade());
|
||||
|
||||
int maxLogoWidth=0;
|
||||
for(int idx = 0; idx < coreData.getLogoTextureExtraCount(); ++idx) {
|
||||
for(int idx = 0; idx < (int)coreData.getLogoTextureExtraCount(); ++idx) {
|
||||
Texture2D *extraLogo = coreData.getLogoTextureExtra(idx);
|
||||
maxLogoWidth += extraLogo->getPixmap()->getW();
|
||||
}
|
||||
|
||||
int currentX = (metrics.getVirtualW()-maxLogoWidth)/2;
|
||||
int currentY = 50;
|
||||
for(int idx = 0; idx < coreData.getLogoTextureExtraCount(); ++idx) {
|
||||
for(int idx = 0; idx < (int)coreData.getLogoTextureExtraCount(); ++idx) {
|
||||
Texture2D *extraLogo = coreData.getLogoTextureExtra(idx);
|
||||
|
||||
logoMainX = currentX;
|
||||
|
|
|
@ -122,7 +122,7 @@ MenuStateScenario::MenuStateScenario(Program *program, MainMenu *mainMenu,
|
|||
}
|
||||
|
||||
std::map<string,string> scenarioErrors;
|
||||
for(int i= 0; i<results.size(); ++i){
|
||||
for(int i= 0; i < (int)results.size(); ++i){
|
||||
results[i] = formatString(results[i]);
|
||||
}
|
||||
listBoxScenario.setItems(results);
|
||||
|
@ -130,7 +130,7 @@ MenuStateScenario::MenuStateScenario(Program *program, MainMenu *mainMenu,
|
|||
try {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] listBoxScenario.getSelectedItemIndex() = %d scenarioFiles.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,listBoxScenario.getSelectedItemIndex(),(int)scenarioFiles.size());
|
||||
|
||||
if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < scenarioFiles.size()) {
|
||||
if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < (int)scenarioFiles.size()) {
|
||||
string scenarioPath = Scenario::getScenarioPath(dirList, scenarioFiles[listBoxScenario.getSelectedItemIndex()]);
|
||||
//printf("scenarioPath [%s]\n",scenarioPath.c_str());
|
||||
|
||||
|
@ -244,7 +244,7 @@ void MenuStateScenario::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
try {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] listBoxScenario.getSelectedItemIndex() = %d scenarioFiles.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,listBoxScenario.getSelectedItemIndex(),(int)scenarioFiles.size());
|
||||
|
||||
if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < scenarioFiles.size()) {
|
||||
if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < (int)scenarioFiles.size()) {
|
||||
loadScenarioInfo(Scenario::getScenarioPath(dirList, scenarioFiles[listBoxScenario.getSelectedItemIndex()]), &scenarioInfo);
|
||||
labelInfo.setText(scenarioInfo.desc);
|
||||
if(scenarioInfo.namei18n != "") {
|
||||
|
@ -333,7 +333,7 @@ void MenuStateScenario::update() {
|
|||
else {
|
||||
try {
|
||||
this->autoloadScenarioName = "";
|
||||
if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < scenarioFiles.size()) {
|
||||
if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < (int)scenarioFiles.size()) {
|
||||
loadScenarioInfo(Scenario::getScenarioPath(dirList, scenarioFiles[listBoxScenario.getSelectedItemIndex()]), &scenarioInfo);
|
||||
labelInfo.setText(scenarioInfo.desc);
|
||||
if(scenarioInfo.namei18n != "") {
|
||||
|
@ -402,7 +402,7 @@ void MenuStateScenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo
|
|||
void MenuStateScenario::loadScenarioPreviewTexture(){
|
||||
if(enableScenarioTexturePreview == true) {
|
||||
//if(listBoxScenario.getSelectedItemIndex() >= 0) {
|
||||
if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < scenarioFiles.size()) {
|
||||
if(listBoxScenario.getItemCount() > 0 && listBoxScenario.getSelectedItemIndex() >= 0 && listBoxScenario.getSelectedItemIndex() < (int)scenarioFiles.size()) {
|
||||
GameSettings gameSettings;
|
||||
loadGameSettings(&scenarioInfo, &gameSettings);
|
||||
|
||||
|
@ -431,7 +431,7 @@ void MenuStateScenario::loadGameSettings(const ScenarioInfo *scenarioInfo, GameS
|
|||
snprintf(szBuf,8096,"listBoxScenario.getSelectedItemIndex() < 0, = %d",listBoxScenario.getSelectedItemIndex());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else if(listBoxScenario.getSelectedItemIndex() >= scenarioFiles.size()) {
|
||||
else if(listBoxScenario.getSelectedItemIndex() >= (int)scenarioFiles.size()) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"listBoxScenario.getSelectedItemIndex() >= scenarioFiles.size(), = [%d][%d]",listBoxScenario.getSelectedItemIndex(),(int)scenarioFiles.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
|
|
@ -959,7 +959,7 @@ void ClientInterface::updateLobby() {
|
|||
{
|
||||
|
||||
//make sure we read the message
|
||||
time_t receiveTimeElapsed = time(NULL);
|
||||
//time_t receiveTimeElapsed = time(NULL);
|
||||
NetworkMessageCommandList networkMessageCommandList;
|
||||
bool gotCmd = receiveMessage(&networkMessageCommandList);
|
||||
if(gotCmd == false) {
|
||||
|
@ -971,7 +971,7 @@ void ClientInterface::updateLobby() {
|
|||
|
||||
case nmtQuit:
|
||||
{
|
||||
time_t receiveTimeElapsed = time(NULL);
|
||||
//time_t receiveTimeElapsed = time(NULL);
|
||||
NetworkMessageQuit networkMessageQuit;
|
||||
bool gotCmd = receiveMessage(&networkMessageQuit);
|
||||
if(gotCmd == false) {
|
||||
|
@ -1064,7 +1064,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
|||
{
|
||||
|
||||
//make sure we read the message
|
||||
time_t receiveTimeElapsed = time(NULL);
|
||||
//time_t receiveTimeElapsed = time(NULL);
|
||||
NetworkMessageCommandList networkMessageCommandList;
|
||||
bool gotCmd = receiveMessage(&networkMessageCommandList);
|
||||
if(gotCmd == false) {
|
||||
|
@ -1157,7 +1157,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
|||
|
||||
case nmtQuit:
|
||||
{
|
||||
time_t receiveTimeElapsed = time(NULL);
|
||||
//time_t receiveTimeElapsed = time(NULL);
|
||||
NetworkMessageQuit networkMessageQuit;
|
||||
// while(receiveMessage(&networkMessageQuit) == false &&
|
||||
// isConnected() == true &&
|
||||
|
@ -1410,7 +1410,7 @@ bool ClientInterface::getNetworkCommand(int frameCount, int currentCachedPending
|
|||
if(cachedPendingCommands.find(frameCount) != cachedPendingCommands.end()) {
|
||||
Commands &frameCmdList = cachedPendingCommands[frameCount];
|
||||
if(frameCmdList.size() > 0) {
|
||||
for(int i= 0; i < frameCmdList.size(); ++i) {
|
||||
for(int i= 0; i < (int)frameCmdList.size(); ++i) {
|
||||
pendingCommands.push_back(frameCmdList[i]);
|
||||
}
|
||||
//cachedPendingCommands.erase(frameCount);
|
||||
|
@ -1460,7 +1460,7 @@ bool ClientInterface::getNetworkCommand(int frameCount, int currentCachedPending
|
|||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Client waiting for packet for frame: %d, copyCachedLastPendingFrameCount = %lld\n",frameCount,(long long int)copyCachedLastPendingFrameCount);
|
||||
chrono.start();
|
||||
}
|
||||
if(copyCachedLastPendingFrameCount > frameCount) {
|
||||
if(copyCachedLastPendingFrameCount > (uint64)frameCount) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1495,7 +1495,7 @@ void ClientInterface::updateKeyframe(int frameCount) {
|
|||
if(testThreaded == false) {
|
||||
updateFrame(&frameCount);
|
||||
Commands &frameCmdList = cachedPendingCommands[frameCount];
|
||||
for(int i= 0; i < frameCmdList.size(); ++i) {
|
||||
for(int i= 0; i < (int)frameCmdList.size(); ++i) {
|
||||
pendingCommands.push_back(frameCmdList[i]);
|
||||
}
|
||||
cachedPendingCommands.erase(frameCount);
|
||||
|
@ -1619,7 +1619,7 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
|||
else if(networkMessageType == nmtCommandList) {
|
||||
//int waitCount = 0;
|
||||
//make sure we read the message
|
||||
time_t receiveTimeElapsed = time(NULL);
|
||||
//time_t receiveTimeElapsed = time(NULL);
|
||||
NetworkMessageCommandList networkMessageCommandList;
|
||||
bool gotCmd = receiveMessage(&networkMessageCommandList);
|
||||
if(gotCmd == false) {
|
||||
|
|
|
@ -94,7 +94,7 @@ void ConnectionSlotThread::setTaskCompleted(int eventId) {
|
|||
if(eventId > 0) {
|
||||
MutexSafeWrapper safeMutex(triggerIdMutex,CODE_AT_LINE);
|
||||
//event->eventCompleted = true;
|
||||
for(int i = 0; i < eventList.size(); ++i) {
|
||||
for(int i = 0; i < (int)eventList.size(); ++i) {
|
||||
ConnectionSlotEvent &slotEvent = eventList[i];
|
||||
if(slotEvent.eventId == eventId) {
|
||||
//eventList.erase(eventList.begin() + i);
|
||||
|
@ -114,7 +114,7 @@ void ConnectionSlotThread::purgeAllEvents() {
|
|||
|
||||
void ConnectionSlotThread::setAllEventsCompleted() {
|
||||
MutexSafeWrapper safeMutex(triggerIdMutex,CODE_AT_LINE);
|
||||
for(int i = 0; i < eventList.size(); ++i) {
|
||||
for(int i = 0; i < (int)eventList.size(); ++i) {
|
||||
ConnectionSlotEvent &slotEvent = eventList[i];
|
||||
if(slotEvent.eventCompleted == false) {
|
||||
slotEvent.eventCompleted = true;
|
||||
|
@ -150,7 +150,7 @@ bool ConnectionSlotThread::isSignalCompleted(ConnectionSlotEvent *event) {
|
|||
MutexSafeWrapper safeMutex(triggerIdMutex,CODE_AT_LINE);
|
||||
bool result = false;
|
||||
if(event != NULL) {
|
||||
for(int i = 0; i < eventList.size(); ++i) {
|
||||
for(int i = 0; i < (int)eventList.size(); ++i) {
|
||||
ConnectionSlotEvent &slotEvent = eventList[i];
|
||||
if(slotEvent.eventId == event->eventId) {
|
||||
result = slotEvent.eventCompleted;
|
||||
|
@ -350,7 +350,7 @@ void ConnectionSlotThread::execute() {
|
|||
ConnectionSlotEvent eventCopy;
|
||||
eventCopy.eventId = -1;
|
||||
|
||||
for(int i = 0; i < eventList.size(); ++i) {
|
||||
for(int i = 0; i < (int)eventList.size(); ++i) {
|
||||
ConnectionSlotEvent &slotEvent = eventList[i];
|
||||
if(slotEvent.eventCompleted == false) {
|
||||
eventCopy = slotEvent;
|
||||
|
|
|
@ -127,7 +127,7 @@ NetworkMessageType NetworkInterface::getNextMessageType(int waitMilliseconds)
|
|||
(waitMilliseconds > 0 && socket->hasDataToReadWithWait(waitMilliseconds) == true))) {
|
||||
//peek message type
|
||||
int dataSize = socket->getDataToRead();
|
||||
if(dataSize >= sizeof(messageType)) {
|
||||
if(dataSize >= (int)sizeof(messageType)) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] socket->getDataToRead() dataSize = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,dataSize);
|
||||
|
||||
int iPeek = socket->peek(&messageType, sizeof(messageType));
|
||||
|
@ -317,7 +317,7 @@ void NetworkInterface::setHighlightedCell(const MarkedCell &msg){
|
|||
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
||||
MutexSafeWrapper safeMutex(networkAccessMutex,mutexOwnerId);
|
||||
|
||||
for(int idx = 0; idx < highlightedCellList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)highlightedCellList.size(); idx++) {
|
||||
MarkedCell mc = highlightedCellList[idx];
|
||||
if(mc.getFactionIndex()==msg.getFactionIndex()){
|
||||
highlightedCellList.erase(highlightedCellList.begin()+ idx);
|
||||
|
|
|
@ -90,7 +90,7 @@ void NetworkMessage::dump_packet(string label, const void* data, int dataSize) {
|
|||
printf("%s",label.c_str());
|
||||
|
||||
const char *buf = static_cast<const char *>(data);
|
||||
for(unsigned int i = 0; i < dataSize; ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)dataSize; ++i) {
|
||||
printf("%u[%X][%d] ",i,buf[i],buf[i]);
|
||||
if(i % 10 == 0) {
|
||||
printf("\n");
|
||||
|
@ -1277,6 +1277,7 @@ unsigned int NetworkMessageCommandList::getPackedSizeHeader() {
|
|||
static unsigned int result = 0;
|
||||
if(result == 0) {
|
||||
Data packedData;
|
||||
init(packedData);
|
||||
unsigned char *buf = new unsigned char[sizeof(packedData)*3];
|
||||
result = pack(buf, getPackedMessageFormatHeader(),
|
||||
packedData.header.messageType,
|
||||
|
@ -1333,7 +1334,7 @@ const char * NetworkMessageCommandList::getPackedMessageFormatDetail() const {
|
|||
unsigned int NetworkMessageCommandList::getPackedSizeDetail(int count) {
|
||||
unsigned int result = 0;
|
||||
if(result == 0) {
|
||||
for(unsigned int i = 0; i < count; ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)count; ++i) {
|
||||
NetworkCommand packedData;
|
||||
unsigned char *buf = new unsigned char[sizeof(NetworkCommand)*3];
|
||||
result += pack(buf, getPackedMessageFormatDetail(),
|
||||
|
@ -1361,7 +1362,7 @@ void NetworkMessageCommandList::unpackMessageDetail(unsigned char *buf,int count
|
|||
data.commands.resize(count);
|
||||
//unsigned int bytes_processed_total = 0;
|
||||
unsigned char *bufMove = buf;
|
||||
for(unsigned int i = 0; i < count; ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)count; ++i) {
|
||||
unsigned int bytes_processed = unpack(bufMove, getPackedMessageFormatDetail(),
|
||||
&data.commands[i].networkCommandType,
|
||||
&data.commands[i].unitId,
|
||||
|
@ -1831,7 +1832,7 @@ NetworkMessageSynchNetworkGameData::NetworkMessageSynchNetworkGameData(const Gam
|
|||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] vctFileList.size() = %d, maxFileCRCCount = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__, vctFileList.size(),maxFileCRCCount);
|
||||
|
||||
for(int idx =0; idx < data.header.techCRCFileCount; ++idx) {
|
||||
for(int idx =0; idx < (int)data.header.techCRCFileCount; ++idx) {
|
||||
const std::pair<string,uint32> &fileInfo = vctFileList[idx];
|
||||
data.detail.techCRCFileList[idx] = fileInfo.first;
|
||||
data.detail.techCRCFileCRCList[idx] = fileInfo.second;
|
||||
|
@ -1855,11 +1856,11 @@ string NetworkMessageSynchNetworkGameData::getTechCRCFileMismatchReport(vector<s
|
|||
result = result + "Remote player has no files.\n";
|
||||
}
|
||||
else {
|
||||
for(int idx = 0; idx < vctFileList.size(); ++idx) {
|
||||
for(int idx = 0; idx < (int)vctFileList.size(); ++idx) {
|
||||
std::pair<string,uint32> &fileInfo = vctFileList[idx];
|
||||
bool fileFound = false;
|
||||
uint32 remoteCRC = 0;
|
||||
for(int j = 0; j < data.header.techCRCFileCount; ++j) {
|
||||
for(int j = 0; j < (int)data.header.techCRCFileCount; ++j) {
|
||||
string networkFile = data.detail.techCRCFileList[j].getString();
|
||||
uint32 &networkFileCRC = data.detail.techCRCFileCRCList[j];
|
||||
if(fileInfo.first == networkFile) {
|
||||
|
@ -1877,12 +1878,12 @@ string NetworkMessageSynchNetworkGameData::getTechCRCFileMismatchReport(vector<s
|
|||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < data.header.techCRCFileCount; ++i) {
|
||||
for(int i = 0; i < (int)data.header.techCRCFileCount; ++i) {
|
||||
string networkFile = data.detail.techCRCFileList[i].getString();
|
||||
uint32 &networkFileCRC = data.detail.techCRCFileCRCList[i];
|
||||
bool fileFound = false;
|
||||
uint32 localCRC = 0;
|
||||
for(int idx = 0; idx < vctFileList.size(); ++idx) {
|
||||
for(int idx = 0; idx < (int)vctFileList.size(); ++idx) {
|
||||
std::pair<string,uint32> &fileInfo = vctFileList[idx];
|
||||
if(networkFile == fileInfo.first) {
|
||||
fileFound = true;
|
||||
|
@ -2042,7 +2043,7 @@ bool NetworkMessageSynchNetworkGameData::receive(Socket* socket) {
|
|||
// Wait a max of x seconds for this message
|
||||
result = NetworkMessage::receive(socket, &data.detail.techCRCFileList[packetIndex], packetDetail1DataSize, true);
|
||||
if(result == true) {
|
||||
for(int i = 0; i < data.header.techCRCFileCount; ++i) {
|
||||
for(unsigned int i = 0; i < data.header.techCRCFileCount; ++i) {
|
||||
data.detail.techCRCFileList[i].nullTerminate();
|
||||
}
|
||||
|
||||
|
@ -2138,7 +2139,7 @@ NetworkMessageSynchNetworkGameDataStatus::NetworkMessageSynchNetworkGameDataStat
|
|||
data.header.mapCRC = mapCRC;
|
||||
|
||||
data.header.techCRCFileCount = min((int)vctFileList.size(),(int)maxFileCRCCount);
|
||||
for(int idx =0; idx < data.header.techCRCFileCount; ++idx) {
|
||||
for(unsigned int idx =0; idx < data.header.techCRCFileCount; ++idx) {
|
||||
const std::pair<string,uint32> &fileInfo = vctFileList[idx];
|
||||
data.detail.techCRCFileList[idx] = fileInfo.first;
|
||||
data.detail.techCRCFileCRCList[idx] = fileInfo.second;
|
||||
|
@ -2154,11 +2155,11 @@ string NetworkMessageSynchNetworkGameDataStatus::getTechCRCFileMismatchReport(st
|
|||
result = result + "Remote player has no files.\n";
|
||||
}
|
||||
else {
|
||||
for(int idx = 0; idx < vctFileList.size(); ++idx) {
|
||||
for(int idx = 0; idx < (int)vctFileList.size(); ++idx) {
|
||||
std::pair<string,uint32> &fileInfo = vctFileList[idx];
|
||||
bool fileFound = false;
|
||||
uint32 remoteCRC = 0;
|
||||
for(int j = 0; j < data.header.techCRCFileCount; ++j) {
|
||||
for(int j = 0; j < (int)data.header.techCRCFileCount; ++j) {
|
||||
string networkFile = data.detail.techCRCFileList[j].getString();
|
||||
uint32 &networkFileCRC = data.detail.techCRCFileCRCList[j];
|
||||
if(fileInfo.first == networkFile) {
|
||||
|
@ -2176,12 +2177,12 @@ string NetworkMessageSynchNetworkGameDataStatus::getTechCRCFileMismatchReport(st
|
|||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < data.header.techCRCFileCount; ++i) {
|
||||
for(int i = 0; i < (int)data.header.techCRCFileCount; ++i) {
|
||||
string networkFile = data.detail.techCRCFileList[i].getString();
|
||||
uint32 &networkFileCRC = data.detail.techCRCFileCRCList[i];
|
||||
bool fileFound = false;
|
||||
uint32 localCRC = 0;
|
||||
for(int idx = 0; idx < vctFileList.size(); ++idx) {
|
||||
for(int idx = 0; idx < (int)vctFileList.size(); ++idx) {
|
||||
std::pair<string,uint32> &fileInfo = vctFileList[idx];
|
||||
|
||||
if(networkFile == fileInfo.first) {
|
||||
|
@ -2231,7 +2232,7 @@ bool NetworkMessageSynchNetworkGameDataStatus::receive(Socket* socket) {
|
|||
|
||||
result = NetworkMessage::receive(socket, &data.detail.techCRCFileList[packetIndex], (DetailSize1 * packetFileCount),true);
|
||||
if(result == true) {
|
||||
for(int i = 0; i < data.header.techCRCFileCount; ++i) {
|
||||
for(int i = 0; i < (int)data.header.techCRCFileCount; ++i) {
|
||||
data.detail.techCRCFileList[i].nullTerminate();
|
||||
}
|
||||
|
||||
|
|
|
@ -345,9 +345,6 @@ public:
|
|||
#pragma pack(push, 1)
|
||||
class NetworkMessageCommandList: public NetworkMessage {
|
||||
|
||||
private:
|
||||
//static const int maxCommandCount = 2496; // can be as large as 65535
|
||||
|
||||
private:
|
||||
struct DataHeader {
|
||||
int8 messageType;
|
||||
|
@ -360,9 +357,16 @@ private:
|
|||
|
||||
struct Data {
|
||||
DataHeader header;
|
||||
//NetworkCommand commands[maxCommandCount];
|
||||
std::vector<NetworkCommand> commands;
|
||||
};
|
||||
void init(Data &data_ref) {
|
||||
data_ref.header.messageType = 0;
|
||||
data_ref.header.commandCount = 0;
|
||||
data_ref.header.frameCount = 0;
|
||||
for(unsigned int index = 0; index < GameConstants::maxPlayers; ++index) {
|
||||
data_ref.header.networkPlayerFactionCRC[index] = 0;
|
||||
}
|
||||
}
|
||||
void toEndianHeader();
|
||||
void fromEndianHeader();
|
||||
void toEndianDetail(uint16 totalCommand);
|
||||
|
|
|
@ -33,10 +33,10 @@ NetworkCommand::NetworkCommand(World *world, int networkCommandType, int unitId,
|
|||
int commandStateValue, int unitCommandGroupId)
|
||||
: networkCommandType(networkCommandType)
|
||||
, unitId(unitId)
|
||||
, unitTypeId(unitTypeId)
|
||||
, commandTypeId(commandTypeId)
|
||||
, positionX(pos.x)
|
||||
, positionY(pos.y)
|
||||
, unitTypeId(unitTypeId)
|
||||
, wantQueue(wantQueue)
|
||||
, commandStateType(commandStateType)
|
||||
, commandStateValue(commandStateValue)
|
||||
|
|
|
@ -301,7 +301,7 @@ ServerInterface::~ServerInterface() {
|
|||
delete serverSocketAdmin;
|
||||
serverSocketAdmin = NULL;
|
||||
|
||||
for(int i = 0; i < broadcastMessageQueue.size(); ++i) {
|
||||
for(int i = 0; i < (int)broadcastMessageQueue.size(); ++i) {
|
||||
pair<NetworkMessage *,int> &item = broadcastMessageQueue[i];
|
||||
if(item.first != NULL) {
|
||||
delete item.first;
|
||||
|
@ -942,7 +942,7 @@ void ServerInterface::checkForCompletedClients(std::map<int,bool> & mapSlotSigna
|
|||
std::vector<std::string> errorList = connectionSlot->getThreadErrorList();
|
||||
// Collect any collected errors from threads
|
||||
if(errorList.empty() == false) {
|
||||
for(int iErrIdx = 0; iErrIdx < errorList.size(); ++iErrIdx) {
|
||||
for(int iErrIdx = 0; iErrIdx < (int)errorList.size(); ++iErrIdx) {
|
||||
string &sErr = errorList[iErrIdx];
|
||||
if(sErr != "") {
|
||||
errorMsgList.push_back(sErr);
|
||||
|
@ -990,7 +990,7 @@ void ServerInterface::checkForCompletedClients(std::map<int,bool> & mapSlotSigna
|
|||
std::vector<std::string> errorList = connectionSlot->getThreadErrorList();
|
||||
// Collect any collected errors from threads
|
||||
if(errorList.empty() == false) {
|
||||
for(int iErrIdx = 0; iErrIdx < errorList.size(); ++iErrIdx) {
|
||||
for(int iErrIdx = 0; iErrIdx < (int)errorList.size(); ++iErrIdx) {
|
||||
string &sErr = errorList[iErrIdx];
|
||||
if(sErr != "") {
|
||||
errorMsgList.push_back(sErr);
|
||||
|
@ -1055,7 +1055,7 @@ void ServerInterface::checkForLaggingClients(std::map<int,bool> &mapSlotSignalle
|
|||
std::vector<std::string> errorList = connectionSlot->getThreadErrorList();
|
||||
// Show any collected errors from threads
|
||||
if(errorList.empty() == false) {
|
||||
for(int iErrIdx = 0; iErrIdx < errorList.size(); ++iErrIdx) {
|
||||
for(int iErrIdx = 0; iErrIdx < (int)errorList.size(); ++iErrIdx) {
|
||||
string &sErr = errorList[iErrIdx];
|
||||
if(sErr != "") {
|
||||
errorMsgList.push_back(sErr);
|
||||
|
@ -1189,7 +1189,7 @@ void ServerInterface::executeNetworkCommandsFromClients() {
|
|||
if(connectionSlot != NULL && connectionSlot->isConnected() == true) {
|
||||
vector<NetworkCommand> pendingList = connectionSlot->getPendingNetworkCommandList(true);
|
||||
if(pendingList.empty() == false) {
|
||||
for(int idx = 0; exitServer == false && idx < pendingList.size(); ++idx) {
|
||||
for(int idx = 0; exitServer == false && idx < (int)pendingList.size(); ++idx) {
|
||||
NetworkCommand &cmd = pendingList[idx];
|
||||
this->requestCommand(&cmd);
|
||||
}
|
||||
|
@ -1211,7 +1211,7 @@ void ServerInterface::dispatchPendingChatMessages(std::vector <string> &errorMsg
|
|||
std::vector<ChatMsgInfo> chatText = connectionSlot->getChatTextList(true);
|
||||
for(int chatIdx = 0;
|
||||
exitServer == false && slots[i] != NULL &&
|
||||
chatIdx < chatText.size(); chatIdx++) {
|
||||
chatIdx < (int)chatText.size(); chatIdx++) {
|
||||
connectionSlot= slots[i];
|
||||
if(connectionSlot != NULL) {
|
||||
ChatMsgInfo msg(chatText[chatIdx]);
|
||||
|
@ -1259,7 +1259,7 @@ void ServerInterface::dispatchPendingMarkCellMessages(std::vector <string> &erro
|
|||
std::vector<MarkedCell> chatText = connectionSlot->getMarkedCellList(true);
|
||||
for(int chatIdx = 0;
|
||||
exitServer == false && slots[i] != NULL &&
|
||||
chatIdx < chatText.size(); chatIdx++) {
|
||||
chatIdx < (int)chatText.size(); chatIdx++) {
|
||||
connectionSlot= slots[i];
|
||||
if(connectionSlot != NULL) {
|
||||
MarkedCell msg(chatText[chatIdx]);
|
||||
|
@ -1297,7 +1297,7 @@ void ServerInterface::dispatchPendingHighlightCellMessages(std::vector <string>
|
|||
std::vector<MarkedCell> highlightedCells = connectionSlot->getHighlightedCellList(true);
|
||||
for(int chatIdx = 0;
|
||||
exitServer == false && slots[i] != NULL &&
|
||||
chatIdx < highlightedCells.size(); chatIdx++) {
|
||||
chatIdx < (int)highlightedCells.size(); chatIdx++) {
|
||||
connectionSlot= slots[i];
|
||||
if(connectionSlot != NULL) {
|
||||
MarkedCell msg(highlightedCells[chatIdx]);
|
||||
|
@ -1334,7 +1334,7 @@ void ServerInterface::dispatchPendingUnMarkCellMessages(std::vector <string> &er
|
|||
std::vector<UnMarkedCell> chatText = connectionSlot->getUnMarkedCellList(true);
|
||||
for(int chatIdx = 0;
|
||||
exitServer == false && slots[i] != NULL &&
|
||||
chatIdx < chatText.size(); chatIdx++) {
|
||||
chatIdx < (int)chatText.size(); chatIdx++) {
|
||||
connectionSlot= slots[i];
|
||||
if(connectionSlot != NULL) {
|
||||
UnMarkedCell msg(chatText[chatIdx]);
|
||||
|
@ -1600,7 +1600,7 @@ void ServerInterface::update() {
|
|||
errorMsgList.push_back(ex.what());
|
||||
}
|
||||
if(errorMsgList.empty() == false){
|
||||
for(int iErrIdx = 0;iErrIdx < errorMsgList.size();++iErrIdx){
|
||||
for(int iErrIdx = 0;iErrIdx < (int)errorMsgList.size();++iErrIdx){
|
||||
string & sErr = errorMsgList[iErrIdx];
|
||||
if(sErr != ""){
|
||||
DisplayErrorMessage(sErr);
|
||||
|
@ -1914,7 +1914,7 @@ void ServerInterface::waitUntilReady(Checksum *checksum) {
|
|||
lastStatusUpdate = chrono.getMillis();
|
||||
|
||||
string waitForHosts = "";
|
||||
for(int i = 0; i < waitingForHosts.size(); i++) {
|
||||
for(int i = 0; i < (int)waitingForHosts.size(); i++) {
|
||||
if(waitForHosts != "") {
|
||||
waitForHosts += ", ";
|
||||
}
|
||||
|
@ -2060,7 +2060,7 @@ void ServerInterface::processBroadCastMessageQueue() {
|
|||
MutexSafeWrapper safeMutexSlot(broadcastMessageQueueThreadAccessor,CODE_AT_LINE);
|
||||
if(broadcastMessageQueue.empty() == false) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] broadcastMessageQueue.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,broadcastMessageQueue.size());
|
||||
for(int i = 0; i < broadcastMessageQueue.size(); ++i) {
|
||||
for(int i = 0; i < (int)broadcastMessageQueue.size(); ++i) {
|
||||
pair<NetworkMessage *,int> &item = broadcastMessageQueue[i];
|
||||
if(item.first != NULL) {
|
||||
this->broadcastMessage(item.first,item.second);
|
||||
|
@ -2084,7 +2084,7 @@ void ServerInterface::processTextMessageQueue() {
|
|||
MutexSafeWrapper safeMutexSlot(textMessageQueueThreadAccessor,CODE_AT_LINE);
|
||||
if(textMessageQueue.empty() == false) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] textMessageQueue.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,textMessageQueue.size());
|
||||
for(int i = 0; i < textMessageQueue.size(); ++i) {
|
||||
for(int i = 0; i < (int)textMessageQueue.size(); ++i) {
|
||||
TextMessageQueue &item = textMessageQueue[i];
|
||||
sendTextMessage(item.text, item.teamIndex, item.echoLocal, item.targetLanguage);
|
||||
}
|
||||
|
@ -2366,7 +2366,7 @@ void ServerInterface::broadcastGameSetup(GameSettings *gameSettingsBuffer, bool
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
if(gameSettingsBuffer != NULL) {
|
||||
for(unsigned int i = 0; i < gameSettingsBuffer->getFactionCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)gameSettingsBuffer->getFactionCount(); ++i) {
|
||||
int slotIndex = gameSettingsBuffer->getStartLocationIndex(i);
|
||||
if(gameSettingsBuffer->getFactionControl(i) == ctNetwork &&
|
||||
isClientConnected(slotIndex) == false) {
|
||||
|
@ -2545,7 +2545,7 @@ void ServerInterface::validateGameSettings(GameSettings *serverGameSettings) {
|
|||
printf("map not found on this server\n");
|
||||
int currentIndex=-1;
|
||||
string currentMap=gameSettings.getMap();
|
||||
for (int i=0 ;i<mapFiles.size(); i++) {
|
||||
for (int i=0 ;i < (int)mapFiles.size(); i++) {
|
||||
string current=mapFiles[i];
|
||||
if(current==currentMap)
|
||||
{
|
||||
|
@ -2560,7 +2560,7 @@ void ServerInterface::validateGameSettings(GameSettings *serverGameSettings) {
|
|||
printf("mapFile>gameSettings [%s] > [%s]\n",mapFile.c_str(),gameSettings.getMap().c_str());
|
||||
|
||||
int nextIndex=-1;
|
||||
for (int i=0 ;i<mapFiles.size(); i++) {
|
||||
for (int i=0 ;i < (int)mapFiles.size(); i++) {
|
||||
string current=mapFiles[i];
|
||||
if(current>mapFile)
|
||||
{
|
||||
|
|
|
@ -37,14 +37,14 @@ bool CommandGroupUnitSorterId::operator()(const int l, const int r) {
|
|||
if(!lUnit) {
|
||||
printf("Error lUnit == NULL for id = %d factionIndex = %d\n",l,faction->getIndex());
|
||||
|
||||
for(unsigned int i = 0; i < faction->getUnitCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)faction->getUnitCount(); ++i) {
|
||||
printf("%u / %d id = %d [%s]\n",i,faction->getUnitCount(),faction->getUnit(i)->getId(),faction->getUnit(i)->getType()->getName(false).c_str());
|
||||
}
|
||||
}
|
||||
if(!rUnit) {
|
||||
printf("Error rUnit == NULL for id = %d factionIndex = %d\n",r,faction->getIndex());
|
||||
|
||||
for(unsigned int i = 0; i < faction->getUnitCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)faction->getUnitCount(); ++i) {
|
||||
printf("%u / %d id = %d [%s]\n",i,faction->getUnitCount(),faction->getUnit(i)->getId(),faction->getUnit(i)->getType()->getName(false).c_str());
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ void Faction::sortUnitsByCommandGroups() {
|
|||
|
||||
//printf("====== Done sorting for faction # %d [%s] unitCount = %d\n",this->getIndex(),this->getType()->getName().c_str(),units.size());
|
||||
|
||||
unsigned int originalUnitSize = (unsigned int)units.size();
|
||||
//unsigned int originalUnitSize = (unsigned int)units.size();
|
||||
|
||||
std::vector<int> unitIds;
|
||||
for(unsigned int i = 0; i < units.size(); ++i) {
|
||||
|
@ -751,13 +751,13 @@ void Faction::init(
|
|||
// ================== get ==================
|
||||
|
||||
const Resource *Faction::getResource(const ResourceType *rt) const{
|
||||
for(int i=0; i<resources.size(); ++i){
|
||||
for(int i = 0; i < (int)resources.size(); ++i){
|
||||
if(rt==resources[i].getType()){
|
||||
return &resources[i];
|
||||
}
|
||||
}
|
||||
printf("ERROR cannot find resource type [%s] in list:\n",(rt != NULL ? rt->getName().c_str() : "null"));
|
||||
for(int i=0; i<resources.size(); ++i){
|
||||
for(int i=0; i < (int)resources.size(); ++i){
|
||||
printf("Index %d [%s]",i,resources[i].getType()->getName().c_str());
|
||||
}
|
||||
|
||||
|
@ -766,13 +766,13 @@ const Resource *Faction::getResource(const ResourceType *rt) const{
|
|||
}
|
||||
|
||||
int Faction::getStoreAmount(const ResourceType *rt) const{
|
||||
for(int i=0; i<store.size(); ++i){
|
||||
for(int i=0; i < (int)store.size(); ++i){
|
||||
if(rt==store[i].getType()){
|
||||
return store[i].getAmount();
|
||||
}
|
||||
}
|
||||
printf("ERROR cannot find store type [%s] in list:\n",(rt != NULL ? rt->getName().c_str() : "null"));
|
||||
for(int i=0; i<store.size(); ++i){
|
||||
for(int i=0; i < (int)store.size(); ++i){
|
||||
printf("Index %d [%s]",i,store[i].getType()->getName().c_str());
|
||||
}
|
||||
|
||||
|
@ -1133,7 +1133,7 @@ void Faction::applyCostsOnInterval(const ResourceType *rtApply) {
|
|||
// Apply consequences to consumer units of this resource type
|
||||
std::vector<Unit *> &resourceConsumers = iter->second.second;
|
||||
|
||||
for(int i = 0; i < resourceConsumers.size(); ++i) {
|
||||
for(int i = 0; i < (int)resourceConsumers.size(); ++i) {
|
||||
Unit *unit = resourceConsumers[i];
|
||||
|
||||
//decrease unit hp
|
||||
|
@ -1194,7 +1194,7 @@ bool Faction::isAlly(const Faction *faction) {
|
|||
// ================== misc ==================
|
||||
|
||||
void Faction::incResourceAmount(const ResourceType *rt, int amount) {
|
||||
for(int i=0; i<resources.size(); ++i) {
|
||||
for(int i=0; i < (int)resources.size(); ++i) {
|
||||
Resource *r= &resources[i];
|
||||
if(r->getType()==rt) {
|
||||
r->setAmount(r->getAmount()+amount);
|
||||
|
@ -1208,7 +1208,7 @@ void Faction::incResourceAmount(const ResourceType *rt, int amount) {
|
|||
}
|
||||
|
||||
void Faction::setResourceBalance(const ResourceType *rt, int balance){
|
||||
for(int i=0; i<resources.size(); ++i){
|
||||
for(int i=0; i < (int)resources.size(); ++i){
|
||||
Resource *r= &resources[i];
|
||||
if(r->getType()==rt){
|
||||
r->setBalance(balance);
|
||||
|
@ -1238,7 +1238,7 @@ void Faction::removeUnit(Unit *unit){
|
|||
assert(units.size()==unitMap.size());
|
||||
|
||||
int unitId = unit->getId();
|
||||
for(int i=0; i<units.size(); ++i) {
|
||||
for(int i=0; i < (int)units.size(); ++i) {
|
||||
if(units[i]->getId() == unitId) {
|
||||
units.erase(units.begin()+i);
|
||||
unitMap.erase(unitId);
|
||||
|
@ -1259,7 +1259,7 @@ void Faction::addStore(const UnitType *unitType, bool replaceStorage) {
|
|||
const Resource *newUnitStoredResource = unitType->getStoredResource(newUnitStoredResourceIndex);
|
||||
|
||||
for(int currentStoredResourceIndex = 0;
|
||||
currentStoredResourceIndex < store.size();
|
||||
currentStoredResourceIndex < (int)store.size();
|
||||
++currentStoredResourceIndex) {
|
||||
Resource *storedResource= &store[currentStoredResourceIndex];
|
||||
|
||||
|
@ -1279,7 +1279,7 @@ void Faction::removeStore(const UnitType *unitType){
|
|||
assert(unitType != NULL);
|
||||
for(int i=0; i<unitType->getStoredResourceCount(); ++i){
|
||||
const Resource *r= unitType->getStoredResource(i);
|
||||
for(int j=0; j<store.size(); ++j){
|
||||
for(int j=0; j < (int)store.size(); ++j){
|
||||
Resource *storedResource= &store[j];
|
||||
if(storedResource->getType() == r->getType()){
|
||||
storedResource->setAmount(storedResource->getAmount() - r->getAmount());
|
||||
|
@ -1290,7 +1290,7 @@ void Faction::removeStore(const UnitType *unitType){
|
|||
}
|
||||
|
||||
void Faction::limitResourcesToStore() {
|
||||
for(int i=0; i<resources.size(); ++i) {
|
||||
for(int i=0; i < (int)resources.size(); ++i) {
|
||||
Resource *r= &resources[i];
|
||||
Resource *s= &store[i];
|
||||
if(r->getType()->getClass() != rcStatic && r->getAmount()>s->getAmount()) {
|
||||
|
@ -1300,7 +1300,7 @@ void Faction::limitResourcesToStore() {
|
|||
}
|
||||
|
||||
void Faction::resetResourceAmount(const ResourceType *rt){
|
||||
for(int i=0; i<resources.size(); ++i){
|
||||
for(int i=0; i < (int)resources.size(); ++i){
|
||||
if(resources[i].getType()==rt){
|
||||
resources[i].setAmount(0);
|
||||
return;
|
||||
|
@ -1694,7 +1694,7 @@ void Faction::cleanupResourceTypeTargetCache(std::vector<Vec2i> *deleteListPtr,i
|
|||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < deleteList.size(); ++i) {
|
||||
for(int i = 0; i < (int)deleteList.size(); ++i) {
|
||||
Vec2i &cache = deleteList[i];
|
||||
cacheResourceTargetList.erase(cache);
|
||||
}
|
||||
|
@ -1872,7 +1872,7 @@ Unit * Faction::findClosestUnitWithSkillClass( const Vec2i &pos,const CommandCla
|
|||
if(isUnitPossibleCandidate == true && skillClassList.empty() == false) {
|
||||
isUnitPossibleCandidate = false;
|
||||
|
||||
for(int j = 0; j < skillClassList.size(); ++j) {
|
||||
for(int j = 0; j < (int)skillClassList.size(); ++j) {
|
||||
SkillClass skValue = skillClassList[j];
|
||||
if(curUnit->getCurrSkill()->getClass() == skValue) {
|
||||
isUnitPossibleCandidate = true;
|
||||
|
@ -2103,22 +2103,22 @@ std::string Faction::toString(bool crcMode) const {
|
|||
result += this->upgradeManager.toString() + "\n";
|
||||
|
||||
result += "ResourceCount = " + intToStr(resources.size()) + "\n";
|
||||
for(int idx = 0; idx < resources.size(); idx ++) {
|
||||
for(int idx = 0; idx < (int)resources.size(); idx ++) {
|
||||
result += "index = " + intToStr(idx) + " " + resources[idx].toString() + "\n";
|
||||
}
|
||||
|
||||
result += "StoreCount = " + intToStr(store.size()) + "\n";
|
||||
for(int idx = 0; idx < store.size(); idx ++) {
|
||||
for(int idx = 0; idx < (int)store.size(); idx ++) {
|
||||
result += "index = " + intToStr(idx) + " " + store[idx].toString() + "\n";
|
||||
}
|
||||
|
||||
result += "Allies = " + intToStr(allies.size()) + "\n";
|
||||
for(int idx = 0; idx < allies.size(); idx ++) {
|
||||
for(int idx = 0; idx < (int)allies.size(); idx ++) {
|
||||
result += "index = " + intToStr(idx) + " name: " + allies[idx]->factionType->getName(false) + " factionindex = " + intToStr(allies[idx]->index) + "\n";
|
||||
}
|
||||
|
||||
result += "Units = " + intToStr(units.size()) + "\n";
|
||||
for(int idx = 0; idx < units.size(); idx ++) {
|
||||
for(int idx = 0; idx < (int)units.size(); idx ++) {
|
||||
result += units[idx]->toString(crcMode) + "\n";
|
||||
}
|
||||
|
||||
|
@ -2415,7 +2415,7 @@ Checksum Faction::getCRC() {
|
|||
}
|
||||
|
||||
void Faction::addCRC_DetailsForWorldFrame(int worldFrameCount,bool isNetworkServer) {
|
||||
int MAX_FRAME_CACHE = 250;
|
||||
unsigned int MAX_FRAME_CACHE = 250;
|
||||
if(isNetworkServer == true) {
|
||||
MAX_FRAME_CACHE += 250;
|
||||
}
|
||||
|
@ -2430,10 +2430,10 @@ void Faction::addCRC_DetailsForWorldFrame(int worldFrameCount,bool isNetworkServ
|
|||
unit->clearParticleInfo();
|
||||
}
|
||||
|
||||
if(crcWorldFrameDetails.size() > MAX_FRAME_CACHE) {
|
||||
if((unsigned int)crcWorldFrameDetails.size() > MAX_FRAME_CACHE) {
|
||||
//printf("===> Removing older world frame log entries: %lld\n",(long long int)crcWorldFrameDetails.size());
|
||||
|
||||
for(;crcWorldFrameDetails.size() - MAX_FRAME_CACHE > 0;) {
|
||||
for(;(unsigned int)crcWorldFrameDetails.size() - MAX_FRAME_CACHE > 0;) {
|
||||
crcWorldFrameDetails.erase(crcWorldFrameDetails.begin());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ void Resource::saveGame(XmlNode *rootNode) const {
|
|||
void Resource::loadGame(const XmlNode *rootNode, int index,const TechTree *techTree) {
|
||||
vector<XmlNode *> resourceNodeList = rootNode->getChildList("Resource");
|
||||
|
||||
if(index < resourceNodeList.size()) {
|
||||
if(index < (int)resourceNodeList.size()) {
|
||||
XmlNode *resourceNode = resourceNodeList[index];
|
||||
|
||||
amount = resourceNode->getAttribute("amount")->getIntValue();
|
||||
|
|
|
@ -134,7 +134,7 @@ Vec2i UnitPathBasic::pop(bool removeFrontPos) {
|
|||
}
|
||||
std::string UnitPathBasic::toString() const {
|
||||
std::string result = "unit path blockCount = " + intToStr(blockCount) + "\npathQueue size = " + intToStr(pathQueue.size());
|
||||
for(int idx = 0; idx < pathQueue.size(); ++idx) {
|
||||
for(int idx = 0; idx < (int)pathQueue.size(); ++idx) {
|
||||
result += " index = " + intToStr(idx) + " value = " + pathQueue[idx].getString();
|
||||
}
|
||||
|
||||
|
@ -1229,7 +1229,7 @@ void Unit::setPos(const Vec2i &pos, bool clearPathFinder) {
|
|||
if(clearPathFinder == true && this->unitPath != NULL) {
|
||||
this->unitPath->clear();
|
||||
}
|
||||
Vec2i oldLastPos = this->lastPos;
|
||||
//Vec2i oldLastPos = this->lastPos;
|
||||
this->lastPos= this->pos;
|
||||
this->pos= pos;
|
||||
|
||||
|
@ -1948,8 +1948,8 @@ const CommandType *Unit::computeCommandType(const Vec2i &pos, const Unit *target
|
|||
//printf("Line: %d Unit::computeCommandType pos [%s] targetUnit [%s] commandType [%p]\n",__LINE__,pos.getString().c_str(),(targetUnit != NULL ? targetUnit->getType()->getName().c_str() : "(null)"),commandType);
|
||||
|
||||
if(commandType == NULL && targetUnit != NULL) {
|
||||
Command *command= this->getCurrCommand();
|
||||
const HarvestCommandType *hct= dynamic_cast<const HarvestCommandType*>((command != NULL ? command->getCommandType() : NULL));
|
||||
//Command *command= this->getCurrCommand();
|
||||
//const HarvestCommandType *hct= dynamic_cast<const HarvestCommandType*>((command != NULL ? command->getCommandType() : NULL));
|
||||
|
||||
// Check if we can return whatever resources we have
|
||||
if(targetUnit->getFactionIndex() == this->getFactionIndex() &&
|
||||
|
@ -4045,7 +4045,7 @@ void Unit::removeBadHarvestPos(const Vec2i &value) {
|
|||
}
|
||||
|
||||
void Unit::cleanupOldBadHarvestPos() {
|
||||
const int cleanupInterval = (GameConstants::updateFps * 5);
|
||||
const unsigned int cleanupInterval = (GameConstants::updateFps * 5);
|
||||
bool needToCleanup = (getFrameCount() % cleanupInterval == 0);
|
||||
|
||||
//printf("========================> cleanupOldBadHarvestPos() [%d] badHarvestPosList.size [%ld] cleanupInterval [%d] getFrameCount() [%d] needToCleanup [%d]\n",getFrameCount(),badHarvestPosList.size(),cleanupInterval,getFrameCount(),needToCleanup);
|
||||
|
@ -4066,7 +4066,7 @@ void Unit::cleanupOldBadHarvestPos() {
|
|||
snprintf(szBuf,8096,"[cleaning old bad harvest targets] purgeList.size() [" MG_SIZE_T_SPECIFIER "]",purgeList.size());
|
||||
logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,szBuf);
|
||||
|
||||
for(int i = 0; i < purgeList.size(); ++i) {
|
||||
for(int i = 0; i < (int)purgeList.size(); ++i) {
|
||||
const Vec2i &item = purgeList[i];
|
||||
badHarvestPosList.erase(item);
|
||||
}
|
||||
|
@ -4091,7 +4091,7 @@ void Unit::setLastHarvestResourceTarget(const Vec2i *pos) {
|
|||
else {
|
||||
// If we cannot harvest for > 10 seconds tag the position
|
||||
// as a bad one
|
||||
const int addInterval = (GameConstants::updateFps * 5);
|
||||
const unsigned int addInterval = (GameConstants::updateFps * 5);
|
||||
if(lastHarvestResourceTarget.second - getFrameCount() >= addInterval) {
|
||||
//printf("-----------------------> setLastHarvestResourceTarget() [%d][%d]\n",getFrameCount(),lastHarvestResourceTarget.second);
|
||||
addBadHarvestPos(resourceLocation);
|
||||
|
@ -4130,7 +4130,7 @@ void Unit::setLastStuckFrameToCurrentFrame() {
|
|||
bool Unit::isLastStuckFrameWithinCurrentFrameTolerance(bool evalMode) {
|
||||
//const int MIN_FRAME_ELAPSED_RETRY = 300;
|
||||
const int MAX_BLOCKED_FRAME_THRESHOLD = 25000;
|
||||
int MIN_FRAME_ELAPSED_RETRY = 6;
|
||||
unsigned int MIN_FRAME_ELAPSED_RETRY = 6;
|
||||
if(lastStuckFrame < MAX_BLOCKED_FRAME_THRESHOLD) {
|
||||
if(evalMode == true) {
|
||||
MIN_FRAME_ELAPSED_RETRY = 4;
|
||||
|
@ -4951,7 +4951,7 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
|
|||
}
|
||||
|
||||
vector<XmlNode *> unitParticleSystemNodeList = fireParticleSystemsNode->getChildList("FireParticleSystem");
|
||||
for(unsigned int i = 0; i < unitParticleSystemNodeList.size(); ++i) {
|
||||
for(int i = 0; i < (int)unitParticleSystemNodeList.size(); ++i) {
|
||||
XmlNode *node = unitParticleSystemNodeList[i];
|
||||
|
||||
FireParticleSystem *ups = new FireParticleSystem();
|
||||
|
|
|
@ -114,7 +114,7 @@ void UpgradeManager::startUpgrade(const UpgradeType *upgradeType, int factionInd
|
|||
void UpgradeManager::cancelUpgrade(const UpgradeType *upgradeType) {
|
||||
map<const UpgradeType *,int>::iterator iterFind = upgradesLookup.find(upgradeType);
|
||||
if(iterFind != upgradesLookup.end()) {
|
||||
if(iterFind->second >= upgrades.size()) {
|
||||
if(iterFind->second >= (int)upgrades.size()) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error canceling upgrade, iterFind->second >= upgrades.size() - [%d] : [%d]",iterFind->second,(int)upgrades.size());
|
||||
throw megaglest_runtime_error("Error canceling upgrade, upgrade not found in upgrade manager");
|
||||
|
@ -125,7 +125,7 @@ void UpgradeManager::cancelUpgrade(const UpgradeType *upgradeType) {
|
|||
|
||||
for(map<const UpgradeType *,int>::iterator iterMap = upgradesLookup.begin();
|
||||
iterMap != upgradesLookup.end(); ++iterMap) {
|
||||
if(iterMap->second >= upgrades.size()) {
|
||||
if(iterMap->second >= (int)upgrades.size()) {
|
||||
iterMap->second--;
|
||||
}
|
||||
if(iterMap->second < 0) {
|
||||
|
@ -250,7 +250,7 @@ void UpgradeManager::computeTotalUpgrade(const Unit *unit, TotalUpgrade *totalUp
|
|||
|
||||
std::string UpgradeManager::toString() const {
|
||||
std::string result = "UpgradeCount: " + intToStr(this->getUpgradeCount());
|
||||
for(int idx = 0; idx < upgrades.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)upgrades.size(); idx++) {
|
||||
result += " index = " + intToStr(idx) + " " + upgrades[idx]->toString();
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -64,7 +64,7 @@ void CommandType::load(int id, const XmlNode *n, const string &dir,
|
|||
|
||||
//unit requirements
|
||||
const XmlNode *unitRequirementsNode= n->getChild("unit-requirements");
|
||||
for(int i = 0; i < unitRequirementsNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)unitRequirementsNode->getChildCount(); ++i) {
|
||||
const XmlNode *unitNode= unitRequirementsNode->getChild("unit", i);
|
||||
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
||||
unitReqs.push_back(ft->getUnitType(name));
|
||||
|
@ -72,7 +72,7 @@ void CommandType::load(int id, const XmlNode *n, const string &dir,
|
|||
|
||||
//upgrade requirements
|
||||
const XmlNode *upgradeRequirementsNode= n->getChild("upgrade-requirements");
|
||||
for(int i = 0; i < upgradeRequirementsNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)upgradeRequirementsNode->getChildCount(); ++i) {
|
||||
const XmlNode *upgradeReqNode= upgradeRequirementsNode->getChild("upgrade", i);
|
||||
string name= upgradeReqNode->getAttribute("name")->getRestrictedValue();
|
||||
upgradeReqs.push_back(ft->getUpgradeType(name));
|
||||
|
@ -425,7 +425,7 @@ void BuildCommandType::load(int id, const XmlNode *n, const string &dir,
|
|||
|
||||
//buildings built
|
||||
const XmlNode *buildingsNode= n->getChild("buildings");
|
||||
for(int i=0; i<buildingsNode->getChildCount(); ++i){
|
||||
for(int i=0; i < (int)buildingsNode->getChildCount(); ++i){
|
||||
const XmlNode *buildingNode= buildingsNode->getChild("building", i);
|
||||
string name= buildingNode->getAttribute("name")->getRestrictedValue();
|
||||
buildings.push_back(ft->getUnitType(name));
|
||||
|
@ -435,7 +435,7 @@ void BuildCommandType::load(int id, const XmlNode *n, const string &dir,
|
|||
const XmlNode *startSoundNode= n->getChild("start-sound");
|
||||
if(startSoundNode->getAttribute("enabled")->getBoolValue()){
|
||||
startSounds.resize((int)startSoundNode->getChildCount());
|
||||
for(int i=0; i<startSoundNode->getChildCount(); ++i){
|
||||
for(int i=0; i < (int)startSoundNode->getChildCount(); ++i){
|
||||
const XmlNode *soundFileNode= startSoundNode->getChild("sound-file", i);
|
||||
string currentPath = dir;
|
||||
endPathWithSlash(currentPath);
|
||||
|
@ -453,7 +453,7 @@ void BuildCommandType::load(int id, const XmlNode *n, const string &dir,
|
|||
const XmlNode *builtSoundNode= n->getChild("built-sound");
|
||||
if(builtSoundNode->getAttribute("enabled")->getBoolValue()){
|
||||
builtSounds.resize((int)builtSoundNode->getChildCount());
|
||||
for(int i=0; i<builtSoundNode->getChildCount(); ++i){
|
||||
for(int i=0; i < (int)builtSoundNode->getChildCount(); ++i){
|
||||
const XmlNode *soundFileNode= builtSoundNode->getChild("sound-file", i);
|
||||
string currentPath = dir;
|
||||
endPathWithSlash(currentPath);
|
||||
|
@ -537,7 +537,7 @@ void HarvestCommandType::load(int id, const XmlNode *n, const string &dir,
|
|||
|
||||
//resources can harvest
|
||||
const XmlNode *resourcesNode= n->getChild("harvested-resources");
|
||||
for(int i=0; i<resourcesNode->getChildCount(); ++i){
|
||||
for(int i=0; i < (int)resourcesNode->getChildCount(); ++i){
|
||||
const XmlNode *resourceNode= resourcesNode->getChild("resource", i);
|
||||
harvestedResources.push_back(tt->getResourceType(resourceNode->getAttribute("name")->getRestrictedValue()));
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ void RepairCommandType::load(int id, const XmlNode *n, const string &dir,
|
|||
|
||||
//repaired units
|
||||
const XmlNode *unitsNode= n->getChild("repaired-units");
|
||||
for(int i=0; i<unitsNode->getChildCount(); ++i){
|
||||
for(int i=0; i < (int)unitsNode->getChildCount(); ++i){
|
||||
const XmlNode *unitNode= unitsNode->getChild("unit", i);
|
||||
repairableUnits.push_back(ft->getUnitType(unitNode->getAttribute("name")->getRestrictedValue()));
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ string RepairCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla
|
|||
str+= lang.getString("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(repairSkillType->getHpCost())+"\n";
|
||||
}
|
||||
str+="\n"+lang.getString("CanRepair",(translatedValue == true ? "" : "english"))+":\n";
|
||||
for(int i=0; i<repairableUnits.size(); ++i){
|
||||
for(int i=0; i < (int)repairableUnits.size(); ++i){
|
||||
str+= (static_cast<const UnitType*>(repairableUnits[i]))->getName(translatedValue)+"\n";
|
||||
}
|
||||
str+=repairSkillType->getBoostDesc(translatedValue);
|
||||
|
@ -692,7 +692,7 @@ string RepairCommandType::toString(bool translatedValue) const{
|
|||
|
||||
//get
|
||||
bool RepairCommandType::isRepairableUnitType(const UnitType *unitType) const {
|
||||
for(int i = 0; i < repairableUnits.size(); ++i) {
|
||||
for(int i = 0; i < (int)repairableUnits.size(); ++i) {
|
||||
const UnitType *curUnitType = static_cast<const UnitType*>(repairableUnits[i]);
|
||||
//printf("Lookup index = %d Can repair unittype [%s][%p] looking for [%s][%p] lookup found result = %d\n",i,curUnitType->getName().c_str(),curUnitType,unitType->getName().c_str(),unitType,(curUnitType == unitType));
|
||||
if(curUnitType == unitType) {
|
||||
|
|
|
@ -96,7 +96,7 @@ void DamageMultiplierTable::saveGame(XmlNode *rootNode) {
|
|||
damageMultiplierTableNode->addAttribute("armorTypeCount",intToStr(armorTypeCount), mapTagReplacements);
|
||||
|
||||
int valueCount= attackTypeCount * armorTypeCount;
|
||||
for(unsigned int i=0; i < valueCount; ++i) {
|
||||
for(int i=0; i < valueCount; ++i) {
|
||||
XmlNode *valuesNode = damageMultiplierTableNode->addChild("values");
|
||||
valuesNode->addAttribute("value",doubleToStr(values[i]), mapTagReplacements);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ ProducibleType::~ProducibleType(){
|
|||
}
|
||||
|
||||
const Resource *ProducibleType::getCost(const ResourceType *rt) const{
|
||||
for(int i=0; i<costs.size(); ++i){
|
||||
for(int i=0; i < (int)costs.size(); ++i){
|
||||
if(costs[i].getType()==rt){
|
||||
return &costs[i];
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
|
||||
unitTypes.resize(unitFilenames.size());
|
||||
|
||||
for(int i = 0; i < unitTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)unitTypes.size(); ++i) {
|
||||
string str= currentPath + "units/" + unitFilenames[i];
|
||||
unitTypes[i].preLoad(str);
|
||||
|
||||
|
@ -151,7 +151,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
findDirs(upgradesPath, upgradeFilenames,false,false);
|
||||
|
||||
upgradeTypes.resize(upgradeFilenames.size());
|
||||
for(int i = 0; i < upgradeTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)upgradeTypes.size(); ++i) {
|
||||
string str= currentPath + "upgrades/" + upgradeFilenames[i];
|
||||
upgradeTypes[i].preLoad(str);
|
||||
|
||||
|
@ -162,7 +162,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
try {
|
||||
Logger &logger= Logger::getInstance();
|
||||
int progressBaseValue=logger.getProgress();
|
||||
for(int i = 0; i < unitTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)unitTypes.size(); ++i) {
|
||||
string str= currentPath + "units/" + unitTypes[i].getName();
|
||||
|
||||
try {
|
||||
|
@ -192,7 +192,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
|
||||
// b2) load upgrades
|
||||
try{
|
||||
for(int i = 0; i < upgradeTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)upgradeTypes.size(); ++i) {
|
||||
string str= currentPath + "upgrades/" + upgradeTypes[i].getName();
|
||||
|
||||
try {
|
||||
|
@ -232,7 +232,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
const XmlNode *startingResourcesNode= factionNode->getChild("starting-resources");
|
||||
|
||||
startingResources.resize(startingResourcesNode->getChildCount());
|
||||
for(int i = 0; i < startingResources.size(); ++i) {
|
||||
for(int i = 0; i < (int)startingResources.size(); ++i) {
|
||||
const XmlNode *resourceNode= startingResourcesNode->getChild("resource", i);
|
||||
string name= resourceNode->getAttribute("name")->getRestrictedValue();
|
||||
int amount= resourceNode->getAttribute("amount")->getIntValue();
|
||||
|
@ -254,7 +254,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
|
||||
//read starting units
|
||||
const XmlNode *startingUnitsNode= factionNode->getChild("starting-units");
|
||||
for(int i = 0; i < startingUnitsNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)startingUnitsNode->getChildCount(); ++i) {
|
||||
const XmlNode *unitNode= startingUnitsNode->getChild("unit", i);
|
||||
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
||||
int amount= unitNode->getAttribute("amount")->getIntValue();
|
||||
|
@ -281,7 +281,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
|
||||
if(aiNode->hasChild("static-values") == true) {
|
||||
const XmlNode *aiNodeUnits= aiNode->getChild("static-values");
|
||||
for(int i = 0; i < aiNodeUnits->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)aiNodeUnits->getChildCount(); ++i) {
|
||||
const XmlNode *unitNode= aiNodeUnits->getChild("static", i);
|
||||
AIBehaviorStaticValueCategory type = aibsvcMaxBuildRadius;
|
||||
if(unitNode->hasAttribute("type") == true) {
|
||||
|
@ -302,7 +302,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
|
||||
if(aiNode->hasChild("worker-units") == true) {
|
||||
const XmlNode *aiNodeUnits= aiNode->getChild("worker-units");
|
||||
for(int i = 0; i < aiNodeUnits->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)aiNodeUnits->getChildCount(); ++i) {
|
||||
const XmlNode *unitNode= aiNodeUnits->getChild("unit", i);
|
||||
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
||||
int minimum= unitNode->getAttribute("minimum")->getIntValue();
|
||||
|
@ -312,7 +312,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
}
|
||||
if(aiNode->hasChild("warrior-units") == true) {
|
||||
const XmlNode *aiNodeUnits= aiNode->getChild("warrior-units");
|
||||
for(int i = 0; i < aiNodeUnits->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)aiNodeUnits->getChildCount(); ++i) {
|
||||
const XmlNode *unitNode= aiNodeUnits->getChild("unit", i);
|
||||
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
||||
int minimum= unitNode->getAttribute("minimum")->getIntValue();
|
||||
|
@ -322,7 +322,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
}
|
||||
if(aiNode->hasChild("resource-producer-units") == true) {
|
||||
const XmlNode *aiNodeUnits= aiNode->getChild("resource-producer-units");
|
||||
for(int i = 0; i < aiNodeUnits->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)aiNodeUnits->getChildCount(); ++i) {
|
||||
const XmlNode *unitNode= aiNodeUnits->getChild("unit", i);
|
||||
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
||||
int minimum= unitNode->getAttribute("minimum")->getIntValue();
|
||||
|
@ -332,7 +332,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
}
|
||||
if(aiNode->hasChild("building-units") == true) {
|
||||
const XmlNode *aiNodeUnits= aiNode->getChild("building-units");
|
||||
for(int i = 0; i < aiNodeUnits->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)aiNodeUnits->getChildCount(); ++i) {
|
||||
const XmlNode *unitNode= aiNodeUnits->getChild("unit", i);
|
||||
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
||||
int minimum= unitNode->getAttribute("minimum")->getIntValue();
|
||||
|
@ -343,7 +343,7 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
|
||||
if(aiNode->hasChild("upgrades") == true) {
|
||||
const XmlNode *aiNodeUpgrades= aiNode->getChild("upgrades");
|
||||
for(int i = 0; i < aiNodeUpgrades->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)aiNodeUpgrades->getChildCount(); ++i) {
|
||||
const XmlNode *upgradeNode= aiNodeUpgrades->getChild("upgrade", i);
|
||||
string name= upgradeNode->getAttribute("name")->getRestrictedValue();
|
||||
|
||||
|
@ -389,10 +389,10 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
results.push_back(szBuf);
|
||||
}
|
||||
|
||||
for(int i=0; i<unitTypes.size(); ++i){
|
||||
for(int i=0; i < (int)unitTypes.size(); ++i){
|
||||
UnitType &unitType = unitTypes[i];
|
||||
|
||||
for(int i = 0; i < unitType.getSelectionSounds().getSounds().size(); ++i) {
|
||||
for(int i = 0; i < (int)unitType.getSelectionSounds().getSounds().size(); ++i) {
|
||||
StaticSound *sound = unitType.getSelectionSounds().getSounds()[i];
|
||||
if(sound != NULL && sound->getInfo()->getBitRate() > MAX_BITRATE_WARNING) {
|
||||
char szBuf[8096]="";
|
||||
|
@ -400,7 +400,7 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < unitType.getCommandSounds().getSounds().size(); ++i) {
|
||||
for(int i = 0; i < (int)unitType.getCommandSounds().getSounds().size(); ++i) {
|
||||
StaticSound *sound = unitType.getCommandSounds().getSounds()[i];
|
||||
if(sound != NULL && sound->getInfo()->getBitRate() > MAX_BITRATE_WARNING) {
|
||||
char szBuf[8096]="";
|
||||
|
@ -410,7 +410,7 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
}
|
||||
|
||||
int morphCommandCount = 0;
|
||||
for(int j = 0; j < unitType.getCommandTypeCount(); ++j) {
|
||||
for(int j = 0; j < (int)unitType.getCommandTypeCount(); ++j) {
|
||||
const CommandType *cmdType = unitType.getCommandType(j);
|
||||
if(cmdType != NULL) {
|
||||
// Check every unit's commands to validate that for every upgrade-requirements
|
||||
|
@ -421,7 +421,7 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
if(upgradeType != NULL) {
|
||||
// Now lets find a unit that can produced-upgrade this upgrade
|
||||
bool foundUpgraderUnit = false;
|
||||
for(int l=0; l<unitTypes.size() && foundUpgraderUnit == false; ++l){
|
||||
for(int l=0; l < (int)unitTypes.size() && foundUpgraderUnit == false; ++l){
|
||||
UnitType &unitType2 = unitTypes[l];
|
||||
for(int m = 0; m < unitType2.getCommandTypeCount() && foundUpgraderUnit == false; ++m) {
|
||||
const CommandType *cmdType2 = unitType2.getCommandType(m);
|
||||
|
@ -453,7 +453,7 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
|
||||
// Now lets find the unit that we should be able to build
|
||||
bool foundUnit = false;
|
||||
for(int l=0; l<unitTypes.size() && foundUnit == false; ++l){
|
||||
for(int l=0; l < (int)unitTypes.size() && foundUnit == false; ++l){
|
||||
UnitType &unitType2 = unitTypes[l];
|
||||
if(unitType2.getName() == buildUnit->getName()) {
|
||||
foundUnit = true;
|
||||
|
@ -486,7 +486,7 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
|
||||
// Now lets find the unit that we should be able to repair
|
||||
bool foundUnit = false;
|
||||
for(int l=0; l<unitTypes.size() && foundUnit == false; ++l){
|
||||
for(int l=0; l < (int)unitTypes.size() && foundUnit == false; ++l){
|
||||
UnitType &unitType2 = unitTypes[l];
|
||||
if(unitType2.getName() == repairUnit->getName()) {
|
||||
foundUnit = true;
|
||||
|
@ -512,7 +512,7 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
// Now lets find the unit that we should be able to morph
|
||||
// to
|
||||
bool foundUnit = false;
|
||||
for(int l=0; l<unitTypes.size() && foundUnit == false; ++l){
|
||||
for(int l=0; l < (int)unitTypes.size() && foundUnit == false; ++l){
|
||||
UnitType &unitType2 = unitTypes[l];
|
||||
if(unitType2.getName() == morphUnit->getName()) {
|
||||
foundUnit = true;
|
||||
|
@ -544,7 +544,7 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
if(unitType2 != NULL) {
|
||||
// Now lets find the required unit
|
||||
bool foundUnit = false;
|
||||
for(int l=0; l<unitTypes.size() && foundUnit == false; ++l){
|
||||
for(int l=0; l < (int)unitTypes.size() && foundUnit == false; ++l){
|
||||
UnitType &unitType3 = unitTypes[l];
|
||||
|
||||
if(unitType2->getName() == unitType3.getName()) {
|
||||
|
@ -563,7 +563,7 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
|
||||
// Now check that at least 1 other unit can produce, build or morph this unit
|
||||
bool foundUnit = false;
|
||||
for(int l=0; l<unitTypes.size() && foundUnit == false; ++l){
|
||||
for(int l=0; l < (int)unitTypes.size() && foundUnit == false; ++l){
|
||||
UnitType &unitType2 = unitTypes[l];
|
||||
|
||||
for(int j = 0; j < unitType2.getCommandTypeCount() && foundUnit == false; ++j) {
|
||||
|
@ -680,7 +680,7 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
std::vector<std::string> FactionType::validateFactionTypeResourceTypes(vector<ResourceType> &resourceTypes) {
|
||||
std::vector<std::string> results;
|
||||
|
||||
for(int i=0; i<unitTypes.size(); ++i) {
|
||||
for(int i=0; i < (int)unitTypes.size(); ++i) {
|
||||
UnitType &unitType = unitTypes[i];
|
||||
|
||||
// Check every unit's required resources to validate that for every resource-requirements
|
||||
|
@ -690,7 +690,7 @@ std::vector<std::string> FactionType::validateFactionTypeResourceTypes(vector<Re
|
|||
if(r != NULL && r->getType() != NULL) {
|
||||
bool foundResourceType = false;
|
||||
// Now lets find a matching faction resource type for the unit
|
||||
for(int k=0; k<resourceTypes.size(); ++k){
|
||||
for(int k=0; k < (int)resourceTypes.size(); ++k){
|
||||
ResourceType &rt = resourceTypes[k];
|
||||
|
||||
if(r->getType()->getName() == rt.getName()) {
|
||||
|
@ -714,7 +714,7 @@ std::vector<std::string> FactionType::validateFactionTypeResourceTypes(vector<Re
|
|||
if(r != NULL && r->getType() != NULL) {
|
||||
bool foundResourceType = false;
|
||||
// Now lets find a matching faction resource type for the unit
|
||||
for(int k=0; k<resourceTypes.size(); ++k){
|
||||
for(int k=0; k < (int)resourceTypes.size(); ++k){
|
||||
ResourceType &rt = resourceTypes[k];
|
||||
|
||||
if(r->getType()->getName() == rt.getName()) {
|
||||
|
@ -743,7 +743,7 @@ std::vector<std::string> FactionType::validateFactionTypeResourceTypes(vector<Re
|
|||
|
||||
bool foundResourceType = false;
|
||||
// Now lets find a matching faction resource type for the unit
|
||||
for(int k=0; k<resourceTypes.size(); ++k){
|
||||
for(int k=0; k < (int)resourceTypes.size(); ++k){
|
||||
ResourceType &rt = resourceTypes[k];
|
||||
|
||||
if(harvestResource->getName() == rt.getName()) {
|
||||
|
@ -771,12 +771,12 @@ std::vector<std::string> FactionType::validateFactionTypeUpgradeTypes() {
|
|||
|
||||
// For each upgrade type make sure there is at least 1 unit that can produce
|
||||
// the upgrade
|
||||
for(int i = 0; i < upgradeTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)upgradeTypes.size(); ++i) {
|
||||
const UpgradeType &upgradeType = upgradeTypes[i];
|
||||
|
||||
// First find a unit with a command type to upgrade to this Upgrade type
|
||||
bool foundUnit = false;
|
||||
for(int j=0; j<unitTypes.size() && foundUnit == false; ++j){
|
||||
for(int j=0; j < (int)unitTypes.size() && foundUnit == false; ++j){
|
||||
UnitType &unitType = unitTypes[j];
|
||||
for(int k = 0; k < unitType.getCommandTypeCount() && foundUnit == false; ++k) {
|
||||
const CommandType *cmdType = unitType.getCommandType(k);
|
||||
|
@ -811,19 +811,19 @@ std::vector<std::string> FactionType::validateFactionTypeUpgradeTypes() {
|
|||
// ==================== get ====================
|
||||
|
||||
const UnitType *FactionType::getUnitType(const string &name) const{
|
||||
for(int i=0; i<unitTypes.size();i++){
|
||||
for(int i=0; i < (int)unitTypes.size();i++){
|
||||
if(unitTypes[i].getName(false)==name){
|
||||
return &unitTypes[i];
|
||||
}
|
||||
}
|
||||
|
||||
printf("In [%s::%s Line: %d] scanning [%s] size = " MG_SIZE_T_SPECIFIER "\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),unitTypes.size());
|
||||
for(int i=0; i<unitTypes.size();i++){
|
||||
for(int i=0; i < (int)unitTypes.size();i++){
|
||||
printf("In [%s::%s Line: %d] scanning [%s] idx = %d [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),i,unitTypes[i].getName(false).c_str());
|
||||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] scanning [%s] size = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),unitTypes.size());
|
||||
for(int i=0; i<unitTypes.size();i++){
|
||||
for(int i=0; i < (int)unitTypes.size();i++){
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] scanning [%s] idx = %d [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),i,unitTypes[i].getName(false).c_str());
|
||||
}
|
||||
|
||||
|
@ -831,19 +831,19 @@ const UnitType *FactionType::getUnitType(const string &name) const{
|
|||
}
|
||||
|
||||
const UnitType *FactionType::getUnitTypeById(int id) const{
|
||||
for(int i=0; i<unitTypes.size();i++){
|
||||
for(int i=0; i < (int)unitTypes.size();i++){
|
||||
if(unitTypes[i].getId() == id) {
|
||||
return &unitTypes[i];
|
||||
}
|
||||
}
|
||||
|
||||
printf("In [%s::%s Line: %d] scanning [%d] size = " MG_SIZE_T_SPECIFIER "\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,id,unitTypes.size());
|
||||
for(int i=0; i<unitTypes.size();i++){
|
||||
for(int i=0; i < (int)unitTypes.size();i++){
|
||||
printf("In [%s::%s Line: %d] scanning [%s] idx = %d [%s][%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),i,unitTypes[i].getName(false).c_str(),unitTypes[i].getId());
|
||||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] scanning [%s] size = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),unitTypes.size());
|
||||
for(int i=0; i<unitTypes.size();i++){
|
||||
for(int i=0; i < (int)unitTypes.size();i++){
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] scanning [%s] idx = %d [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),i,unitTypes[i].getName(false).c_str());
|
||||
}
|
||||
|
||||
|
@ -851,19 +851,19 @@ const UnitType *FactionType::getUnitTypeById(int id) const{
|
|||
}
|
||||
|
||||
const UpgradeType *FactionType::getUpgradeType(const string &name) const{
|
||||
for(int i=0; i<upgradeTypes.size();i++){
|
||||
for(int i=0; i < (int)upgradeTypes.size();i++){
|
||||
if(upgradeTypes[i].getName()==name){
|
||||
return &upgradeTypes[i];
|
||||
}
|
||||
}
|
||||
|
||||
printf("In [%s::%s Line: %d] scanning [%s] size = " MG_SIZE_T_SPECIFIER "\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),unitTypes.size());
|
||||
for(int i=0; i<upgradeTypes.size();i++){
|
||||
for(int i=0; i < (int)upgradeTypes.size();i++){
|
||||
printf("In [%s::%s Line: %d] scanning [%s] idx = %d [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),i,upgradeTypes[i].getName().c_str());
|
||||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] scanning [%s] size = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),unitTypes.size());
|
||||
for(int i=0; i<upgradeTypes.size();i++){
|
||||
for(int i=0; i < (int)upgradeTypes.size();i++){
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] scanning [%s] idx = %d [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),i,upgradeTypes[i].getName().c_str());
|
||||
}
|
||||
|
||||
|
@ -871,7 +871,7 @@ const UpgradeType *FactionType::getUpgradeType(const string &name) const{
|
|||
}
|
||||
|
||||
int FactionType::getStartingResourceAmount(const ResourceType *resourceType) const{
|
||||
for(int i=0; i<startingResources.size(); ++i){
|
||||
for(int i=0; i < (int)startingResources.size(); ++i){
|
||||
if(startingResources[i].getType()==resourceType){
|
||||
return startingResources[i].getAmount();
|
||||
}
|
||||
|
@ -880,7 +880,7 @@ int FactionType::getStartingResourceAmount(const ResourceType *resourceType) con
|
|||
}
|
||||
|
||||
void FactionType::deletePixels() {
|
||||
for(int i = 0; i <unitTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)unitTypes.size(); ++i) {
|
||||
UnitType &unitType = unitTypes[i];
|
||||
Texture2D *texture = unitType.getMeetingPointImage();
|
||||
if(texture != NULL) {
|
||||
|
@ -892,7 +892,7 @@ void FactionType::deletePixels() {
|
|||
bool FactionType::factionUsesResourceType(const ResourceType *rt) const {
|
||||
bool factionUsesResourceType = false;
|
||||
if(rt != NULL) {
|
||||
for(unsigned int j = 0; factionUsesResourceType == false && j < this->getUnitTypeCount(); ++j) {
|
||||
for(unsigned int j = 0; factionUsesResourceType == false && j < (unsigned int)this->getUnitTypeCount(); ++j) {
|
||||
const UnitType *ut= this->getUnitType(j);
|
||||
for(int k = 0; factionUsesResourceType == false && k < ut->getCostCount(); ++k) {
|
||||
const Resource *costResource = ut->getCost(k);
|
||||
|
@ -905,12 +905,12 @@ bool FactionType::factionUsesResourceType(const ResourceType *rt) const {
|
|||
}
|
||||
}
|
||||
if(factionUsesResourceType == false) {
|
||||
for(unsigned int k = 0; factionUsesResourceType == false && k < ut->getCommandTypeCount(); ++k) {
|
||||
for(unsigned int k = 0; factionUsesResourceType == false && k < (unsigned int)ut->getCommandTypeCount(); ++k) {
|
||||
const CommandType *commandType = ut->getCommandType(k);
|
||||
if(commandType != NULL && commandType->getClass() == ccHarvest) {
|
||||
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType *>(commandType);
|
||||
if(hct != NULL && hct->getHarvestedResourceCount() > 0) {
|
||||
for(unsigned int l = 0; factionUsesResourceType == false && l < hct->getHarvestedResourceCount(); ++l) {
|
||||
for(unsigned int l = 0; factionUsesResourceType == false && l < (unsigned int)hct->getHarvestedResourceCount(); ++l) {
|
||||
//printf("#2 factionUsesResourceType, unit [%s] resource [%s] harvest [%s]\n",ut->getName().c_str(),rt->getName().c_str(),hct->getHarvestedResource(l)->getName().c_str());
|
||||
|
||||
if(hct->getHarvestedResource(l)->getName() == rt->getName()) {
|
||||
|
@ -931,12 +931,12 @@ std::string FactionType::toString() const {
|
|||
std::string result = "Faction Name: " + name + "\n";
|
||||
|
||||
result += "Unit Type List count = " + intToStr(this->getUnitTypeCount()) + "\n";
|
||||
for(int i=0; i<unitTypes.size();i++) {
|
||||
for(int i=0; i < (int)unitTypes.size();i++) {
|
||||
result += unitTypes[i].toString() + "\n";
|
||||
}
|
||||
|
||||
result += "Upgrade Type List count = " + intToStr(this->getUpgradeTypeCount()) + "\n";
|
||||
for(int i=0; i<upgradeTypes.size();i++) {
|
||||
for(int i=0; i < (int)upgradeTypes.size();i++) {
|
||||
result += "index: " + intToStr(i) + " " + upgradeTypes[i].getReqDesc(false) + "\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ TilesetModelType* ObjectType::loadModel(const string &path, std::map<string,vect
|
|||
}
|
||||
|
||||
void ObjectType::deletePixels() {
|
||||
for(int i = 0; i < modeltypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)modeltypes.size(); ++i) {
|
||||
TilesetModelType *model = modeltypes[i];
|
||||
if(model->getModel() != NULL) {
|
||||
model->getModel()->deletePixels();
|
||||
|
|
|
@ -120,7 +120,7 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
|
|||
const XmlNode *particleNode= modelNode->getChild("particles");
|
||||
bool particleEnabled= particleNode->getAttribute("value")->getBoolValue();
|
||||
if(particleEnabled == true) {
|
||||
for(int k= 0; k < particleNode->getChildCount(); ++k) {
|
||||
for(int k= 0; k < (int)particleNode->getChildCount(); ++k) {
|
||||
const XmlNode *particleFileNode= particleNode->getChild("particle-file", k);
|
||||
string particlePath= particleFileNode->getAttribute("path")->getRestrictedValue();
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ string AttackBoost::getDesc(bool translatedValue) const{
|
|||
}
|
||||
|
||||
if(boostUnitList.empty() == false) {
|
||||
for(int i=0; i<boostUnitList.size(); ++i){
|
||||
for(int i=0; i < (int)boostUnitList.size(); ++i){
|
||||
str+= " "+boostUnitList[i]->getName(translatedValue)+"\n";
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ const XmlNode * SkillType::findAttackBoostDetails(string attackBoostName,
|
|||
const XmlNode *result = attackBoostNode;
|
||||
|
||||
if(attackBoostsNode != NULL && attackBoostName != "") {
|
||||
for(int i = 0; i < attackBoostsNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)attackBoostsNode->getChildCount(); ++i) {
|
||||
const XmlNode *abn= attackBoostsNode->getChild("attack-boost", i);
|
||||
|
||||
string sharedName = abn->getAttribute("name")->getRestrictedValue();
|
||||
|
@ -303,35 +303,35 @@ void SkillType::loadAttackBoost(const XmlNode *attackBoostsNode, const XmlNode *
|
|||
|
||||
if(targetType == "ally") {
|
||||
attackBoost.targetType = abtAlly;
|
||||
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
|
||||
for(int i = 0;i < (int)attackBoostNode->getChild("target")->getChildCount();++i) {
|
||||
const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i);
|
||||
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
|
||||
}
|
||||
}
|
||||
else if(targetType == "foe") {
|
||||
attackBoost.targetType = abtFoe;
|
||||
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
|
||||
for(int i = 0;i < (int)attackBoostNode->getChild("target")->getChildCount();++i) {
|
||||
const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i);
|
||||
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
|
||||
}
|
||||
}
|
||||
else if(targetType == "faction") {
|
||||
attackBoost.targetType = abtFaction;
|
||||
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
|
||||
for(int i = 0;i < (int)attackBoostNode->getChild("target")->getChildCount();++i) {
|
||||
const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i);
|
||||
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
|
||||
}
|
||||
}
|
||||
else if(targetType == "unit-types") {
|
||||
attackBoost.targetType = abtUnitTypes;
|
||||
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
|
||||
for(int i = 0;i < (int)attackBoostNode->getChild("target")->getChildCount();++i) {
|
||||
const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i);
|
||||
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
|
||||
}
|
||||
}
|
||||
else if(targetType == "all") {
|
||||
attackBoost.targetType = abtAll;
|
||||
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
|
||||
for(int i = 0;i < (int)attackBoostNode->getChild("target")->getChildCount();++i) {
|
||||
const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i);
|
||||
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ void SkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
|||
const XmlNode *particleNode= sn->getChild("particles");
|
||||
bool particleEnabled= particleNode->getAttribute("value")->getBoolValue();
|
||||
if(particleEnabled) {
|
||||
for(int i = 0; i < particleNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)particleNode->getChildCount(); ++i) {
|
||||
const XmlNode *particleFileNode= particleNode->getChild("particle-file", i);
|
||||
string path= particleFileNode->getAttribute("path")->getRestrictedValue();
|
||||
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
|
||||
|
@ -479,7 +479,7 @@ void SkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
|||
if(soundNode->getAttribute("enabled")->getBoolValue()) {
|
||||
soundStartTime= soundNode->getAttribute("start-time")->getFloatValue();
|
||||
sounds.resize((int)soundNode->getChildCount());
|
||||
for(int i = 0; i < soundNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)soundNode->getChildCount(); ++i) {
|
||||
const XmlNode *soundFileNode= soundNode->getChild("sound-file", i);
|
||||
string path= soundFileNode->getAttribute("path")->getRestrictedValue(currentPath, true);
|
||||
|
||||
|
@ -789,7 +789,7 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
|||
}
|
||||
//attack fields
|
||||
const XmlNode *attackFieldsNode= sn->getChild("attack-fields");
|
||||
for(int i=0; i<attackFieldsNode->getChildCount(); ++i){
|
||||
for(int i=0; i < (int)attackFieldsNode->getChildCount(); ++i){
|
||||
const XmlNode *fieldNode= attackFieldsNode->getChild("field", i);
|
||||
string fieldName= fieldNode->getAttribute("value")->getRestrictedValue();
|
||||
if(fieldName=="land"){
|
||||
|
@ -824,7 +824,7 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
|||
if(soundNode->getAttribute("enabled")->getBoolValue()){
|
||||
|
||||
projSounds.resize((int)soundNode->getChildCount());
|
||||
for(int i=0; i<soundNode->getChildCount(); ++i){
|
||||
for(int i=0; i < (int)soundNode->getChildCount(); ++i){
|
||||
const XmlNode *soundFileNode= soundNode->getChild("sound-file", i);
|
||||
string path= soundFileNode->getAttribute("path")->getRestrictedValue(currentPath, true);
|
||||
//printf("\n\n\n\n!@#$ ---> parentLoader [%s] path [%s] nodeValue [%s] i = %d",parentLoader.c_str(),path.c_str(),soundFileNode->getAttribute("path")->getRestrictedValue().c_str(),i);
|
||||
|
|
|
@ -222,7 +222,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||
findAll(str, filenames);
|
||||
resourceTypes.resize(filenames.size());
|
||||
|
||||
for(int i=0; i<filenames.size(); ++i){
|
||||
for(int i = 0; i < (int)filenames.size(); ++i){
|
||||
str= currentPath + "resources/" + filenames[i];
|
||||
resourceTypes[i].load(str, checksum, &checksumValue, loadedFileList,
|
||||
treePath);
|
||||
|
@ -231,7 +231,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||
}
|
||||
|
||||
// Cleanup pixmap memory
|
||||
for(int i = 0; i < filenames.size(); ++i) {
|
||||
for(int i = 0; i < (int)filenames.size(); ++i) {
|
||||
resourceTypes[i].deletePixels();
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||
//attack types
|
||||
const XmlNode *attackTypesNode= techTreeNode->getChild("attack-types");
|
||||
attackTypes.resize(attackTypesNode->getChildCount());
|
||||
for(int i = 0; i < attackTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)attackTypes.size(); ++i) {
|
||||
const XmlNode *attackTypeNode= attackTypesNode->getChild("attack-type", i);
|
||||
attackTypes[i].setName(attackTypeNode->getAttribute("name")->getRestrictedValue());
|
||||
attackTypes[i].setId(i);
|
||||
|
@ -284,7 +284,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||
//armor types
|
||||
const XmlNode *armorTypesNode= techTreeNode->getChild("armor-types");
|
||||
armorTypes.resize(armorTypesNode->getChildCount());
|
||||
for(int i = 0; i < armorTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)armorTypes.size(); ++i) {
|
||||
const XmlNode *armorTypeNode= armorTypesNode->getChild("armor-type", i);
|
||||
armorTypes[i].setName(armorTypeNode->getAttribute("name")->getRestrictedValue());
|
||||
armorTypes[i].setId(i);
|
||||
|
@ -296,7 +296,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||
//damage multipliers
|
||||
damageMultiplierTable.init((int)attackTypes.size(), (int)armorTypes.size());
|
||||
const XmlNode *damageMultipliersNode= techTreeNode->getChild("damage-multipliers");
|
||||
for(int i = 0; i < damageMultipliersNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)damageMultipliersNode->getChildCount(); ++i) {
|
||||
const XmlNode *damageMultiplierNode= damageMultipliersNode->getChild("damage-multiplier", i);
|
||||
const AttackType *attackType= getAttackType(damageMultiplierNode->getAttribute("attack")->getRestrictedValue());
|
||||
const ArmorType *armorType= getArmorType(damageMultiplierNode->getAttribute("armor")->getRestrictedValue());
|
||||
|
@ -370,7 +370,7 @@ TechTree::~TechTree() {
|
|||
|
||||
std::vector<std::string> TechTree::validateFactionTypes() {
|
||||
std::vector<std::string> results;
|
||||
for (int i = 0; i < factionTypes.size(); ++i) {
|
||||
for (int i = 0; i < (int)factionTypes.size(); ++i) {
|
||||
std::vector<std::string> factionResults = factionTypes[i].validateFactionType();
|
||||
if(factionResults.empty() == false) {
|
||||
results.insert(results.end(), factionResults.begin(), factionResults.end());
|
||||
|
@ -429,7 +429,7 @@ std::vector<std::string> TechTree::validateResourceTypes() {
|
|||
// ==================== get ====================
|
||||
|
||||
FactionType *TechTree::getTypeByName(const string &name) {
|
||||
for(int i=0; i < factionTypes.size(); ++i) {
|
||||
for(int i=0; i < (int)factionTypes.size(); ++i) {
|
||||
if(factionTypes[i].getName(false) == name) {
|
||||
return &factionTypes[i];
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ FactionType *TechTree::getTypeByName(const string &name) {
|
|||
}
|
||||
|
||||
const FactionType *TechTree::getType(const string &name) const {
|
||||
for(int i=0; i < factionTypes.size(); ++i) {
|
||||
for(int i=0; i < (int)factionTypes.size(); ++i) {
|
||||
if(factionTypes[i].getName(false) == name) {
|
||||
return &factionTypes[i];
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ const ResourceType *TechTree::getFirstTechResourceType() const{
|
|||
|
||||
const ResourceType *TechTree::getResourceType(const string &name) const{
|
||||
|
||||
for(int i=0; i<resourceTypes.size(); ++i){
|
||||
for(int i=0; i < (int)resourceTypes.size(); ++i){
|
||||
if(resourceTypes[i].getName()==name){
|
||||
return &resourceTypes[i];
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ const ResourceType *TechTree::getResourceType(const string &name) const{
|
|||
}
|
||||
|
||||
const ArmorType *TechTree::getArmorType(const string &name) const{
|
||||
for(int i=0; i<armorTypes.size(); ++i){
|
||||
for(int i=0; i < (int)armorTypes.size(); ++i){
|
||||
if(armorTypes[i].getName(false)==name){
|
||||
return &armorTypes[i];
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ const ArmorType *TechTree::getArmorType(const string &name) const{
|
|||
}
|
||||
|
||||
const AttackType *TechTree::getAttackType(const string &name) const{
|
||||
for(int i=0; i<attackTypes.size(); ++i){
|
||||
for(int i=0; i < (int)attackTypes.size(); ++i){
|
||||
if(attackTypes[i].getName(false)==name){
|
||||
return &attackTypes[i];
|
||||
}
|
||||
|
|
|
@ -282,10 +282,10 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
for(int i=0; i<size; ++i){
|
||||
const XmlNode *rowNode= cellMapNode->getChild("row", i);
|
||||
string row= rowNode->getAttribute("value")->getRestrictedValue();
|
||||
if(row.size()!=size){
|
||||
if((int)row.size() != size){
|
||||
throw megaglest_runtime_error("Cellmap row has not the same length as unit size",validationMode);
|
||||
}
|
||||
for(int j=0; j<row.size(); ++j){
|
||||
for(int j=0; j < (int)row.size(); ++j){
|
||||
cellMap[i*size+j]= row[j]=='0'? false: true;
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
//levels
|
||||
const XmlNode *levelsNode= parametersNode->getChild("levels");
|
||||
levels.resize(levelsNode->getChildCount());
|
||||
for(int i=0; i<levels.size(); ++i){
|
||||
for(int i=0; i < (int)levels.size(); ++i){
|
||||
const XmlNode *levelNode= levelsNode->getChild("level", i);
|
||||
|
||||
levels[i].init(
|
||||
|
@ -304,7 +304,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
|
||||
//fields
|
||||
const XmlNode *fieldsNode= parametersNode->getChild("fields");
|
||||
for(int i=0; i<fieldsNode->getChildCount(); ++i){
|
||||
for(int i=0; i < (int)fieldsNode->getChildCount(); ++i){
|
||||
const XmlNode *fieldNode= fieldsNode->getChild("field", i);
|
||||
string fieldName= fieldNode->getAttribute("value")->getRestrictedValue();
|
||||
if(fieldName=="land"){
|
||||
|
@ -330,7 +330,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
|
||||
//properties
|
||||
const XmlNode *propertiesNode= parametersNode->getChild("properties");
|
||||
for(int i = 0; i < propertiesNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)propertiesNode->getChildCount(); ++i) {
|
||||
const XmlNode *propertyNode= propertiesNode->getChild("property", i);
|
||||
string propertyName= propertyNode->getAttribute("value")->getRestrictedValue();
|
||||
bool found= false;
|
||||
|
@ -351,7 +351,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
bool particleEnabled= particleNode->getAttribute("value")->getBoolValue();
|
||||
|
||||
if(particleEnabled) {
|
||||
for(int i = 0; i < particleNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)particleNode->getChildCount(); ++i) {
|
||||
const XmlNode *particleFileNode= particleNode->getChild("particle-file", i);
|
||||
string path= particleFileNode->getAttribute("path")->getRestrictedValue();
|
||||
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
|
||||
|
@ -401,7 +401,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
//unit requirements
|
||||
bool hasDup = false;
|
||||
const XmlNode *unitRequirementsNode= parametersNode->getChild("unit-requirements");
|
||||
for(int i=0; i<unitRequirementsNode->getChildCount(); ++i){
|
||||
for(int i=0; i < (int)unitRequirementsNode->getChildCount(); ++i){
|
||||
const XmlNode *unitNode= unitRequirementsNode->getChild("unit", i);
|
||||
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
||||
|
||||
|
@ -424,7 +424,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
|
||||
//upgrade requirements
|
||||
const XmlNode *upgradeRequirementsNode= parametersNode->getChild("upgrade-requirements");
|
||||
for(int i=0; i<upgradeRequirementsNode->getChildCount(); ++i){
|
||||
for(int i=0; i < (int)upgradeRequirementsNode->getChildCount(); ++i){
|
||||
const XmlNode *upgradeReqNode= upgradeRequirementsNode->getChild("upgrade", i);
|
||||
string name= upgradeReqNode->getAttribute("name")->getRestrictedValue();
|
||||
|
||||
|
@ -449,7 +449,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
//resource requirements
|
||||
const XmlNode *resourceRequirementsNode= parametersNode->getChild("resource-requirements");
|
||||
costs.resize(resourceRequirementsNode->getChildCount());
|
||||
for(int i = 0; i < costs.size(); ++i) {
|
||||
for(int i = 0; i < (int)costs.size(); ++i) {
|
||||
const XmlNode *resourceNode= resourceRequirementsNode->getChild("resource", i);
|
||||
string name= resourceNode->getAttribute("name")->getRestrictedValue();
|
||||
int amount= resourceNode->getAttribute("amount")->getIntValue();
|
||||
|
@ -490,7 +490,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
//resources stored
|
||||
const XmlNode *resourcesStoredNode= parametersNode->getChild("resources-stored");
|
||||
storedResources.resize(resourcesStoredNode->getChildCount());
|
||||
for(int i=0; i<storedResources.size(); ++i){
|
||||
for(int i=0; i < (int)storedResources.size(); ++i){
|
||||
const XmlNode *resourceNode= resourcesStoredNode->getChild("resource", i);
|
||||
string name= resourceNode->getAttribute("name")->getRestrictedValue();
|
||||
int amount= resourceNode->getAttribute("amount")->getIntValue();
|
||||
|
@ -597,7 +597,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
const XmlNode *selectionSoundNode= parametersNode->getChild("selection-sounds");
|
||||
if(selectionSoundNode->getAttribute("enabled")->getBoolValue()){
|
||||
selectionSounds.resize((int)selectionSoundNode->getChildCount());
|
||||
for(int i = 0; i < selectionSounds.getSounds().size(); ++i) {
|
||||
for(int i = 0; i < (int)selectionSounds.getSounds().size(); ++i) {
|
||||
const XmlNode *soundNode= selectionSoundNode->getChild("sound", i);
|
||||
string path= soundNode->getAttribute("path")->getRestrictedValue(currentPath);
|
||||
StaticSound *sound= new StaticSound();
|
||||
|
@ -611,7 +611,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
const XmlNode *commandSoundNode= parametersNode->getChild("command-sounds");
|
||||
if(commandSoundNode->getAttribute("enabled")->getBoolValue()) {
|
||||
commandSounds.resize((int)commandSoundNode->getChildCount());
|
||||
for(int i = 0; i < commandSoundNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)commandSoundNode->getChildCount(); ++i) {
|
||||
const XmlNode *soundNode= commandSoundNode->getChild("sound", i);
|
||||
string path= soundNode->getAttribute("path")->getRestrictedValue(currentPath);
|
||||
StaticSound *sound= new StaticSound();
|
||||
|
@ -634,7 +634,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
snprintf(szBuf,8096,Lang::getInstance().getString("LogScreenGameLoadingUnitTypeSkills","",true).c_str(),formatString(this->getName(true)).c_str(),skillTypes.size());
|
||||
Logger::getInstance().add(szBuf, true);
|
||||
|
||||
for(int i = 0; i < skillTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)skillTypes.size(); ++i) {
|
||||
const XmlNode *sn= skillsNode->getChild("skill", i);
|
||||
const XmlNode *typeNode= sn->getChild("type");
|
||||
string classId= typeNode->getAttribute("value")->getRestrictedValue();
|
||||
|
@ -658,7 +658,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
//commands
|
||||
const XmlNode *commandsNode= unitNode->getChild("commands");
|
||||
commandTypes.resize(commandsNode->getChildCount());
|
||||
for(int i = 0; i < commandTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)commandTypes.size(); ++i) {
|
||||
const XmlNode *commandNode= commandsNode->getChild("command", i);
|
||||
const XmlNode *typeNode= commandNode->getChild("type");
|
||||
string classId= typeNode->getAttribute("value")->getRestrictedValue();
|
||||
|
@ -755,7 +755,7 @@ const SkillType *UnitType::getFirstStOfClass(SkillClass skillClass) const{
|
|||
}
|
||||
|
||||
const HarvestCommandType *UnitType::getFirstHarvestCommand(const ResourceType *resourceType, const Faction *faction) const {
|
||||
for(int i = 0; i < commandTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)commandTypes.size(); ++i) {
|
||||
if(commandTypes[i]->getClass() == ccHarvest) {
|
||||
const HarvestCommandType *hct = static_cast<const HarvestCommandType*>(commandTypes[i]);
|
||||
|
||||
|
@ -779,7 +779,7 @@ const HarvestEmergencyReturnCommandType *UnitType::getFirstHarvestEmergencyRetur
|
|||
const AttackCommandType *UnitType::getFirstAttackCommand(Field field) const{
|
||||
//printf("$$$ Unit [%s] commandTypes.size() = %d\n",this->getName().c_str(),(int)commandTypes.size());
|
||||
|
||||
for(int i = 0; i < commandTypes.size(); ++i){
|
||||
for(int i = 0; i < (int)commandTypes.size(); ++i){
|
||||
if(commandTypes[i] == NULL) {
|
||||
throw megaglest_runtime_error("commandTypes[i] == NULL");
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ const AttackCommandType *UnitType::getFirstAttackCommand(Field field) const{
|
|||
const AttackStoppedCommandType *UnitType::getFirstAttackStoppedCommand(Field field) const{
|
||||
//printf("$$$ Unit [%s] commandTypes.size() = %d\n",this->getName().c_str(),(int)commandTypes.size());
|
||||
|
||||
for(int i = 0; i < commandTypes.size(); ++i){
|
||||
for(int i = 0; i < (int)commandTypes.size(); ++i){
|
||||
if(commandTypes[i] == NULL) {
|
||||
throw megaglest_runtime_error("commandTypes[i] == NULL");
|
||||
}
|
||||
|
@ -819,7 +819,7 @@ const AttackStoppedCommandType *UnitType::getFirstAttackStoppedCommand(Field fie
|
|||
}
|
||||
|
||||
const RepairCommandType *UnitType::getFirstRepairCommand(const UnitType *repaired) const{
|
||||
for(int i=0; i<commandTypes.size(); ++i){
|
||||
for(int i=0; i < (int)commandTypes.size(); ++i){
|
||||
if(commandTypes[i]->getClass()== ccRepair){
|
||||
const RepairCommandType *rct= static_cast<const RepairCommandType*>(commandTypes[i]);
|
||||
if(rct->isRepairableUnitType(repaired)){
|
||||
|
@ -895,7 +895,7 @@ bool UnitType::getCellMapCell(int x, int y, CardinalDir facing) const {
|
|||
}
|
||||
|
||||
int UnitType::getStore(const ResourceType *rt) const{
|
||||
for(int i=0; i<storedResources.size(); ++i){
|
||||
for(int i=0; i < (int)storedResources.size(); ++i){
|
||||
if(storedResources[i].getType()==rt){
|
||||
return storedResources[i].getAmount();
|
||||
}
|
||||
|
@ -904,7 +904,7 @@ int UnitType::getStore(const ResourceType *rt) const{
|
|||
}
|
||||
|
||||
const SkillType *UnitType::getSkillType(const string &skillName, SkillClass skillClass) const{
|
||||
for(int i=0; i<skillTypes.size(); ++i){
|
||||
for(int i=0; i < (int)skillTypes.size(); ++i){
|
||||
if(skillTypes[i]->getName()==skillName){
|
||||
if(skillTypes[i]->getClass()==skillClass){
|
||||
return skillTypes[i];
|
||||
|
@ -975,7 +975,7 @@ bool UnitType::hasCommandType(const CommandType *commandType) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
for(int i=0; i<commandTypes.size(); ++i) {
|
||||
for(int i=0; i < (int)commandTypes.size(); ++i) {
|
||||
if(commandTypes[i]==commandType) {
|
||||
return true;
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ bool UnitType::hasCommandType(const CommandType *commandType) const {
|
|||
|
||||
bool UnitType::hasSkillType(const SkillType *skillType) const {
|
||||
assert(skillType!=NULL);
|
||||
for(int i=0; i<skillTypes.size(); ++i) {
|
||||
for(int i=0; i < (int)skillTypes.size(); ++i) {
|
||||
if(skillTypes[i]==skillType) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1013,7 +1013,7 @@ bool UnitType::isOfClass(UnitClass uc) const{
|
|||
void UnitType::computeFirstStOfClass() {
|
||||
for(int j= 0; j < scCount; ++j) {
|
||||
firstSkillTypeOfClass[j]= NULL;
|
||||
for(int i= 0; i < skillTypes.size(); ++i) {
|
||||
for(int i= 0; i < (int)skillTypes.size(); ++i) {
|
||||
if(skillTypes[i] != NULL && skillTypes[i]->getClass()== SkillClass(j)) {
|
||||
firstSkillTypeOfClass[j]= skillTypes[i];
|
||||
break;
|
||||
|
@ -1025,7 +1025,7 @@ void UnitType::computeFirstStOfClass() {
|
|||
void UnitType::computeFirstCtOfClass() {
|
||||
for(int j = 0; j < ccCount; ++j) {
|
||||
firstCommandTypeOfClass[j]= NULL;
|
||||
for(int i = 0; i < commandTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)commandTypes.size(); ++i) {
|
||||
if(commandTypes[i] != NULL && commandTypes[i]->getClass() == CommandClass(j)) {
|
||||
firstCommandTypeOfClass[j] = commandTypes[i];
|
||||
break;
|
||||
|
@ -1050,7 +1050,7 @@ const CommandType* UnitType::findCommandTypeById(int id) const{
|
|||
}
|
||||
|
||||
const CommandType *UnitType::getCommandType(int i) const {
|
||||
if(i >= commandTypes.size()) {
|
||||
if(i >= (int)commandTypes.size()) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] i >= commandTypes.size(), i = %d, commandTypes.size() = " MG_SIZE_T_SPECIFIER "",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,commandTypes.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1131,22 +1131,22 @@ std::string UnitType::toString() const {
|
|||
}
|
||||
|
||||
result += " skillTypes: [" + intToStr(skillTypes.size()) + "]";
|
||||
for(int i = 0; i < skillTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)skillTypes.size(); ++i) {
|
||||
result += " i = " + intToStr(i) + " " + skillTypes[i]->toString(false);
|
||||
}
|
||||
|
||||
result += " commandTypes: [" + intToStr(commandTypes.size()) + "]";
|
||||
for(int i = 0; i < commandTypes.size(); ++i) {
|
||||
for(int i = 0; i < (int)commandTypes.size(); ++i) {
|
||||
result += " i = " + intToStr(i) + " " + commandTypes[i]->toString(false);
|
||||
}
|
||||
|
||||
result += " storedResources: [" + intToStr(storedResources.size()) + "]";
|
||||
for(int i = 0; i < storedResources.size(); ++i) {
|
||||
for(int i = 0; i < (int)storedResources.size(); ++i) {
|
||||
result += " i = " + intToStr(i) + " " + storedResources[i].getDescription(false);
|
||||
}
|
||||
|
||||
result += " levels: [" + intToStr(levels.size()) + "]";
|
||||
for(int i = 0; i < levels.size(); ++i) {
|
||||
for(int i = 0; i < (int)levels.size(); ++i) {
|
||||
result += " i = " + intToStr(i) + " " + levels[i].getName();
|
||||
}
|
||||
|
||||
|
|
|
@ -625,7 +625,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
|
|||
//unit requirements
|
||||
bool hasDup = false;
|
||||
const XmlNode *unitRequirementsNode= upgradeNode->getChild("unit-requirements");
|
||||
for(int i = 0; i < unitRequirementsNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)unitRequirementsNode->getChildCount(); ++i) {
|
||||
const XmlNode *unitNode= unitRequirementsNode->getChild("unit", i);
|
||||
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
||||
|
||||
|
@ -649,7 +649,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
|
|||
|
||||
//upgrade requirements
|
||||
const XmlNode *upgradeRequirementsNode= upgradeNode->getChild("upgrade-requirements");
|
||||
for(int i = 0; i < upgradeRequirementsNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)upgradeRequirementsNode->getChildCount(); ++i) {
|
||||
const XmlNode *upgradeReqNode= upgradeRequirementsNode->getChild("upgrade", i);
|
||||
string name= upgradeReqNode->getAttribute("name")->getRestrictedValue();
|
||||
|
||||
|
@ -676,7 +676,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
|
|||
const XmlNode *resourceRequirementsNode= upgradeNode->getChild("resource-requirements");
|
||||
|
||||
costs.resize(resourceRequirementsNode->getChildCount());
|
||||
for(int i = 0; i < costs.size(); ++i) {
|
||||
for(int i = 0; i < (int)costs.size(); ++i) {
|
||||
const XmlNode *resourceNode= resourceRequirementsNode->getChild("resource", i);
|
||||
string name= resourceNode->getAttribute("name")->getRestrictedValue();
|
||||
int amount= resourceNode->getAttribute("amount")->getIntValue();
|
||||
|
@ -720,7 +720,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
|
|||
|
||||
//effects
|
||||
const XmlNode *effectsNode= upgradeNode->getChild("effects");
|
||||
for(int i = 0; i < effectsNode->getChildCount(); ++i) {
|
||||
for(int i = 0; i < (int)effectsNode->getChildCount(); ++i) {
|
||||
const XmlNode *unitNode= effectsNode->getChild("unit", i);
|
||||
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
||||
|
||||
|
@ -877,7 +877,7 @@ void TotalUpgrade::sum(const UpgradeTypeBase *ut, const Unit *unit) {
|
|||
}
|
||||
|
||||
if(ut->getAttackStrengthIsMultiplier() == true) {
|
||||
for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) {
|
||||
const SkillType *skillType = unit->getType()->getSkillType(i);
|
||||
const AttackSkillType *ast = dynamic_cast<const AttackSkillType *>(skillType);
|
||||
if(ast != NULL) {
|
||||
|
@ -890,7 +890,7 @@ void TotalUpgrade::sum(const UpgradeTypeBase *ut, const Unit *unit) {
|
|||
}
|
||||
|
||||
if(ut->getAttackRangeIsMultiplier() == true) {
|
||||
for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) {
|
||||
const SkillType *skillType = unit->getType()->getSkillType(i);
|
||||
const AttackSkillType *ast = dynamic_cast<const AttackSkillType *>(skillType);
|
||||
if(ast != NULL) {
|
||||
|
@ -905,7 +905,7 @@ void TotalUpgrade::sum(const UpgradeTypeBase *ut, const Unit *unit) {
|
|||
if(ut->getMoveSpeedIsMultiplier() == true) {
|
||||
//printf("BEFORE Applying moveSpeedIsMultiplier\n");
|
||||
|
||||
for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) {
|
||||
const SkillType *skillType = unit->getType()->getSkillType(i);
|
||||
const MoveSkillType *mst = dynamic_cast<const MoveSkillType *>(skillType);
|
||||
if(mst != NULL) {
|
||||
|
@ -922,7 +922,7 @@ void TotalUpgrade::sum(const UpgradeTypeBase *ut, const Unit *unit) {
|
|||
}
|
||||
|
||||
if(ut->getProdSpeedIsMultiplier() == true) {
|
||||
for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) {
|
||||
const SkillType *skillType = unit->getType()->getSkillType(i);
|
||||
const ProduceSkillType *pst = dynamic_cast<const ProduceSkillType *>(skillType);
|
||||
if(pst != NULL) {
|
||||
|
@ -1007,7 +1007,7 @@ void TotalUpgrade::deapply(const UpgradeTypeBase *ut,const Unit *unit) {
|
|||
enforceMinimumValue(0,armor);
|
||||
|
||||
if(ut->getAttackStrengthIsMultiplier() == true) {
|
||||
for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) {
|
||||
const SkillType *skillType = unit->getType()->getSkillType(i);
|
||||
const AttackSkillType *ast = dynamic_cast<const AttackSkillType *>(skillType);
|
||||
if(ast != NULL) {
|
||||
|
@ -1023,7 +1023,7 @@ void TotalUpgrade::deapply(const UpgradeTypeBase *ut,const Unit *unit) {
|
|||
|
||||
|
||||
if(ut->getAttackRangeIsMultiplier() == true) {
|
||||
for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) {
|
||||
const SkillType *skillType = unit->getType()->getSkillType(i);
|
||||
const AttackSkillType *ast = dynamic_cast<const AttackSkillType *>(skillType);
|
||||
if(ast != NULL) {
|
||||
|
@ -1040,7 +1040,7 @@ void TotalUpgrade::deapply(const UpgradeTypeBase *ut,const Unit *unit) {
|
|||
if(ut->getMoveSpeedIsMultiplier() == true) {
|
||||
//printf("BEFORE Applying moveSpeedIsMultiplier, moveSpeed = %d, ut->getMoveSpeed() = %d\n",moveSpeed,ut->getMoveSpeed());
|
||||
|
||||
for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) {
|
||||
const SkillType *skillType = unit->getType()->getSkillType(i);
|
||||
const MoveSkillType *mst = dynamic_cast<const MoveSkillType *>(skillType);
|
||||
if(mst != NULL) {
|
||||
|
@ -1057,7 +1057,7 @@ void TotalUpgrade::deapply(const UpgradeTypeBase *ut,const Unit *unit) {
|
|||
}
|
||||
|
||||
if(ut->getProdSpeedIsMultiplier() == true) {
|
||||
for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) {
|
||||
const SkillType *skillType = unit->getType()->getSkillType(i);
|
||||
const ProduceSkillType *pst = dynamic_cast<const ProduceSkillType *>(skillType);
|
||||
if(pst != NULL) {
|
||||
|
|
|
@ -101,7 +101,7 @@ void Cell::loadGame(const XmlNode *rootNode, int index, World *world) {
|
|||
if(rootNode->hasChild("Cell" + intToStr(index)) == true) {
|
||||
const XmlNode *cellNode = rootNode->getChild("Cell" + intToStr(index));
|
||||
|
||||
int unitCount = (int)cellNode->getChildCount();
|
||||
unsigned int unitCount = (unsigned int)cellNode->getChildCount();
|
||||
for(unsigned int i = 0; i < unitCount; ++i) {
|
||||
if(cellNode->hasChildAtIndex("units",i) == true) {
|
||||
const XmlNode *unitsNode = cellNode->getChild("units",i);
|
||||
|
@ -844,7 +844,7 @@ bool Map::canOccupy(const Vec2i &pos, Field field, const UnitType *ut, CardinalD
|
|||
}
|
||||
}
|
||||
else {
|
||||
false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1702,7 +1702,7 @@ string Map::getMapPath(const string &mapName, string scenarioDir, bool errorOnNo
|
|||
Config &config = Config::getInstance();
|
||||
vector<string> pathList = config.getPathListForType(ptMaps,scenarioDir);
|
||||
|
||||
for(int idx = 0; idx < pathList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)pathList.size(); idx++) {
|
||||
string map_path = pathList[idx];
|
||||
endPathWithSlash(map_path);
|
||||
|
||||
|
@ -1760,7 +1760,7 @@ void Map::saveGame(XmlNode *rootNode) const {
|
|||
string exploredList = "";
|
||||
string visibleList = "";
|
||||
|
||||
for(unsigned int i = 0; i < getSurfaceCellArraySize(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)getSurfaceCellArraySize(); ++i) {
|
||||
SurfaceCell &surfaceCell = surfaceCells[i];
|
||||
|
||||
if(exploredList != "") {
|
||||
|
@ -1808,7 +1808,7 @@ void Map::saveGame(XmlNode *rootNode) const {
|
|||
}
|
||||
|
||||
// Vec2i *startLocations;
|
||||
for(unsigned int i = 0; i < maxPlayers; ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)maxPlayers; ++i) {
|
||||
XmlNode *startLocationsNode = mapNode->addChild("startLocations");
|
||||
startLocationsNode->addAttribute("location",startLocations[i].getString(), mapTagReplacements);
|
||||
}
|
||||
|
@ -1841,7 +1841,7 @@ void Map::loadGame(const XmlNode *rootNode, World *world) {
|
|||
// }
|
||||
|
||||
// printf("getSurfaceCellArraySize() = %d\n",getSurfaceCellArraySize());
|
||||
for(unsigned int i = 0; i < getSurfaceCellArraySize(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)getSurfaceCellArraySize(); ++i) {
|
||||
SurfaceCell &surfaceCell = surfaceCells[i];
|
||||
surfaceCell.loadGame(mapNode,i,world);
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ Checksum Scenario::load(const string &path) {
|
|||
const XmlNode *scenarioNode= xmlTree.getRootNode();
|
||||
const XmlNode *scriptsNode= scenarioNode->getChild("scripts");
|
||||
|
||||
for(int i= 0; i<scriptsNode->getChildCount(); ++i){
|
||||
for(int i= 0; i < (int)scriptsNode->getChildCount(); ++i){
|
||||
const XmlNode *scriptNode = scriptsNode->getChild(i);
|
||||
|
||||
scripts.push_back(Script(getFunctionName(scriptNode), scriptNode->getText()));
|
||||
|
@ -103,7 +103,7 @@ Checksum Scenario::load(const string &path) {
|
|||
|
||||
int Scenario::getScenarioPathIndex(const vector<string> dirList, const string &scenarioName) {
|
||||
int iIndex = 0;
|
||||
for(int idx = 0; idx < dirList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)dirList.size(); idx++) {
|
||||
string currentPath = dirList[idx];
|
||||
endPathWithSlash(currentPath);
|
||||
string scenarioFile = currentPath + scenarioName + "/" + scenarioName + ".xml";
|
||||
|
@ -118,7 +118,7 @@ int Scenario::getScenarioPathIndex(const vector<string> dirList, const string &s
|
|||
|
||||
string Scenario::getScenarioDir(const vector<string> dir, const string &scenarioName) {
|
||||
string scenarioDir = "";
|
||||
for(int idx = 0; idx < dir.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)dir.size(); idx++) {
|
||||
string currentPath = dir[idx];
|
||||
endPathWithSlash(currentPath);
|
||||
string scenarioFile = currentPath + scenarioName + "/" + scenarioName + ".xml";
|
||||
|
@ -136,7 +136,7 @@ string Scenario::getScenarioDir(const vector<string> dir, const string &scenario
|
|||
|
||||
string Scenario::getScenarioPath(const vector<string> dirList, const string &scenarioName, bool getMatchingRootScenarioPathOnly){
|
||||
string scenarioFile = "";
|
||||
for(int idx = 0; idx < dirList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)dirList.size(); idx++) {
|
||||
string currentPath = dirList[idx];
|
||||
endPathWithSlash(currentPath);
|
||||
scenarioFile = currentPath + scenarioName + "/" + scenarioName + ".xml";
|
||||
|
@ -172,7 +172,7 @@ string Scenario::getScenarioPath(const string &dir, const string &scenarioName){
|
|||
string Scenario::getFunctionName(const XmlNode *scriptNode){
|
||||
string name= scriptNode->getName();
|
||||
|
||||
for(int i= 0; i<scriptNode->getAttributeCount(); ++i){
|
||||
for(int i= 0; i < (int)scriptNode->getAttributeCount(); ++i){
|
||||
name+= "_" + scriptNode->getAttribute(i)->getValue();
|
||||
}
|
||||
return name;
|
||||
|
|
|
@ -125,7 +125,7 @@ Checksum Tileset::loadTileset(const vector<string> pathList, const string &tiles
|
|||
Checksum tilesetChecksum;
|
||||
|
||||
bool found = false;
|
||||
for(int idx = 0; idx < pathList.size(); idx++) {
|
||||
for(int idx = 0; idx < (int)pathList.size(); idx++) {
|
||||
string currentPath = pathList[idx];
|
||||
endPathWithSlash(currentPath);
|
||||
string path = currentPath + tilesetName;
|
||||
|
@ -240,7 +240,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
|||
string exceptionError = "";
|
||||
Pixmap2D *pixmap = NULL;
|
||||
int width = 0;
|
||||
int heith = 0;
|
||||
int height = 0;
|
||||
|
||||
try {
|
||||
pixmap=new Pixmap2D();
|
||||
|
@ -248,8 +248,8 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
|||
pixmap->load(textureNode->getAttribute("path")->getRestrictedValue(currentPath));
|
||||
loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,textureNode->getAttribute("path")->getRestrictedValue()));
|
||||
|
||||
width = pixmap->getW();
|
||||
heith = pixmap->getW();
|
||||
width = pixmap->getW();
|
||||
height = pixmap->getW();
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
|
@ -268,9 +268,15 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
|||
throw megaglest_runtime_error(exceptionError.c_str());
|
||||
}
|
||||
|
||||
assert(width==heith);
|
||||
assert(width%64==0);
|
||||
assert(width%partsize==0);
|
||||
if(width != height) {
|
||||
throw megaglest_runtime_error("width != height");
|
||||
}
|
||||
if(width % 64 != 0) {
|
||||
throw megaglest_runtime_error("width % 64 != 0");
|
||||
}
|
||||
if(width % partsize != 0) {
|
||||
throw megaglest_runtime_error("width % partsize != 0");
|
||||
}
|
||||
|
||||
int parts=width/partsize;
|
||||
int numberOfPieces=parts*parts;
|
||||
|
@ -325,7 +331,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
|||
const XmlNode *particleNode= modelNode->getChild("particles");
|
||||
bool particleEnabled= particleNode->getAttribute("value")->getBoolValue();
|
||||
if(particleEnabled){
|
||||
for(int k=0; k<particleNode->getChildCount(); ++k){
|
||||
for(int k=0; k < (int)particleNode->getChildCount(); ++k){
|
||||
const XmlNode *particleFileNode= particleNode->getChild("particle-file", k);
|
||||
string path= particleFileNode->getAttribute("path")->getRestrictedValue();
|
||||
ObjectParticleSystemType *objectParticleSystemType= new ObjectParticleSystemType();
|
||||
|
@ -523,7 +529,7 @@ void Tileset::addSurfTex(int leftUp, int rightUp, int leftDown, int rightDown, V
|
|||
else {
|
||||
float max= 0.f;
|
||||
int var= 0;
|
||||
for(int i=0; i < surfProbs[leftUp].size(); ++i) {
|
||||
for(int i=0; i < (int)surfProbs[leftUp].size(); ++i) {
|
||||
max += surfProbs[leftUp][i];
|
||||
if(r <= max) {
|
||||
var= i;
|
||||
|
|
|
@ -898,7 +898,7 @@ std::pair<bool,Unit *> UnitUpdater::unitBeingAttacked(const Unit *unit) {
|
|||
std::pair<bool,Unit *> result = make_pair(false,(Unit *)NULL);
|
||||
|
||||
float distToUnit = -1;
|
||||
for(unsigned int i = 0; i < unit->getType()->getSkillTypeCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)unit->getType()->getSkillTypeCount(); ++i) {
|
||||
const SkillType *st = unit->getType()->getSkillType(i);
|
||||
const AttackSkillType *ast = dynamic_cast<const AttackSkillType *>(st);
|
||||
unitBeingAttacked(result, unit, ast, &distToUnit);
|
||||
|
@ -1281,7 +1281,7 @@ void UnitUpdater::updateHarvest(Unit *unit, int frameIndex) {
|
|||
const HarvestCommandType *hct= dynamic_cast<const HarvestCommandType*>(command->getCommandType());
|
||||
Vec2i targetPos(-1);
|
||||
|
||||
TravelState tsValue = tsImpossible;
|
||||
//TravelState tsValue = tsImpossible;
|
||||
//UnitPathInterface *path= unit->getPath();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
@ -2667,7 +2667,7 @@ bool UnitUpdater::findCachedCellsEnemies(Vec2i center, int range, int size, vect
|
|||
result = true;
|
||||
|
||||
std::vector<Cell *> &cellList = iterFind4->second.rangeCellList;
|
||||
for(int idx = 0; idx < cellList.size(); ++idx) {
|
||||
for(int idx = 0; idx < (int)cellList.size(); ++idx) {
|
||||
Cell *cell = cellList[idx];
|
||||
|
||||
findEnemiesForCell(ast,cell,unit,commandTarget,enemies);
|
||||
|
@ -2805,7 +2805,7 @@ bool UnitUpdater::unitOnRange(Unit *unit, int range, Unit **rangedPtr,
|
|||
string randomInfoData = "enemies.size() = " + intToStr(enemies.size());
|
||||
|
||||
//printf("unit %d has control:%d\n",unit->getId(),controlType);
|
||||
for(int i = 0; i< enemies.size(); ++i) {
|
||||
for(int i = 0; i< (int)enemies.size(); ++i) {
|
||||
Unit *enemy = enemies[i];
|
||||
|
||||
|
||||
|
|
|
@ -51,13 +51,13 @@ void WaterEffects::update(float speed){
|
|||
if(anim>1.f){
|
||||
anim= 0;
|
||||
}
|
||||
for(int i=0; i<waterSplashes.size(); ++i){
|
||||
for(int i=0; i < (int)waterSplashes.size(); ++i){
|
||||
waterSplashes[i].update(speed/GameConstants::updateFps);
|
||||
}
|
||||
}
|
||||
|
||||
void WaterEffects::addWaterSplash(const Vec2f &pos, int size){
|
||||
for(int i=0; i<waterSplashes.size(); ++i){
|
||||
for(int i=0; i < (int)waterSplashes.size(); ++i){
|
||||
if(!waterSplashes[i].getEnabled()){
|
||||
waterSplashes[i]= WaterSplash(pos,size);
|
||||
return;
|
||||
|
|
|
@ -95,13 +95,13 @@ void World::cleanup() {
|
|||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
for(int i= 0; i<factions.size(); ++i){
|
||||
for(int i= 0; i < (int)factions.size(); ++i){
|
||||
factions[i]->end();
|
||||
}
|
||||
|
||||
masterController.clearSlaves(true);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
for(int i= 0; i<factions.size(); ++i){
|
||||
for(int i= 0; i < (int)factions.size(); ++i){
|
||||
delete factions[i];
|
||||
}
|
||||
factions.clear();
|
||||
|
@ -174,12 +174,12 @@ void World::end(){
|
|||
ExploredCellsLookupItemCache.clear();
|
||||
ExploredCellsLookupItemCacheTimer.clear();
|
||||
|
||||
for(int i= 0; i<factions.size(); ++i){
|
||||
for(int i= 0; i < (int)factions.size(); ++i){
|
||||
factions[i]->end();
|
||||
}
|
||||
|
||||
masterController.clearSlaves(true);
|
||||
for(int i= 0; i<factions.size(); ++i){
|
||||
for(int i= 0; i < (int)factions.size(); ++i){
|
||||
delete factions[i];
|
||||
}
|
||||
factions.clear();
|
||||
|
@ -709,7 +709,7 @@ void World::updateAllFactionUnits() {
|
|||
if(unitUpdater.updateUnit(unit) == true) {
|
||||
unitCountUpdated++;
|
||||
|
||||
if(unit->getLastStuckFrame() == frameCount) {
|
||||
if(unit->getLastStuckFrame() == (unsigned int)frameCount) {
|
||||
unitCountStuck++;
|
||||
}
|
||||
mapCommandCount[unitCommandClass] = mapCommandCount[unitCommandClass] + 1;
|
||||
|
@ -1280,7 +1280,7 @@ void World::morphToUnit(int unitId,const string &morphName,bool ignoreRequiremen
|
|||
void World::createUnit(const string &unitName, int factionIndex, const Vec2i &pos, bool spaciated) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unitName [%s] factionIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,unitName.c_str(),factionIndex);
|
||||
|
||||
if(factionIndex < factions.size()) {
|
||||
if(factionIndex < (int)factions.size()) {
|
||||
Faction* faction= factions[factionIndex];
|
||||
|
||||
if(faction->getIndex() != factionIndex) {
|
||||
|
@ -1324,7 +1324,7 @@ void World::createUnit(const string &unitName, int factionIndex, const Vec2i &po
|
|||
}
|
||||
|
||||
void World::giveResource(const string &resourceName, int factionIndex, int amount) {
|
||||
if(factionIndex < factions.size()) {
|
||||
if(factionIndex < (int)factions.size()) {
|
||||
Faction* faction= factions[factionIndex];
|
||||
const ResourceType* rt= techTree->getResourceType(resourceName);
|
||||
faction->incResourceAmount(rt, amount);
|
||||
|
@ -1728,7 +1728,7 @@ void World::giveUpgradeCommand(int unitId, const string &upgradeName) {
|
|||
|
||||
|
||||
int World::getResourceAmount(const string &resourceName, int factionIndex) {
|
||||
if(factionIndex < factions.size()) {
|
||||
if(factionIndex < (int)factions.size()) {
|
||||
Faction* faction= factions[factionIndex];
|
||||
const ResourceType* rt= techTree->getResourceType(resourceName);
|
||||
return faction->getResource(rt)->getAmount();
|
||||
|
@ -1739,7 +1739,7 @@ int World::getResourceAmount(const string &resourceName, int factionIndex) {
|
|||
}
|
||||
|
||||
Vec2i World::getStartLocation(int factionIndex) {
|
||||
if(factionIndex < factions.size()) {
|
||||
if(factionIndex < (int)factions.size()) {
|
||||
Faction* faction= factions[factionIndex];
|
||||
return map.getStartLocation(faction->getStartLocationIndex());
|
||||
}
|
||||
|
@ -1854,7 +1854,7 @@ const string World::getUnitName(int unitId) {
|
|||
}
|
||||
|
||||
int World::getUnitCount(int factionIndex) {
|
||||
if(factionIndex < factions.size()) {
|
||||
if(factionIndex < (int)factions.size()) {
|
||||
Faction* faction= factions[factionIndex];
|
||||
int count= 0;
|
||||
|
||||
|
@ -1872,7 +1872,7 @@ int World::getUnitCount(int factionIndex) {
|
|||
}
|
||||
|
||||
int World::getUnitCountOfType(int factionIndex, const string &typeName) {
|
||||
if(factionIndex < factions.size()) {
|
||||
if(factionIndex < (int)factions.size()) {
|
||||
Faction* faction= factions[factionIndex];
|
||||
int count= 0;
|
||||
|
||||
|
@ -1992,7 +1992,7 @@ void World::initFactionTypes(GameSettings *gs) {
|
|||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] factions.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,factions.size());
|
||||
|
||||
for(int i=0; i < factions.size(); ++i) {
|
||||
for(int i=0; i < (int)factions.size(); ++i) {
|
||||
FactionType *ft= techTree->getTypeByName(gs->getFactionTypeName(i));
|
||||
if(ft == NULL) {
|
||||
throw megaglest_runtime_error("ft == NULL");
|
||||
|
@ -2241,10 +2241,10 @@ void World::initUnits() {
|
|||
}
|
||||
|
||||
void World::refreshAllUnitExplorations() {
|
||||
for(unsigned int i = 0; i < getFactionCount(); ++i) {
|
||||
for(unsigned int i = 0; i < (unsigned int)getFactionCount(); ++i) {
|
||||
Faction *faction = factions[i];
|
||||
|
||||
for(unsigned int j = 0; j < faction->getUnitCount(); ++j) {
|
||||
for(unsigned int j = 0; j < (unsigned int)faction->getUnitCount(); ++j) {
|
||||
Unit *unit = faction->getUnit(j);
|
||||
unit->refreshPos();
|
||||
}
|
||||
|
@ -2259,12 +2259,12 @@ void World::initMap() {
|
|||
|
||||
void World::exploreCells(int teamIndex, ExploredCellsLookupItem &exploredCellsCache) {
|
||||
std::vector<SurfaceCell*> &cellList = exploredCellsCache.exploredCellList;
|
||||
for (int idx2 = 0; idx2 < cellList.size(); ++idx2) {
|
||||
for (int idx2 = 0; idx2 < (int)cellList.size(); ++idx2) {
|
||||
SurfaceCell* sc = cellList[idx2];
|
||||
sc->setExplored(teamIndex, true);
|
||||
}
|
||||
cellList = exploredCellsCache.visibleCellList;
|
||||
for (int idx2 = 0; idx2 < cellList.size(); ++idx2) {
|
||||
for (int idx2 = 0; idx2 < (int)cellList.size(); ++idx2) {
|
||||
SurfaceCell* sc = cellList[idx2];
|
||||
sc->setVisible(teamIndex, true);
|
||||
}
|
||||
|
@ -2284,7 +2284,7 @@ ExploredCellsLookupItem World::exploreCells(const Vec2i &newPos, int sightRange,
|
|||
// Ok we limit the cache size due to possible RAM constraints when
|
||||
// the threshold is met
|
||||
bool MaxExploredCellsLookupItemCacheTriggered = false;
|
||||
if(ExploredCellsLookupItemCache.size() >= MaxExploredCellsLookupItemCache) {
|
||||
if((int)ExploredCellsLookupItemCache.size() >= MaxExploredCellsLookupItemCache) {
|
||||
MaxExploredCellsLookupItemCacheTriggered = true;
|
||||
// Snag the oldest entry in the list
|
||||
std::map<int,ExploredCellsLookupKey>::reverse_iterator purgeItem = ExploredCellsLookupItemCacheTimer.rbegin();
|
||||
|
@ -2616,7 +2616,7 @@ void World::stopAllVideo() {
|
|||
}
|
||||
|
||||
void World::removeResourceTargetFromCache(const Vec2i &pos) {
|
||||
for(int i= 0; i < factions.size(); ++i) {
|
||||
for(int i= 0; i < (int)factions.size(); ++i) {
|
||||
factions[i]->removeResourceTargetFromCache(pos);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,14 @@ wxString ToUnicode(const string& str) {
|
|||
|
||||
MainWindow::MainWindow(string appPath)
|
||||
: wxFrame(NULL, -1, ToUnicode(winHeader), wxPoint(0,0), wxSize(1024, 768))
|
||||
, lastX(0), lastY(0)
|
||||
, glCanvas(NULL)
|
||||
, program(NULL)
|
||||
, lastX(0)
|
||||
, lastY(0)
|
||||
, panel(NULL)
|
||||
, menuBar(NULL)
|
||||
, fileDialog(NULL)
|
||||
|
||||
, currentBrush(btHeight)
|
||||
, height(0)
|
||||
, surface(1)
|
||||
|
@ -77,11 +84,8 @@ MainWindow::MainWindow(string appPath)
|
|||
, startLocation(1)
|
||||
, enabledGroup(ctHeight)
|
||||
, fileModified(false)
|
||||
, menuBar(NULL)
|
||||
, panel(NULL)
|
||||
, glCanvas(NULL)
|
||||
, fileDialog(NULL)
|
||||
, program(NULL), boxsizer(NULL), startupSettingsInited(false) {
|
||||
, boxsizer(NULL)
|
||||
,startupSettingsInited(false) {
|
||||
|
||||
menuFile=NULL;
|
||||
menuEdit=NULL;
|
||||
|
|
|
@ -47,6 +47,16 @@ protected:
|
|||
SDL_Surface *icon;
|
||||
SDL_Surface *screen;
|
||||
|
||||
public:
|
||||
// Example values:
|
||||
// DEFAULT_CHARSET (English) = 1
|
||||
// GB2312_CHARSET (Chinese) = 134
|
||||
#ifdef WIN32
|
||||
static DWORD charSet;
|
||||
#else
|
||||
static int charSet;
|
||||
#endif
|
||||
|
||||
public:
|
||||
PlatformContextGl();
|
||||
virtual ~PlatformContextGl();
|
||||
|
@ -68,15 +78,6 @@ public:
|
|||
// Global Fcs
|
||||
// =====================================================
|
||||
|
||||
// Example values:
|
||||
// DEFAULT_CHARSET (English) = 1
|
||||
// GB2312_CHARSET (Chinese) = 134
|
||||
#ifdef WIN32
|
||||
static DWORD charSet = DEFAULT_CHARSET;
|
||||
#else
|
||||
static int charSet = 1;
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width, int charCount, FontMetrics &metrics);
|
||||
void createGlFontOutlines(uint32 &base, const string &type, int width, float depth, int charCount, FontMetrics &metrics);
|
||||
|
|
|
@ -162,6 +162,7 @@ inline static void get_random_info(char seed[16]) {
|
|||
|
||||
if (NULL != fp) {
|
||||
size_t bytes = fread(seed,sizeof(char),16,fp);
|
||||
if(bytes <= 0) { }
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ LOCAL int ftpCmdSyst(int sessionId, const char* args, int len)
|
|||
}
|
||||
LOCAL int ftpCmdPort(int sessionId, const char* args, int len)
|
||||
{
|
||||
char clientIp[16];
|
||||
//char clientIp[16]="";
|
||||
uint16_t clientPort=0;
|
||||
|
||||
int commaCnt = 0;
|
||||
|
@ -215,13 +215,13 @@ LOCAL int ftpCmdPort(int sessionId, const char* args, int len)
|
|||
if(args[n] == ',')
|
||||
{
|
||||
commaCnt++;
|
||||
if(commaCnt < 4)
|
||||
clientIp[n] = '.';
|
||||
else
|
||||
clientIp[n] = '\0';
|
||||
// if(commaCnt < 4)
|
||||
// clientIp[n] = '.';
|
||||
// else
|
||||
// clientIp[n] = '\0';
|
||||
}
|
||||
else
|
||||
clientIp[n] = args[n];
|
||||
// else
|
||||
// clientIp[n] = args[n];
|
||||
}
|
||||
else // Port-Nummer
|
||||
{
|
||||
|
@ -957,7 +957,7 @@ int execFtpCmd(int sessionId, const char* cmd, int cmdlen)
|
|||
//if(VERBOSE_MODE_ENABLED) printf("In execFtpCmd ARRAY_SIZE(cmds) = %lu for sessionId = %d\n",ARRAY_SIZE(cmds),sessionId);
|
||||
if(VERBOSE_MODE_ENABLED) printf("In execFtpCmd cmd [%s] for sessionId = %d\n",cmd,sessionId);
|
||||
|
||||
for(n = 0; n < ARRAY_SIZE(cmds); n++)
|
||||
for(n = 0; n < (int)ARRAY_SIZE(cmds); n++)
|
||||
{
|
||||
if(!strncmp(cmds[n].cmdToken, cmd, cmds[n].tokLen))
|
||||
{
|
||||
|
|
|
@ -166,7 +166,7 @@ float FontMetrics::getTextWidth(const string &str) {
|
|||
width+= (widths[97]); // This is the letter a which is a normal wide character and good to use for spacing
|
||||
}
|
||||
else {
|
||||
width+= widths[longestLine[i]];
|
||||
width+= widths[(int)longestLine[i]];
|
||||
}
|
||||
}
|
||||
return width;
|
||||
|
@ -522,7 +522,7 @@ void Font::bidi_cvt(string &str_) {
|
|||
if(is_converted == true) {
|
||||
nonASCIIWordList.push_back(str_);
|
||||
|
||||
if(wordIndex+1 == words.size()) {
|
||||
if(wordIndex+1 == (int)words.size()) {
|
||||
if(nonASCIIWordList.size() > 1) {
|
||||
std::reverse(nonASCIIWordList.begin(),nonASCIIWordList.end());
|
||||
copy(nonASCIIWordList.begin(), nonASCIIWordList.end(), std::inserter(wordList, wordList.begin()));
|
||||
|
|
|
@ -631,7 +631,7 @@ TextureGl::~TextureGl() {
|
|||
// =====================================================
|
||||
// class Texture1DGl
|
||||
// =====================================================
|
||||
Texture1DGl::Texture1DGl() : TextureGl(), Texture1D() {}
|
||||
Texture1DGl::Texture1DGl() : Texture1D(), TextureGl() {}
|
||||
|
||||
Texture1DGl::~Texture1DGl() {
|
||||
end();
|
||||
|
@ -753,7 +753,7 @@ void Texture1DGl::end(bool deletePixelBuffer) {
|
|||
// class Texture2DGl
|
||||
// =====================================================
|
||||
|
||||
Texture2DGl::Texture2DGl() : TextureGl(), Texture2D() {}
|
||||
Texture2DGl::Texture2DGl() : Texture2D(), TextureGl() {}
|
||||
|
||||
Texture2DGl::~Texture2DGl() {
|
||||
end();
|
||||
|
@ -959,7 +959,7 @@ void Texture2DGl::end(bool deletePixelBuffer) {
|
|||
// class Texture3DGl
|
||||
// =====================================================
|
||||
|
||||
Texture3DGl::Texture3DGl() : TextureGl(), Texture3D() {}
|
||||
Texture3DGl::Texture3DGl() : Texture3D(), TextureGl() {}
|
||||
|
||||
Texture3DGl::~Texture3DGl() {
|
||||
end();
|
||||
|
@ -1068,7 +1068,7 @@ void Texture3DGl::end(bool deletePixelBuffer) {
|
|||
// class TextureCubeGl
|
||||
// =====================================================
|
||||
|
||||
TextureCubeGl::TextureCubeGl() : TextureGl(), TextureCube() {}
|
||||
TextureCubeGl::TextureCubeGl() : TextureCube(), TextureGl() {}
|
||||
|
||||
TextureCubeGl::~TextureCubeGl() {
|
||||
end();
|
||||
|
|
|
@ -1982,7 +1982,7 @@ vector<int> BaseColorPickEntity::getPickedList(int x,int y,int w,int h,
|
|||
map<unsigned char,map<unsigned char, map<unsigned char,bool> > > colorAlreadyPickedList;
|
||||
|
||||
int skipSteps=4;
|
||||
unsigned char *oldpixel = &pixelBuffer[0];
|
||||
//unsigned char *oldpixel = &pixelBuffer[0];
|
||||
|
||||
// now we check the screenshot if we find pixels in color of unit identity
|
||||
// to speedup we only check every "skipSteps" line and pixel in a row if we find such a color.
|
||||
|
|
|
@ -765,9 +765,9 @@ GameParticleSystem::GameParticleSystem(int particleCount):
|
|||
primitive(pQuad),
|
||||
model(NULL),
|
||||
modelCycle(0.0f),
|
||||
tween(0.0f),
|
||||
offset(0.0f),
|
||||
direction(0.0f, 1.0f, 0.0f)
|
||||
direction(0.0f, 1.0f, 0.0f),
|
||||
tween(0.0f)
|
||||
{}
|
||||
|
||||
GameParticleSystem::~GameParticleSystem(){
|
||||
|
|
|
@ -991,8 +991,7 @@ void Pixmap2D::Scale(int format, int newW, int newH) {
|
|||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||
printf("ERROR Scaling image from [%d x %d] to [%d x %d] error: %d [%s]\n",originalW,originalH,w,h,error,errorString);
|
||||
|
||||
GLenum glErr = error;
|
||||
assertGlWithErrorNumber(glErr);
|
||||
assertGlWithErrorNumber(error);
|
||||
}
|
||||
|
||||
CalculatePixelsCRC(pixels,getPixelByteCount(), crc);
|
||||
|
@ -1063,7 +1062,7 @@ void Pixmap2D::savePng(const string &path) {
|
|||
void Pixmap2D::getPixel(int x, int y, uint8 *value) const {
|
||||
for(int i=0; i<components; ++i){
|
||||
int index = (w*y+x)*components+i;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if((unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1076,7 +1075,7 @@ void Pixmap2D::getPixel(int x, int y, uint8 *value) const {
|
|||
void Pixmap2D::getPixel(int x, int y, float32 *value) const {
|
||||
for(int i=0; i<components; ++i) {
|
||||
int index = (w*y+x)*components+i;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if((unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1088,7 +1087,7 @@ void Pixmap2D::getPixel(int x, int y, float32 *value) const {
|
|||
|
||||
void Pixmap2D::getComponent(int x, int y, int component, uint8 &value) const {
|
||||
int index = (w*y+x)*components+component;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1099,7 +1098,7 @@ void Pixmap2D::getComponent(int x, int y, int component, uint8 &value) const {
|
|||
|
||||
void Pixmap2D::getComponent(int x, int y, int component, float32 &value) const {
|
||||
int index = (w*y+x)*components+component;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1113,7 +1112,7 @@ Vec4f Pixmap2D::getPixel4f(int x, int y) const {
|
|||
Vec4f v(0.f);
|
||||
for(int i=0; i<components && i<4; ++i){
|
||||
int index = (w*y+x)*components+i;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1128,7 +1127,7 @@ Vec3f Pixmap2D::getPixel3f(int x, int y) const {
|
|||
Vec3f v(0.f);
|
||||
for(int i=0; i<components && i<3; ++i){
|
||||
int index = (w*y+x)*components+i;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1141,7 +1140,7 @@ Vec3f Pixmap2D::getPixel3f(int x, int y) const {
|
|||
|
||||
float Pixmap2D::getPixelf(int x, int y) const {
|
||||
int index = (w*y+x)*components;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1158,7 +1157,7 @@ float Pixmap2D::getComponentf(int x, int y, int component) const {
|
|||
void Pixmap2D::setPixel(int x, int y, const uint8 *value) {
|
||||
for(int i=0; i<components; ++i) {
|
||||
int index = (w*y+x)*components+i;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1172,7 +1171,7 @@ void Pixmap2D::setPixel(int x, int y, const uint8 *value) {
|
|||
void Pixmap2D::setPixel(int x, int y, const float32 *value) {
|
||||
for(int i=0; i<components; ++i) {
|
||||
int index = (w*y+x)*components+i;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1184,7 +1183,7 @@ void Pixmap2D::setPixel(int x, int y, const float32 *value) {
|
|||
|
||||
void Pixmap2D::setComponent(int x, int y, int component, uint8 value) {
|
||||
int index = (w*y+x)*components+component;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1196,7 +1195,7 @@ void Pixmap2D::setComponent(int x, int y, int component, uint8 value) {
|
|||
|
||||
void Pixmap2D::setComponent(int x, int y, int component, float32 value) {
|
||||
int index = (w*y+x)*components+component;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1210,7 +1209,7 @@ void Pixmap2D::setComponent(int x, int y, int component, float32 value) {
|
|||
void Pixmap2D::setPixel(int x, int y, const Vec3f &p) {
|
||||
for(int i = 0; i < components && i < 3; ++i) {
|
||||
int index = (w*y+x)*components+i;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1223,7 +1222,7 @@ void Pixmap2D::setPixel(int x, int y, const Vec3f &p) {
|
|||
void Pixmap2D::setPixel(int x, int y, const Vec4f &p) {
|
||||
for(int i = 0; i < components && i < 4; ++i) {
|
||||
int index = (w*y+x)*components+i;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1235,7 +1234,7 @@ void Pixmap2D::setPixel(int x, int y, const Vec4f &p) {
|
|||
|
||||
void Pixmap2D::setPixel(int x, int y, float p) {
|
||||
int index = (w*y+x)*components;
|
||||
if(index >= getPixelByteCount()) {
|
||||
if(index < 0 || (unsigned int)index >= getPixelByteCount()) {
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap index: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n",index,path.c_str(),h,w,components,x,y);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
|
|
@ -163,31 +163,31 @@ static inline void loadTexture(class ctx *ctx) {
|
|||
glTexImage2D(GL_TEXTURE_2D, 0, 4, ctx->width, ctx->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (Uint8 *) rawData);
|
||||
}
|
||||
|
||||
static void *lock(void *data, void **p_pixels) {
|
||||
class ctx *ctx = (class ctx *)data;
|
||||
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||
|
||||
SDL_LockMutex(ctx->mutex);
|
||||
SDL_LockSurface(ctx->surf);
|
||||
*p_pixels = ctx->surf->pixels;
|
||||
|
||||
return NULL; /* picture identifier, not needed here */
|
||||
}
|
||||
|
||||
static void unlock(void *data, void *id, void *const *p_pixels) {
|
||||
class ctx *ctx = (class ctx *)data;
|
||||
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||
|
||||
/* VLC just rendered the video, but we can also render stuff */
|
||||
SDL_UnlockSurface(ctx->surf);
|
||||
SDL_UnlockMutex(ctx->mutex);
|
||||
}
|
||||
|
||||
static void display(void *data, void *id) {
|
||||
// VLC wants to display the video
|
||||
class ctx *ctx = (class ctx *)data;
|
||||
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||
}
|
||||
//static void *lock(void *data, void **p_pixels) {
|
||||
// class ctx *ctx = (class ctx *)data;
|
||||
// if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||
//
|
||||
// SDL_LockMutex(ctx->mutex);
|
||||
// SDL_LockSurface(ctx->surf);
|
||||
// *p_pixels = ctx->surf->pixels;
|
||||
//
|
||||
// return NULL; /* picture identifier, not needed here */
|
||||
//}
|
||||
//
|
||||
//static void unlock(void *data, void *id, void *const *p_pixels) {
|
||||
// class ctx *ctx = (class ctx *)data;
|
||||
// if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||
//
|
||||
// /* VLC just rendered the video, but we can also render stuff */
|
||||
// SDL_UnlockSurface(ctx->surf);
|
||||
// SDL_UnlockMutex(ctx->mutex);
|
||||
//}
|
||||
//
|
||||
//static void display(void *data, void *id) {
|
||||
// // VLC wants to display the video
|
||||
// class ctx *ctx = (class ctx *)data;
|
||||
// if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||
//}
|
||||
|
||||
#if defined(HAS_LIBVLC) && defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_0)
|
||||
static void catchError(libvlc_exception_t *ex) {
|
||||
|
|
|
@ -365,7 +365,7 @@ void findAll(const string &path, vector<string> &results, bool cutExtension, boo
|
|||
}
|
||||
}
|
||||
else {
|
||||
for(int i = 0; i < globbuf.gl_pathc; ++i) {
|
||||
for(int i = 0; i < (int)globbuf.gl_pathc; ++i) {
|
||||
const char* p = globbuf.gl_pathv[i];
|
||||
const char* begin = p;
|
||||
for( ; *p != 0; ++p) {
|
||||
|
@ -598,7 +598,7 @@ void updatePathClimbingParts(string &path) {
|
|||
for(int x = (int)pos; x >= 0; --x) {
|
||||
//printf("x [%d][%c] pos [%ld][%c] [%s]\n",x,path[x],(long int)pos,path[pos],path.substr(0,x+1).c_str());
|
||||
|
||||
if((path[x] == '/' || path[x] == '\\') && x != pos) {
|
||||
if((path[x] == '/' || path[x] == '\\') && x != (int)pos) {
|
||||
path.erase(x,pos-x);
|
||||
break;
|
||||
}
|
||||
|
@ -1034,7 +1034,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
|
|||
|
||||
int fileLoopCount = 0;
|
||||
int fileMatchCount = 0;
|
||||
for(int i = 0; i < globbuf.gl_pathc; ++i) {
|
||||
for(int i = 0; i < (int)globbuf.gl_pathc; ++i) {
|
||||
const char* p = globbuf.gl_pathv[i];
|
||||
//printf("Line: %d p [%s]\n",__LINE__,p);
|
||||
|
||||
|
@ -1072,7 +1072,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
|
|||
}
|
||||
#endif
|
||||
|
||||
for(int i = 0; i < globbuf.gl_pathc; ++i) {
|
||||
for(int i = 0; i < (int)globbuf.gl_pathc; ++i) {
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
struct stat statStruct;
|
||||
// only process if dir..
|
||||
|
@ -1212,7 +1212,7 @@ vector<string> getFolderTreeContentsListRecursively(const string &path, const st
|
|||
throw megaglest_runtime_error(msg.str());
|
||||
}
|
||||
#endif
|
||||
for(int i = 0; i < globbuf.gl_pathc; ++i) {
|
||||
for(int i = 0; i < (int)globbuf.gl_pathc; ++i) {
|
||||
const char* p = globbuf.gl_pathv[i];
|
||||
|
||||
bool skipItem = (EndsWith(p, ".") == true || EndsWith(p, "..") == true);
|
||||
|
@ -1253,7 +1253,7 @@ vector<string> getFolderTreeContentsListRecursively(const string &path, const st
|
|||
}
|
||||
#endif
|
||||
|
||||
for(int i = 0; i < globbuf.gl_pathc; ++i) {
|
||||
for(int i = 0; i < (int)globbuf.gl_pathc; ++i) {
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
struct stat statStruct;
|
||||
// only get if dir..
|
||||
|
@ -1354,7 +1354,7 @@ vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(c
|
|||
}
|
||||
#endif
|
||||
|
||||
for(int i = 0; i < globbuf.gl_pathc; ++i) {
|
||||
for(int i = 0; i < (int)globbuf.gl_pathc; ++i) {
|
||||
const char* p = globbuf.gl_pathv[i];
|
||||
|
||||
if(isdir(p) == false) {
|
||||
|
@ -1392,7 +1392,7 @@ vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(c
|
|||
}
|
||||
#endif
|
||||
|
||||
for(int i = 0; i < globbuf.gl_pathc; ++i) {
|
||||
for(int i = 0; i < (int)globbuf.gl_pathc; ++i) {
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
struct stat statStruct;
|
||||
// only get if dir..
|
||||
|
|
|
@ -301,10 +301,10 @@ void FileCRCPreCacheThread::execute() {
|
|||
}
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\t\tStart Processing CRC for techName [%s]\n",techName.c_str());
|
||||
|
||||
int32 techCRC = getFolderTreeContentsCheckSumRecursively(techDataPaths, string("/") + techName + string("/*"), ".xml", NULL, true);
|
||||
uint32 techCRC = getFolderTreeContentsCheckSumRecursively(techDataPaths, string("/") + techName + string("/*"), ".xml", NULL, true);
|
||||
|
||||
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] cached CRC value for Tech [%s] is [%d] took %.3f seconds.\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),techCRC,difftime(time(NULL),elapsedTime));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] cached CRC value for Tech [%s] is [%d] took %.3f seconds.\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),techCRC,difftime(time(NULL),elapsedTime));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] cached CRC value for Tech [%s] is [%u] took %.3f seconds.\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),techCRC,difftime(time(NULL),elapsedTime));
|
||||
|
||||
vector<string> results;
|
||||
for(unsigned int idx = 0; idx < techDataPaths.size(); idx++) {
|
||||
|
@ -337,9 +337,9 @@ void FileCRCPreCacheThread::execute() {
|
|||
}
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\t\t\tStart Processing CRC for factionName [%s]\n",factionName.c_str());
|
||||
|
||||
int32 factionCRC = getFolderTreeContentsCheckSumRecursively(techDataPaths, "/" + techName + "/factions/" + factionName + "/*", ".xml", NULL, true);
|
||||
uint32 factionCRC = getFolderTreeContentsCheckSumRecursively(techDataPaths, "/" + techName + "/factions/" + factionName + "/*", ".xml", NULL, true);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\t\t\tDone Processing CRC for factionName [%s]\n",factionName.c_str());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\t\t\tDone Processing CRC for factionName [%s] CRC [%d]\n",factionName.c_str(),factionCRC);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -349,6 +349,7 @@ void Ip::Inet_NtoA(uint32 addr, char * ipbuf)
|
|||
sprintf(ipbuf, "%d.%d.%d.%d", (addr>>24)&0xFF, (addr>>16)&0xFF, (addr>>8)&0xFF, (addr>>0)&0xFF);
|
||||
}
|
||||
|
||||
#if defined(WIN32)
|
||||
// convert a string represenation of an IP address into its numeric equivalent
|
||||
static uint32 Inet_AtoN(const char * buf)
|
||||
{
|
||||
|
@ -369,6 +370,7 @@ static uint32 Inet_AtoN(const char * buf)
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
static void PrintNetworkInterfaceInfos()
|
||||
|
@ -702,7 +704,7 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
|
|||
intfTypes.push_back("br-lan");
|
||||
intfTypes.push_back("br-gest");
|
||||
|
||||
for(int intfIdx = 0; intfIdx < intfTypes.size(); intfIdx++) {
|
||||
for(int intfIdx = 0; intfIdx < (int)intfTypes.size(); intfIdx++) {
|
||||
string intfName = intfTypes[intfIdx];
|
||||
for(int idx = 0; idx < 10; ++idx) {
|
||||
PLATFORM_SOCKET fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
|
|
|
@ -128,7 +128,7 @@ public:
|
|||
// =====================================
|
||||
// Threads
|
||||
// =====================================
|
||||
Thread::Thread() : thread(NULL), deleteAfterExecute(false), mutexthreadAccessor(new Mutex()) {
|
||||
Thread::Thread() : thread(NULL), mutexthreadAccessor(new Mutex()), deleteAfterExecute(false) {
|
||||
addThreadToList();
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ int Thread::beginExecution(void* data) {
|
|||
}
|
||||
|
||||
BaseThread *base_thread = dynamic_cast<BaseThread *>(thread);
|
||||
ThreadGarbageCollector *garbage_collector = dynamic_cast<ThreadGarbageCollector *>(thread);
|
||||
//ThreadGarbageCollector *garbage_collector = dynamic_cast<ThreadGarbageCollector *>(thread);
|
||||
if(Thread::getEnableVerboseMode()) printf("In Thread::execute Line: %d thread = %p base_thread = %p [%s]\n",__LINE__,thread,base_thread,(base_thread != NULL ? base_thread->getUniqueID().c_str() : "n/a"));
|
||||
|
||||
if(thread->threadObjectValid() == true) {
|
||||
|
|
|
@ -1034,7 +1034,7 @@ vector<int> extractKeyPressedUnicodeLength(string text) {
|
|||
wchar_t keyW = c;
|
||||
wchar_t textAppend[] = { keyW, 0 };
|
||||
|
||||
if(textAppend) {
|
||||
if(*textAppend) {
|
||||
wchar_t newKey = textAppend[0];
|
||||
if (newKey < 0x80) {
|
||||
result.push_back(1);
|
||||
|
|
|
@ -28,6 +28,15 @@ using namespace Shared::Util;
|
|||
|
||||
namespace Shared { namespace Platform {
|
||||
|
||||
// Example values:
|
||||
// DEFAULT_CHARSET (English) = 1
|
||||
// GB2312_CHARSET (Chinese) = 134
|
||||
#ifdef WIN32
|
||||
DWORD PlatformContextGl::charSet = DEFAULT_CHARSET;
|
||||
#else
|
||||
int PlatformContextGl::charSet = 1;
|
||||
#endif
|
||||
|
||||
// ======================================
|
||||
// Global Fcs
|
||||
// ======================================
|
||||
|
|
|
@ -56,7 +56,7 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
|||
LOGFONT lf;
|
||||
//POSITION pos;
|
||||
//lf.lfCharSet = ANSI_CHARSET;
|
||||
lf.lfCharSet = (BYTE)charSet;
|
||||
lf.lfCharSet = (BYTE)PlatformContextGl::charSet;
|
||||
lf.lfFaceName[0]='\0';
|
||||
|
||||
//HGLRC hdRC =wglGetCurrentContext();
|
||||
|
@ -94,7 +94,7 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
|||
|
||||
LPWSTR wstr = Ansi2WideString(useRealFontName.c_str());
|
||||
HFONT font= CreateFont(
|
||||
size, 0, 0, 0, width, FALSE, FALSE, FALSE, charSet,
|
||||
size, 0, 0, 0, width, FALSE, FALSE, FALSE, PlatformContextGl::charSet,
|
||||
OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||
DEFAULT_PITCH| (useRealFontName.c_str() ? FF_DONTCARE:FF_SWISS), wstr);
|
||||
if(wstr) delete [] wstr;
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Shared{ namespace Util{
|
|||
Mutex Checksum::fileListCacheSynchAccessor;
|
||||
std::map<string,uint32> Checksum::fileListCache;
|
||||
|
||||
int crc_table[256] =
|
||||
unsigned int crc_table[256] =
|
||||
{
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
|
||||
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
|
||||
|
|
|
@ -759,7 +759,7 @@ XmlNode *XmlNode::getChild(const string &childName, unsigned int i) const {
|
|||
throw megaglest_runtime_error("\"" + name + "\" node doesn't have " + uIntToStr(i+1) +" children named \"" + childName + "\"\n\nTree: "+getTreeString());
|
||||
}
|
||||
|
||||
int count= 0;
|
||||
unsigned int count= 0;
|
||||
for(unsigned int j = 0; j < children.size(); ++j) {
|
||||
if(children[j]->getName() == childName) {
|
||||
if(count == i) {
|
||||
|
@ -791,7 +791,7 @@ XmlNode * XmlNode::getChildWithAliases(vector<string> childNameList, unsigned in
|
|||
throw megaglest_runtime_error("\"" + name + "\" node doesn't have "+intToStr(childIndex+1)+" children named \"" + childName + "\"\n\nTree: "+getTreeString());
|
||||
}
|
||||
|
||||
int count= 0;
|
||||
unsigned int count= 0;
|
||||
for(unsigned int j = 0; j < children.size(); ++j) {
|
||||
if(children[j]->getName() == childName) {
|
||||
if(count == childIndex) {
|
||||
|
|
Loading…
Reference in New Issue