- round 2 of cppcheck code cleanup

This commit is contained in:
SoftCoder 2017-10-09 20:21:14 -07:00
parent 26581a77d2
commit 865a665bf0
40 changed files with 750 additions and 750 deletions

View File

@ -620,20 +620,20 @@ vector<int> Ai::findUnitsHarvestingResourceType(const ResourceType *rt) {
return units; return units;
} }
vector<int> Ai::findUnitsDoingCommand(CommandClass currentCommand) { //vector<int> Ai::findUnitsDoingCommand(CommandClass currentCommand) {
vector<int> units; // vector<int> units;
//
for(int i = 0; i < aiInterface->getMyUnitCount(); ++i) { // for(int i = 0; i < aiInterface->getMyUnitCount(); ++i) {
const Unit *unit= aiInterface->getMyUnit(i); // const Unit *unit= aiInterface->getMyUnit(i);
if(unit->getType()->isCommandable() && unit->getType()->hasCommandClass(currentCommand)) { // if(unit->getType()->isCommandable() && unit->getType()->hasCommandClass(currentCommand)) {
if(unit->anyCommand() && unit->getCurrCommand()->getCommandType()->getClass() == currentCommand) { // if(unit->anyCommand() && unit->getCurrCommand()->getCommandType()->getClass() == currentCommand) {
units.push_back(i); // units.push_back(i);
} // }
} // }
} // }
//
return units; // return units;
} //}
bool Ai::findAbleUnit(int *unitIndex, CommandClass ability, CommandClass currentCommand){ bool Ai::findAbleUnit(int *unitIndex, CommandClass ability, CommandClass currentCommand){
vector<int> units; vector<int> units;

View File

@ -211,7 +211,7 @@ public:
bool findPosForBuilding(const UnitType* building, const Vec2i &searchPos, Vec2i &pos); bool findPosForBuilding(const UnitType* building, const Vec2i &searchPos, Vec2i &pos);
bool findAbleUnit(int *unitIndex, CommandClass ability, bool idleOnly); bool findAbleUnit(int *unitIndex, CommandClass ability, bool idleOnly);
bool findAbleUnit(int *unitIndex, CommandClass ability, CommandClass currentCommand); bool findAbleUnit(int *unitIndex, CommandClass ability, CommandClass currentCommand);
vector<int> findUnitsDoingCommand(CommandClass currentCommand); //vector<int> findUnitsDoingCommand(CommandClass currentCommand);
vector<int> findUnitsHarvestingResourceType(const ResourceType *rt); vector<int> findUnitsHarvestingResourceType(const ResourceType *rt);
bool beingAttacked(Vec2i &pos, Field &field, int radius); bool beingAttacked(Vec2i &pos, Field &field, int radius);

View File

@ -599,23 +599,23 @@ int AiInterface::getMyUpgradeCount() const{
return world->getFaction(factionIndex)->getUpgradeManager()->getUpgradeCount(); return world->getFaction(factionIndex)->getUpgradeManager()->getUpgradeCount();
} }
int AiInterface::onSightUnitCount() { //int AiInterface::onSightUnitCount() {
int count=0; // int count=0;
Map *map= world->getMap(); // Map *map= world->getMap();
for(int i=0; i<world->getFactionCount(); ++i) { // for(int i=0; i<world->getFactionCount(); ++i) {
for(int j=0; j<world->getFaction(i)->getUnitCount(); ++j) { // for(int j=0; j<world->getFaction(i)->getUnitCount(); ++j) {
Unit *unit = world->getFaction(i)->getUnit(j); // Unit *unit = world->getFaction(i)->getUnit(j);
SurfaceCell *sc= map->getSurfaceCell(Map::toSurfCoords(unit->getPos())); // SurfaceCell *sc= map->getSurfaceCell(Map::toSurfCoords(unit->getPos()));
bool cannotSeeUnit = (unit->getType()->hasCellMap() == true && // bool cannotSeeUnit = (unit->getType()->hasCellMap() == true &&
unit->getType()->getAllowEmptyCellMap() == true && // unit->getType()->getAllowEmptyCellMap() == true &&
unit->getType()->hasEmptyCellMap() == true); // unit->getType()->hasEmptyCellMap() == true);
if(sc->isVisible(teamIndex) && cannotSeeUnit == false) { // if(sc->isVisible(teamIndex) && cannotSeeUnit == false) {
count++; // count++;
} // }
} // }
} // }
return count; // return count;
} //}
const Resource *AiInterface::getResource(const ResourceType *rt){ const Resource *AiInterface::getResource(const ResourceType *rt){
return world->getFaction(factionIndex)->getResource(rt); return world->getFaction(factionIndex)->getResource(rt);
@ -635,31 +635,31 @@ const Unit *AiInterface::getMyUnit(int unitIndex) {
return getMyUnitPtr(unitIndex); return getMyUnitPtr(unitIndex);
} }
const Unit *AiInterface::getOnSightUnit(int unitIndex) { //const Unit *AiInterface::getOnSightUnit(int unitIndex) {
//
int count=0; // int count=0;
Map *map= world->getMap(); // Map *map= world->getMap();
//
for(int i=0; i<world->getFactionCount(); ++i) { // for(int i=0; i<world->getFactionCount(); ++i) {
for(int j=0; j<world->getFaction(i)->getUnitCount(); ++j) { // for(int j=0; j<world->getFaction(i)->getUnitCount(); ++j) {
Unit * unit= world->getFaction(i)->getUnit(j); // Unit * unit= world->getFaction(i)->getUnit(j);
SurfaceCell *sc= map->getSurfaceCell(Map::toSurfCoords(unit->getPos())); // SurfaceCell *sc= map->getSurfaceCell(Map::toSurfCoords(unit->getPos()));
bool cannotSeeUnit = (unit->getType()->hasCellMap() == true && // bool cannotSeeUnit = (unit->getType()->hasCellMap() == true &&
unit->getType()->getAllowEmptyCellMap() == true && // unit->getType()->getAllowEmptyCellMap() == true &&
unit->getType()->hasEmptyCellMap() == true); // unit->getType()->hasEmptyCellMap() == true);
//
if(sc->isVisible(teamIndex) && cannotSeeUnit == false) { // if(sc->isVisible(teamIndex) && cannotSeeUnit == false) {
if(count==unitIndex) { // if(count==unitIndex) {
return unit; // return unit;
} // }
else { // else {
count ++; // count ++;
} // }
} // }
} // }
} // }
return NULL; // return NULL;
} //}
const FactionType * AiInterface::getMyFactionType(){ const FactionType * AiInterface::getMyFactionType(){
return world->getFaction(factionIndex)->getType(); return world->getFaction(factionIndex)->getType();

View File

@ -134,11 +134,11 @@ public:
int getFactionCount(); int getFactionCount();
int getMyUnitCount() const; int getMyUnitCount() const;
int getMyUpgradeCount() const; int getMyUpgradeCount() const;
int onSightUnitCount(); //int onSightUnitCount();
const Resource *getResource(const ResourceType *rt); const Resource *getResource(const ResourceType *rt);
const Unit *getMyUnit(int unitIndex); const Unit *getMyUnit(int unitIndex);
Unit *getMyUnitPtr(int unitIndex); Unit *getMyUnitPtr(int unitIndex);
const Unit *getOnSightUnit(int unitIndex); //const Unit *getOnSightUnit(int unitIndex);
const FactionType *getMyFactionType(); const FactionType *getMyFactionType();
Faction *getMyFaction(); Faction *getMyFaction();
const TechTree *getTechTree(); const TechTree *getTechTree();

View File

@ -1132,47 +1132,47 @@ int PathFinder::findNodeIndex(Node *node, std::vector<Node> &nodeList) {
return index; return index;
} }
bool PathFinder::unitCannotMove(Unit *unit) { //bool PathFinder::unitCannotMove(Unit *unit) {
bool unitImmediatelyBlocked = false; // bool unitImmediatelyBlocked = false;
//
try { // try {
// First check if unit currently blocked all around them, if so don't try to pathfind // // First check if unit currently blocked all around them, if so don't try to pathfind
const Vec2i unitPos = unit->getPos(); // const Vec2i unitPos = unit->getPos();
int failureCount = 0; // int failureCount = 0;
int cellCount = 0; // int cellCount = 0;
//
for(int i = -1; i <= 1; ++i) { // for(int i = -1; i <= 1; ++i) {
for(int j = -1; j <= 1; ++j) { // for(int j = -1; j <= 1; ++j) {
Vec2i pos = unitPos + Vec2i(i, j); // Vec2i pos = unitPos + Vec2i(i, j);
if(pos != unitPos) { // if(pos != unitPos) {
bool canUnitMoveToCell = map->aproxCanMove(unit, unitPos, pos); // bool canUnitMoveToCell = map->aproxCanMove(unit, unitPos, pos);
if(canUnitMoveToCell == false) { // if(canUnitMoveToCell == false) {
failureCount++; // failureCount++;
} // }
cellCount++; // cellCount++;
} // }
} // }
} // }
unitImmediatelyBlocked = (failureCount == cellCount); // unitImmediatelyBlocked = (failureCount == cellCount);
//
} // }
catch(const exception &ex) { // catch(const exception &ex) {
//setRunningStatus(false); // //setRunningStatus(false);
//
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); // SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//
throw megaglest_runtime_error(ex.what()); // throw megaglest_runtime_error(ex.what());
} // }
catch(...) { // catch(...) {
char szBuf[8096]=""; // char szBuf[8096]="";
snprintf(szBuf,8096,"In [%s::%s %d] UNKNOWN error\n",__FILE__,__FUNCTION__,__LINE__); // snprintf(szBuf,8096,"In [%s::%s %d] UNKNOWN error\n",__FILE__,__FUNCTION__,__LINE__);
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf); // SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
throw megaglest_runtime_error(szBuf); // throw megaglest_runtime_error(szBuf);
} // }
//
return unitImmediatelyBlocked; // return unitImmediatelyBlocked;
} //}
void PathFinder::saveGame(XmlNode *rootNode) { void PathFinder::saveGame(XmlNode *rootNode) {
std::map<string,string> mapTagReplacements; std::map<string,string> mapTagReplacements;

View File

@ -202,7 +202,7 @@ public:
void removeUnitPrecache(Unit *unit); void removeUnitPrecache(Unit *unit);
void clearCaches(); void clearCaches();
bool unitCannotMove(Unit *unit); //bool unitCannotMove(Unit *unit);
int findNodeIndex(Node *node, Nodes &nodeList); int findNodeIndex(Node *node, Nodes &nodeList);
int findNodeIndex(Node *node, std::vector<Node> &nodeList); int findNodeIndex(Node *node, std::vector<Node> &nodeList);

View File

@ -419,17 +419,17 @@ bool GraphicLabel::getCenteredW() const {
bool result = (centered || centeredW == 1); bool result = (centered || centeredW == 1);
return result; return result;
} }
void GraphicLabel::setCenteredW(bool centered) { //void GraphicLabel::setCenteredW(bool centered) {
centeredW = (centered ? 1 : 0); // centeredW = (centered ? 1 : 0);
} //}
bool GraphicLabel::getCenteredH() const { bool GraphicLabel::getCenteredH() const {
bool result = (centered || centeredH == 1); bool result = (centered || centeredH == 1);
return result; return result;
} }
void GraphicLabel::setCenteredH(bool centered) { //void GraphicLabel::setCenteredH(bool centered) {
centeredH = (centered ? 1 : 0); // centeredH = (centered ? 1 : 0);
} //}
// ===================================================== // =====================================================
// class GraphicButton // class GraphicButton

View File

@ -182,10 +182,10 @@ public:
void setCentered(bool centered) {this->centered= centered;} void setCentered(bool centered) {this->centered= centered;}
bool getCenteredW() const; bool getCenteredW() const;
void setCenteredW(bool centered); //void setCenteredW(bool centered);
bool getCenteredH() const; bool getCenteredH() const;
void setCenteredH(bool centered); //void setCenteredH(bool centered);
Vec3f getTextColor() const {return textColor;} Vec3f getTextColor() const {return textColor;}
void setTextColor(Vec3f color) {this->textColor= color;} void setTextColor(Vec3f color) {this->textColor= color;}

View File

@ -513,17 +513,17 @@ int Game::ErrorDisplayMessage(const char *msg, bool exitApp) {
return 0; return 0;
} }
Texture2D * Game::findFactionLogoTexture(const GameSettings *settings, Logger *logger,string factionLogoFilter, bool useTechDefaultIfFilterNotFound) { //Texture2D * Game::findFactionLogoTexture(const GameSettings *settings, Logger *logger,string factionLogoFilter, bool useTechDefaultIfFilterNotFound) {
Texture2D *result = NULL; // Texture2D *result = NULL;
string logoFilename = Game::findFactionLogoFile(settings, logger,factionLogoFilter); // string logoFilename = Game::findFactionLogoFile(settings, logger,factionLogoFilter);
if(logoFilename == "" && factionLogoFilter != "" && useTechDefaultIfFilterNotFound == true) { // if(logoFilename == "" && factionLogoFilter != "" && useTechDefaultIfFilterNotFound == true) {
logoFilename = Game::findFactionLogoFile(settings, logger); // logoFilename = Game::findFactionLogoFile(settings, logger);
} // }
//
result = Renderer::findTexture(logoFilename); // result = Renderer::findTexture(logoFilename);
//
return result; // return result;
} //}
string Game::extractScenarioLogoFile(const GameSettings *settings, string &result, string Game::extractScenarioLogoFile(const GameSettings *settings, string &result,
bool &loadingImageUsed, Logger *logger, string factionLogoFilter) { bool &loadingImageUsed, Logger *logger, string factionLogoFilter) {
@ -6132,16 +6132,16 @@ bool Game::factionLostGame(const Faction *faction) {
return true; return true;
} }
bool Game::hasBuilding(const Faction *faction) { //bool Game::hasBuilding(const Faction *faction) {
if(faction != NULL) { // if(faction != NULL) {
for(int i=0; i<faction->getUnitCount(); ++i) { // for(int i=0; i<faction->getUnitCount(); ++i) {
if(faction->getUnit(i)->getType()->hasSkillClass(scBeBuilt)) { // if(faction->getUnit(i)->getType()->hasSkillClass(scBeBuilt)) {
return true; // return true;
} // }
} // }
} // }
return false; // return false;
} //}
void Game::incSpeed() { void Game::incSpeed() {
if(disableSpeedChange == true) { if(disableSpeedChange == true) {

View File

@ -312,7 +312,7 @@ public:
void endPerformanceTimer(); void endPerformanceTimer();
Vec2i getPerformanceTimerResults(); Vec2i getPerformanceTimerResults();
static Texture2D * findFactionLogoTexture(const GameSettings *settings, Logger *logger=NULL,string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER, bool useTechDefaultIfFilterNotFound=true); //static Texture2D * findFactionLogoTexture(const GameSettings *settings, Logger *logger=NULL,string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER, bool useTechDefaultIfFilterNotFound=true);
static string findFactionLogoFile(const GameSettings *settings, Logger *logger=NULL, const string &factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER); static string findFactionLogoFile(const GameSettings *settings, Logger *logger=NULL, const string &factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER);
static string extractScenarioLogoFile(const GameSettings *settings, string &result, bool &loadingImageUsed, Logger *logger=NULL, string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER); static string extractScenarioLogoFile(const GameSettings *settings, string &result, bool &loadingImageUsed, Logger *logger=NULL, string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER);
static string extractFactionLogoFile(bool &loadingImageUsed, const string &factionName, string scenarioDir, const string &techName, Logger *logger=NULL, string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER); static string extractFactionLogoFile(bool &loadingImageUsed, const string &factionName, string scenarioDir, const string &techName, Logger *logger=NULL, string factionLogoFilter=GameConstants::LOADING_SCREEN_FILE_FILTER);
@ -368,7 +368,7 @@ private:
void checkWinnerScripted(); void checkWinnerScripted();
void setEndGameTeamWinnersAndLosers(); void setEndGameTeamWinnersAndLosers();
bool hasBuilding(const Faction *faction); //bool hasBuilding(const Faction *faction);
bool factionLostGame(const Faction *faction); bool factionLostGame(const Faction *faction);
void incSpeed(); void incSpeed();
void decSpeed(); void decSpeed();

View File

@ -352,12 +352,12 @@ void GameCamera::centerXZ(float x, float z){
destPos.z = pos.z= z+centerOffsetZ; destPos.z = pos.z= z+centerOffsetZ;
} }
void GameCamera::transitionXYZ(float x, float y, float z) { //void GameCamera::transitionXYZ(float x, float y, float z) {
destPos.x += x; // destPos.x += x;
destPos.y += y; // destPos.y += y;
destPos.z += z; // destPos.z += z;
clampPosXYZ(0.0f, (float)limitX, minHeight, maxHeight, 0.0f, (float)limitY); // clampPosXYZ(0.0f, (float)limitX, minHeight, maxHeight, 0.0f, (float)limitY);
} //}
void GameCamera::transitionVH(float v, float h) { void GameCamera::transitionVH(float v, float h) {
destAng.x -= v; destAng.x -= v;

View File

@ -149,7 +149,7 @@ public:
void centerXZ(float x, float z); void centerXZ(float x, float z);
void transitionXYZ(float x, float y, float z); //void transitionXYZ(float x, float y, float z);
void transitionVH(float v, float h); void transitionVH(float v, float h);
void rotateToVH(float v, float h); void rotateToVH(float v, float h);

View File

@ -842,23 +842,23 @@ void Renderer::endMenu() {
//} //}
} }
void Renderer::reloadResources() { //void Renderer::reloadResources() {
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { // if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
return; // return;
} // }
//
for(int i=0; i<rsCount; ++i) { // for(int i=0; i<rsCount; ++i) {
modelManager[i]->end(); // modelManager[i]->end();
textureManager[i]->end(); // textureManager[i]->end();
fontManager[i]->end(); // fontManager[i]->end();
} // }
//
for(int i=0; i<rsCount; ++i) { // for(int i=0; i<rsCount; ++i) {
modelManager[i]->init(); // modelManager[i]->init();
textureManager[i]->init(); // textureManager[i]->init();
fontManager[i]->init(); // fontManager[i]->init();
} // }
} //}
// ==================== engine interface ==================== // ==================== engine interface ====================
@ -962,13 +962,13 @@ void Renderer::endFont(::Shared::Graphics::Font *font, ResourceScope rs, bool mu
fontManager[rs]->endFont(font,mustExistInList); fontManager[rs]->endFont(font,mustExistInList);
} }
void Renderer::resetFontManager(ResourceScope rs) { //void Renderer::resetFontManager(ResourceScope rs) {
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { // if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
return; // return;
} // }
fontManager[rs]->end(); // fontManager[rs]->end();
fontManager[rsGlobal]->init(); // fontManager[rsGlobal]->init();
} //}
void Renderer::addToDeferredParticleSystemList(std::pair<ParticleSystem *, ResourceScope> deferredParticleSystem) { void Renderer::addToDeferredParticleSystemList(std::pair<ParticleSystem *, ResourceScope> deferredParticleSystem) {
deferredParticleSystems.push_back(deferredParticleSystem); deferredParticleSystems.push_back(deferredParticleSystem);
@ -1098,33 +1098,33 @@ void Renderer::setupLighting() {
assertGl(); assertGl();
} }
void Renderer::setupLightingForRotatedModel() { //void Renderer::setupLightingForRotatedModel() {
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { // if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
return; // return;
} // }
//
const World *world= game->getWorld(); // const World *world= game->getWorld();
//const GameCamera *gameCamera= game->getGameCamera(); // //const GameCamera *gameCamera= game->getGameCamera();
const TimeFlow *timeFlow= world->getTimeFlow(); // const TimeFlow *timeFlow= world->getTimeFlow();
float time= timeFlow->getTime(); // float time= timeFlow->getTime();
//
assertGl(); // assertGl();
//
//sun/moon light // //sun/moon light
Vec3f lightColor= timeFlow->computeLightColor(); // Vec3f lightColor= timeFlow->computeLightColor();
Vec3f fogColor= world->getTileset()->getFogColor(); // Vec3f fogColor= world->getTileset()->getFogColor();
Vec4f lightPos= timeFlow->isDay()? computeSunPos(time): computeMoonPos(time); // Vec4f lightPos= timeFlow->isDay()? computeSunPos(time): computeMoonPos(time);
//nearestLightPos= lightPos; // //nearestLightPos= lightPos;
//
glLightfv(GL_LIGHT0, GL_POSITION, lightPos.ptr()); // glLightfv(GL_LIGHT0, GL_POSITION, lightPos.ptr());
glLightfv(GL_LIGHT0, GL_AMBIENT, Vec4f(lightColor*lightAmbFactor, 1.f).ptr()); // glLightfv(GL_LIGHT0, GL_AMBIENT, Vec4f(lightColor*lightAmbFactor, 1.f).ptr());
glLightfv(GL_LIGHT0, GL_DIFFUSE, Vec4f(lightColor, 1.f).ptr()); // glLightfv(GL_LIGHT0, GL_DIFFUSE, Vec4f(lightColor, 1.f).ptr());
glLightfv(GL_LIGHT0, GL_SPECULAR, Vec4f(0.0f, 0.0f, 0.f, 1.f).ptr()); // glLightfv(GL_LIGHT0, GL_SPECULAR, Vec4f(0.0f, 0.0f, 0.f, 1.f).ptr());
//
glFogfv(GL_FOG_COLOR, Vec4f(fogColor*lightColor, 1.f).ptr()); // glFogfv(GL_FOG_COLOR, Vec4f(fogColor*lightColor, 1.f).ptr());
//
assertGl(); // assertGl();
} //}
void Renderer::loadGameCameraMatrix() { void Renderer::loadGameCameraMatrix() {
const GameCamera *gameCamera= game->getGameCamera(); const GameCamera *gameCamera= game->getGameCamera();
@ -1407,30 +1407,30 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
return frustumChanged; return frustumChanged;
} }
bool Renderer::PointInFrustum(vector<vector<float> > &frustum, float x, float y, float z ) { //bool Renderer::PointInFrustum(vector<vector<float> > &frustum, float x, float y, float z ) {
unsigned int p=0; // unsigned int p=0;
//
for( p = 0; p < frustum.size(); p++ ) { // for( p = 0; p < frustum.size(); p++ ) {
if( frustum[p][0] * x + frustum[p][1] * y + frustum[p][2] * z + frustum[p][3] <= 0 ) { // if( frustum[p][0] * x + frustum[p][1] * y + frustum[p][2] * z + frustum[p][3] <= 0 ) {
return false; // return false;
} // }
} // }
return true; // return true;
} //}
//
bool Renderer::SphereInFrustum(vector<vector<float> > &frustum, float x, float y, float z, float radius) { //bool Renderer::SphereInFrustum(vector<vector<float> > &frustum, float x, float y, float z, float radius) {
// Go through all the sides of the frustum // // Go through all the sides of the frustum
for(int i = 0; i < (int)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 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 ) { // 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 // // The distance was greater than the radius so the sphere is outside of the frustum
return false; // return false;
} // }
} // }
//
// The sphere was inside of the frustum! // // The sphere was inside of the frustum!
return true; // return true;
} //}
bool Renderer::CubeInFrustum(vector<vector<float> > &frustum, float x, float y, float z, float size ) { bool Renderer::CubeInFrustum(vector<vector<float> > &frustum, float x, float y, float z, float size ) {
unsigned int p=0; unsigned int p=0;
@ -3994,60 +3994,60 @@ void Renderer::renderMessageBox(GraphicMessageBox *messageBox) {
// ==================== complex rendering ==================== // ==================== complex rendering ====================
VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) { //VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
std::map<uint32,VisibleQuadContainerVBOCache >::iterator iterFind = mapSurfaceVBOCache.find(cellData->uniqueId); // std::map<uint32,VisibleQuadContainerVBOCache >::iterator iterFind = mapSurfaceVBOCache.find(cellData->uniqueId);
if(iterFind == mapSurfaceVBOCache.end()) { // if(iterFind == mapSurfaceVBOCache.end()) {
Vec2f *texCoords = &cellData->texCoords[0]; // Vec2f *texCoords = &cellData->texCoords[0];
Vec2f *texCoordsSurface = &cellData->texCoordsSurface[0]; // Vec2f *texCoordsSurface = &cellData->texCoordsSurface[0];
Vec3f *vertices = &cellData->vertices[0]; // Vec3f *vertices = &cellData->vertices[0];
Vec3f *normals = &cellData->normals[0]; // Vec3f *normals = &cellData->normals[0];
//
VisibleQuadContainerVBOCache vboCache; // VisibleQuadContainerVBOCache vboCache;
//
// Generate And Bind The Vertex Buffer // // Generate And Bind The Vertex Buffer
glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBOVertices ); // Get A Valid Name // glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBOVertices ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOVertices ); // Bind The Buffer // glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOVertices ); // Bind The Buffer
// Load The Data // // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, vertices, GL_STATIC_DRAW_ARB ); // glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, vertices, GL_STATIC_DRAW_ARB );
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); // glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
//
assertGl(); // assertGl();
// Generate And Bind The Texture Coordinate Buffer // // Generate And Bind The Texture Coordinate Buffer
glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBOFowTexCoords ); // Get A Valid Name // glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBOFowTexCoords ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOFowTexCoords ); // Bind The Buffer // glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOFowTexCoords ); // Bind The Buffer
// Load The Data // // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoords, GL_STATIC_DRAW_ARB ); // glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoords, GL_STATIC_DRAW_ARB );
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); // glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
//
assertGl(); // assertGl();
// Generate And Bind The Texture Coordinate Buffer // // Generate And Bind The Texture Coordinate Buffer
glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBOSurfaceTexCoords ); // Get A Valid Name // glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBOSurfaceTexCoords ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOSurfaceTexCoords ); // Bind The Buffer // glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOSurfaceTexCoords ); // Bind The Buffer
// Load The Data // // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoordsSurface, GL_STATIC_DRAW_ARB ); // glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoordsSurface, GL_STATIC_DRAW_ARB );
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); // glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
//
assertGl(); // assertGl();
// Generate And Bind The Normal Buffer // // Generate And Bind The Normal Buffer
glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBONormals ); // Get A Valid Name // glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBONormals ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBONormals ); // Bind The Buffer // glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBONormals ); // Bind The Buffer
// Load The Data // // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, normals, GL_STATIC_DRAW_ARB ); // glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, normals, GL_STATIC_DRAW_ARB );
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); // glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
//
vboCache.hasBuiltVBOs = true; // vboCache.hasBuiltVBOs = true;
//
mapSurfaceVBOCache[cellData->uniqueId] = vboCache; // mapSurfaceVBOCache[cellData->uniqueId] = vboCache;
//
// don't need the data in computer RAM anymore its in the GPU now // // don't need the data in computer RAM anymore its in the GPU now
cellData->texCoords.clear(); // cellData->texCoords.clear();
cellData->texCoordsSurface.clear(); // cellData->texCoordsSurface.clear();
cellData->vertices.clear(); // cellData->vertices.clear();
cellData->normals.clear(); // cellData->normals.clear();
} // }
//
return &mapSurfaceVBOCache[cellData->uniqueId]; // return &mapSurfaceVBOCache[cellData->uniqueId];
} //}
void Renderer::ReleaseSurfaceVBOs() { void Renderer::ReleaseSurfaceVBOs() {
for(std::map<uint32,VisibleQuadContainerVBOCache>::iterator iterFind = mapSurfaceVBOCache.begin(); for(std::map<uint32,VisibleQuadContainerVBOCache>::iterator iterFind = mapSurfaceVBOCache.begin();
@ -7685,31 +7685,31 @@ void Renderer::loadConfig() {
} }
} }
Texture2D *Renderer::saveScreenToTexture(int x, int y, int width, int height) { //Texture2D *Renderer::saveScreenToTexture(int x, int y, int width, int height) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//
Config &config= Config::getInstance(); // Config &config= Config::getInstance();
Texture2D::Filter textureFilter = strToTextureFilter(config.getString("Filter")); // Texture2D::Filter textureFilter = strToTextureFilter(config.getString("Filter"));
int maxAnisotropy = config.getInt("FilterMaxAnisotropy"); // int maxAnisotropy = config.getInt("FilterMaxAnisotropy");
//
Texture2D *texture = GraphicsInterface::getInstance().getFactory()->newTexture2D(); // Texture2D *texture = GraphicsInterface::getInstance().getFactory()->newTexture2D();
texture->setForceCompressionDisabled(true); // texture->setForceCompressionDisabled(true);
texture->setMipmap(false); // texture->setMipmap(false);
Pixmap2D *pixmapScreenShot = texture->getPixmap(); // Pixmap2D *pixmapScreenShot = texture->getPixmap();
pixmapScreenShot->init(width, height, 3); // pixmapScreenShot->init(width, height, 3);
texture->init(textureFilter,maxAnisotropy); // texture->init(textureFilter,maxAnisotropy);
//
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//glFinish(); // //glFinish();
//
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
glReadPixels(x, y, pixmapScreenShot->getW(), pixmapScreenShot->getH(), // glReadPixels(x, y, pixmapScreenShot->getW(), pixmapScreenShot->getH(),
GL_RGB, GL_UNSIGNED_BYTE, pixmapScreenShot->getPixels()); // GL_RGB, GL_UNSIGNED_BYTE, pixmapScreenShot->getPixels());
//
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//
return texture; // return texture;
} //}
void Renderer::saveScreen(const string &path,int w, int h) { void Renderer::saveScreen(const string &path,int w, int h) {
const Metrics &sm= Metrics::getInstance(); const Metrics &sm= Metrics::getInstance();
@ -8303,111 +8303,111 @@ void Renderer::render2dMenuSetup() {
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); //if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
} }
void Renderer::init3dListMenu(const MainMenu *mm) { //void Renderer::init3dListMenu(const MainMenu *mm) {
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { // if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
return; // return;
} // }
//
//this->mm3d = mm; // //this->mm3d = mm;
//printf("In [%s::%s Line: %d] this->custom_mm3d [%p] this->mm3d [%p]\n",__FILE__,__FUNCTION__,__LINE__,this->custom_mm3d,this->mm3d); // //printf("In [%s::%s Line: %d] this->custom_mm3d [%p] this->mm3d [%p]\n",__FILE__,__FUNCTION__,__LINE__,this->custom_mm3d,this->mm3d);
//
/* ///*
assertGl(); // assertGl();
//
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//
const Metrics &metrics= Metrics::getInstance(); // const Metrics &metrics= Metrics::getInstance();
//const MenuBackground *mb= mm->getConstMenuBackground(); // //const MenuBackground *mb= mm->getConstMenuBackground();
const MenuBackground *mb = NULL; // const MenuBackground *mb = NULL;
if(mm != NULL) { // if(mm != NULL) {
mb = mm->getConstMenuBackground(); // mb = mm->getConstMenuBackground();
} // }
//
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//
if(this->customlist3dMenu != NULL) { // if(this->customlist3dMenu != NULL) {
*this->customlist3dMenu = glGenLists(1); // *this->customlist3dMenu = glGenLists(1);
assertGl(); // assertGl();
} // }
else { // else {
list3dMenu= glGenLists(1); // list3dMenu= glGenLists(1);
assertGl(); // assertGl();
list3dMenuValid=true; // list3dMenuValid=true;
} // }
//
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//
if(this->customlist3dMenu != NULL) { // if(this->customlist3dMenu != NULL) {
glNewList(*this->customlist3dMenu, GL_COMPILE); // glNewList(*this->customlist3dMenu, GL_COMPILE);
} // }
else { // else {
glNewList(list3dMenu, GL_COMPILE); // glNewList(list3dMenu, GL_COMPILE);
} // }
//
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//misc // //misc
glViewport(0, 0, metrics.getScreenW(), metrics.getScreenH()); // glViewport(0, 0, metrics.getScreenW(), metrics.getScreenH());
glClearColor(0.4f, 0.4f, 0.4f, 1.f); // glClearColor(0.4f, 0.4f, 0.4f, 1.f);
glFrontFace(GL_CW); // glFrontFace(GL_CW);
glEnable(GL_CULL_FACE); // glEnable(GL_CULL_FACE);
glMatrixMode(GL_PROJECTION); // glMatrixMode(GL_PROJECTION);
glLoadIdentity(); // glLoadIdentity();
gluPerspective(perspFov, metrics.getAspectRatio(), perspNearPlane, 1000000); // gluPerspective(perspFov, metrics.getAspectRatio(), perspNearPlane, 1000000);
//
//texture state // //texture state
glEnable(GL_TEXTURE_2D); // glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
//
//material state // //material state
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, defSpecularColor.ptr()); // glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, defSpecularColor.ptr());
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, defAmbientColor.ptr()); // glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, defAmbientColor.ptr());
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, defDiffuseColor.ptr()); // glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, defDiffuseColor.ptr());
glColor4fv(defColor.ptr()); // glColor4fv(defColor.ptr());
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); // glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
//
//blend state // //blend state
glDisable(GL_BLEND); // glDisable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//
//alpha test state // //alpha test state
glEnable(GL_ALPHA_TEST); // glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.f); // glAlphaFunc(GL_GREATER, 0.f);
//
//depth test state // //depth test state
glEnable(GL_DEPTH_TEST); // glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE); // glDepthMask(GL_TRUE);
glDepthFunc(GL_LESS); // glDepthFunc(GL_LESS);
//
//lighting state // //lighting state
glEnable(GL_LIGHTING); // glEnable(GL_LIGHTING);
//
//matrix mode // //matrix mode
glMatrixMode(GL_MODELVIEW); // glMatrixMode(GL_MODELVIEW);
//
//stencil test // //stencil test
glDisable(GL_STENCIL_TEST); // glDisable(GL_STENCIL_TEST);
//
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//
//fog // //fog
if(mb != NULL && mb->getFog()){ // if(mb != NULL && mb->getFog()){
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//
glEnable(GL_FOG); // glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2); // glFogi(GL_FOG_MODE, GL_EXP2);
glFogf(GL_FOG_DENSITY, mb->getFogDensity()); // glFogf(GL_FOG_DENSITY, mb->getFogDensity());
} // }
//
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//
glEndList(); // glEndList();
//
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
//
//assert // //assert
assertGl(); // assertGl();
*/ //*/
} //}
void Renderer::render3dMenuSetup(const MainMenu *mm) { void Renderer::render3dMenuSetup(const MainMenu *mm) {
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); //if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
@ -8880,60 +8880,60 @@ void Renderer::renderProgressBar(int size, int x, int y, Font2D *font, int custo
} }
void Renderer::renderTile(const Vec2i &pos) { //void Renderer::renderTile(const Vec2i &pos) {
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { // if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
return; // return;
} // }
//
const Map *map= game->getWorld()->getMap(); // const Map *map= game->getWorld()->getMap();
Vec2i scaledPos= pos * Map::cellScale; // Vec2i scaledPos= pos * Map::cellScale;
//
glMatrixMode(GL_MODELVIEW); // glMatrixMode(GL_MODELVIEW);
glPushMatrix(); // glPushMatrix();
glTranslatef(-0.5f, 0.f, -0.5f); // glTranslatef(-0.5f, 0.f, -0.5f);
//
glInitNames(); // glInitNames();
for(int i=0; i < Map::cellScale; ++i) { // for(int i=0; i < Map::cellScale; ++i) {
for(int j=0; j < Map::cellScale; ++j) { // for(int j=0; j < Map::cellScale; ++j) {
//
Vec2i renderPos= scaledPos + Vec2i(i, j); // Vec2i renderPos= scaledPos + Vec2i(i, j);
//
glPushName(renderPos.y); // glPushName(renderPos.y);
glPushName(renderPos.x); // glPushName(renderPos.x);
//
glDisable(GL_CULL_FACE); // glDisable(GL_CULL_FACE);
//
float h1 = map->getCell(renderPos.x, renderPos.y)->getHeight(); // float h1 = map->getCell(renderPos.x, renderPos.y)->getHeight();
float h2 = map->getCell(renderPos.x, renderPos.y+1)->getHeight(); // float h2 = map->getCell(renderPos.x, renderPos.y+1)->getHeight();
float h3 = map->getCell(renderPos.x+1, renderPos.y)->getHeight(); // float h3 = map->getCell(renderPos.x+1, renderPos.y)->getHeight();
float h4 = map->getCell(renderPos.x+1, renderPos.y+1)->getHeight(); // float h4 = map->getCell(renderPos.x+1, renderPos.y+1)->getHeight();
//
glBegin(GL_TRIANGLE_STRIP); // glBegin(GL_TRIANGLE_STRIP);
glVertex3f( // glVertex3f(
static_cast<float>(renderPos.x), // static_cast<float>(renderPos.x),
h1, // h1,
static_cast<float>(renderPos.y)); // static_cast<float>(renderPos.y));
glVertex3f( // glVertex3f(
static_cast<float>(renderPos.x), // static_cast<float>(renderPos.x),
h2, // h2,
static_cast<float>(renderPos.y+1)); // static_cast<float>(renderPos.y+1));
glVertex3f( // glVertex3f(
static_cast<float>(renderPos.x+1), // static_cast<float>(renderPos.x+1),
h3, // h3,
static_cast<float>(renderPos.y)); // static_cast<float>(renderPos.y));
glVertex3f( // glVertex3f(
static_cast<float>(renderPos.x+1), // static_cast<float>(renderPos.x+1),
h4, // h4,
static_cast<float>(renderPos.y+1)); // static_cast<float>(renderPos.y+1));
glEnd(); // glEnd();
//
glPopName(); // glPopName();
glPopName(); // glPopName();
} // }
} // }
//
glPopMatrix(); // glPopMatrix();
} //}
void Renderer::renderQuad(int x, int y, int w, int h, const Texture2D *texture) { void Renderer::renderQuad(int x, int y, int w, int h, const Texture2D *texture) {
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
@ -9404,16 +9404,16 @@ std::pair<bool,Vec3f> Renderer::posInCellQuadCache(Vec2i pos) {
return result; return result;
} }
Vec3f Renderer::getMarkedCellScreenPosQuadCache(Vec2i pos) { //Vec3f Renderer::getMarkedCellScreenPosQuadCache(Vec2i pos) {
Vec3f result(-1,-1,-1); // Vec3f result(-1,-1,-1);
if(std::find( // if(std::find(
quadCache.visibleScaledCellList.begin(), // quadCache.visibleScaledCellList.begin(),
quadCache.visibleScaledCellList.end(), // quadCache.visibleScaledCellList.end(),
pos) != quadCache.visibleScaledCellList.end()) { // pos) != quadCache.visibleScaledCellList.end()) {
result = quadCache.visibleScaledCellToScreenPosList[pos]; // result = quadCache.visibleScaledCellToScreenPosList[pos];
} // }
return result; // return result;
} //}
void Renderer::beginRenderToTexture(Texture2D **renderToTexture) { void Renderer::beginRenderToTexture(Texture2D **renderToTexture) {
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {

View File

@ -353,7 +353,7 @@ private:
vector<Vec3f> normals; vector<Vec3f> normals;
}; };
VisibleQuadContainerVBOCache * GetSurfaceVBOs(SurfaceData *cellData); //VisibleQuadContainerVBOCache * GetSurfaceVBOs(SurfaceData *cellData);
void ReleaseSurfaceVBOs(); void ReleaseSurfaceVBOs();
std::map<string,std::pair<Chrono, std::vector<SurfaceData> > > mapSurfaceData; std::map<string,std::pair<Chrono, std::vector<SurfaceData> > > mapSurfaceData;
static bool rendererEnded; static bool rendererEnded;
@ -427,8 +427,8 @@ private:
} mapRenderer; } mapRenderer;
bool ExtractFrustum(VisibleQuadContainerCache &quadCacheItem); bool ExtractFrustum(VisibleQuadContainerCache &quadCacheItem);
bool PointInFrustum(vector<vector<float> > &frustum, float x, float y, float z ); //bool PointInFrustum(vector<vector<float> > &frustum, float x, float y, float z );
bool SphereInFrustum(vector<vector<float> > &frustum, float x, float y, float z, float radius); //bool SphereInFrustum(vector<vector<float> > &frustum, float x, float y, float z, float radius);
bool CubeInFrustum(vector<vector<float> > &frustum, float x, float y, float z, float size ); bool CubeInFrustum(vector<vector<float> > &frustum, float x, float y, float z, float size );
private: private:
@ -464,7 +464,7 @@ public:
inline int getPointCount() const {return pointCount;} inline int getPointCount() const {return pointCount;}
//misc //misc
void reloadResources(); //void reloadResources();
//engine interface //engine interface
void initTexture(ResourceScope rs, Texture *texture); void initTexture(ResourceScope rs, Texture *texture);
@ -480,7 +480,7 @@ public:
Font2D *newFont(ResourceScope rs); Font2D *newFont(ResourceScope rs);
Font3D *newFont3D(ResourceScope rs); Font3D *newFont3D(ResourceScope rs);
void endFont(::Shared::Graphics::Font *font, ResourceScope rs, bool mustExistInList=false); void endFont(::Shared::Graphics::Font *font, ResourceScope rs, bool mustExistInList=false);
void resetFontManager(ResourceScope rs); //void resetFontManager(ResourceScope rs);
inline TextRenderer2D *getTextRenderer() const {return textRenderer;} inline TextRenderer2D *getTextRenderer() const {return textRenderer;}
inline TextRenderer3D *getTextRenderer3D() const {return textRenderer3D;} inline TextRenderer3D *getTextRenderer3D() const {return textRenderer3D;}
@ -496,7 +496,7 @@ public:
//lights and camera //lights and camera
void setupLighting(); void setupLighting();
void setupLightingForRotatedModel(); //void setupLightingForRotatedModel();
void loadGameCameraMatrix(); void loadGameCameraMatrix();
void loadCameraMatrix(const Camera *camera); void loadCameraMatrix(const Camera *camera);
void computeVisibleQuad(); void computeVisibleQuad();
@ -630,7 +630,7 @@ public:
VisibleQuadContainerCache & getQuadCache(bool updateOnDirtyFrame=true,bool forceNew=false); VisibleQuadContainerCache & getQuadCache(bool updateOnDirtyFrame=true,bool forceNew=false);
std::pair<bool,Vec3f> posInCellQuadCache(Vec2i pos); std::pair<bool,Vec3f> posInCellQuadCache(Vec2i pos);
Vec3f getMarkedCellScreenPosQuadCache(Vec2i pos); //Vec3f getMarkedCellScreenPosQuadCache(Vec2i pos);
void updateMarkedCellScreenPosQuadCache(Vec2i pos); void updateMarkedCellScreenPosQuadCache(Vec2i pos);
void forceQuadCacheUpdate(); void forceQuadCacheUpdate();
void renderVisibleMarkedCells(bool renderTextHint=false,int x=-1, int y=-1); void renderVisibleMarkedCells(bool renderTextHint=false,int x=-1, int y=-1);
@ -644,7 +644,7 @@ public:
std::size_t getCurrentPixelByteCount(ResourceScope rs=rsGame) const; std::size_t getCurrentPixelByteCount(ResourceScope rs=rsGame) const;
unsigned int getSaveScreenQueueSize(); unsigned int getSaveScreenQueueSize();
Texture2D *saveScreenToTexture(int x, int y, int width, int height); //Texture2D *saveScreenToTexture(int x, int y, int width, int height);
void renderProgressBar(int size, int x, int y, Font2D *font,int customWidth=-1, string prefixLabel="", bool centeredText=true); void renderProgressBar(int size, int x, int y, Font2D *font,int customWidth=-1, string prefixLabel="", bool centeredText=true);
@ -657,7 +657,7 @@ public:
void setCustom3dMenu(const MainMenu *mm) { this->custom_mm3d = mm; } void setCustom3dMenu(const MainMenu *mm) { this->custom_mm3d = mm; }
const MainMenu * getCustom3dMenu() { return this->custom_mm3d; } const MainMenu * getCustom3dMenu() { return this->custom_mm3d; }
void init3dListMenu(const MainMenu *mm); //void init3dListMenu(const MainMenu *mm);
void setProgram(Program *program) { this->program = program; } void setProgram(Program *program) { this->program = program; }
@ -699,7 +699,7 @@ private:
void internalRenderHp(int numberOfBars, int barNumber, float hp, Vec3f posVector, float width, float singleHPheight, Vec3f rightVector, Vec3f upVector); void internalRenderHp(int numberOfBars, int barNumber, float hp, Vec3f posVector, float width, float singleHPheight, Vec3f rightVector, Vec3f upVector);
void renderTeamColorEffect(Vec3f &v, int heigth, int size, Vec3f color, const Texture2D *texture); void renderTeamColorEffect(Vec3f &v, int heigth, int size, Vec3f color, const Texture2D *texture);
void renderArrow(const Vec3f &pos1, const Vec3f &pos2, const Vec3f &color, float width); void renderArrow(const Vec3f &pos1, const Vec3f &pos2, const Vec3f &color, float width);
void renderTile(const Vec2i &pos); //void renderTile(const Vec2i &pos);
void renderQuad(int x, int y, int w, int h, const Texture2D *texture); void renderQuad(int x, int y, int w, int h, const Texture2D *texture);
void simpleTask(BaseThread *callingThread,void *userdata); void simpleTask(BaseThread *callingThread,void *userdata);

View File

@ -324,12 +324,12 @@ void Selection::removeUnitFromGroup(int groupIndex,int unitId) {
} }
} }
vector<Unit*> Selection::getUnitsForGroup(int groupIndex) { //vector<Unit*> Selection::getUnitsForGroup(int groupIndex) {
if(groupIndex < 0 || groupIndex >= maxGroups) { // if(groupIndex < 0 || groupIndex >= maxGroups) {
throw megaglest_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex)); // throw megaglest_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex));
} // }
return groups[groupIndex]; // return groups[groupIndex];
} //}
void Selection::recallGroup(int groupIndex,bool clearSelection){ void Selection::recallGroup(int groupIndex,bool clearSelection){
if(groupIndex < 0 || groupIndex >= maxGroups) { if(groupIndex < 0 || groupIndex >= maxGroups) {

View File

@ -94,7 +94,7 @@ public:
void removeUnitFromGroup(int groupIndex,int UnitId); void removeUnitFromGroup(int groupIndex,int UnitId);
void recallGroup(int groupIndex, bool clearSelection=true); void recallGroup(int groupIndex, bool clearSelection=true);
vector<Unit*> getUnitsForGroup(int groupIndex); //vector<Unit*> getUnitsForGroup(int groupIndex);
virtual void unitEvent(UnitObserver::Event event, const Unit *unit); virtual void unitEvent(UnitObserver::Event event, const Unit *unit);
bool canSelectUnitFactionCheck(const Unit *unit) const; bool canSelectUnitFactionCheck(const Unit *unit) const;

View File

@ -967,19 +967,19 @@ void Program::resetSoundSystem() {
startSoundSystem(); startSoundSystem();
} }
void Program::reInitGl() { //void Program::reInitGl() {
if(window != NULL) { // if(window != NULL) {
Config &config= Config::getInstance(); // Config &config= Config::getInstance();
window->initGl(config.getInt("ColorBits"), // window->initGl(config.getInt("ColorBits"),
config.getInt("DepthBits"), // config.getInt("DepthBits"),
config.getInt("StencilBits"), // config.getInt("StencilBits"),
config.getBool("HardwareAcceleration","false"), // config.getBool("HardwareAcceleration","false"),
config.getBool("FullScreenAntiAliasing","false"), // config.getBool("FullScreenAntiAliasing","false"),
config.getFloat("GammaValue","0.0")); // config.getFloat("GammaValue","0.0"));
window->setText(config.getString("WindowTitle","MegaGlest")); // window->setText(config.getString("WindowTitle","MegaGlest"));
initResolution(); // initResolution();
} // }
} //}
void Program::consoleAddLine(string line) { void Program::consoleAddLine(string line) {
if(programState != NULL) { if(programState != NULL) {

View File

@ -222,7 +222,7 @@ public:
void renderProgramMsgBox(); void renderProgramMsgBox();
bool isInSpecialKeyCaptureEvent() { return programState->isInSpecialKeyCaptureEvent(); } bool isInSpecialKeyCaptureEvent() { return programState->isInSpecialKeyCaptureEvent(); }
void reInitGl(); //void reInitGl();
void resetSoundSystem(); void resetSoundSystem();
void stopSoundSystem(); void stopSoundSystem();
void startSoundSystem(); void startSoundSystem();

View File

@ -405,11 +405,11 @@ void MenuStateMasterserver::reloadUI() {
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName); GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
} }
void MenuStateMasterserver::setConsolePos(int yPos){ //void MenuStateMasterserver::setConsolePos(int yPos){
consoleIRC.setYPos(yPos); // consoleIRC.setYPos(yPos);
lines[2].setY(consoleIRC.getYPos()-10); // lines[2].setY(consoleIRC.getYPos()-10);
chatManager.setYPos(consoleIRC.getYPos()-20); // chatManager.setYPos(consoleIRC.getYPos()-20);
} //}
void MenuStateMasterserver::setButtonLinePosition(int pos){ void MenuStateMasterserver::setButtonLinePosition(int pos){
buttonReturn.setY(pos); buttonReturn.setY(pos);

View File

@ -135,7 +135,7 @@ public:
private: private:
void showMessageBox(const string &text, const string &header, bool toggle); void showMessageBox(const string &text, const string &header, bool toggle);
bool connectToServer(string ipString, int port); bool connectToServer(string ipString, int port);
void setConsolePos(int yPos); //void setConsolePos(int yPos);
void setButtonLinePosition(int pos); void setButtonLinePosition(int pos);
void clearServerLines(); void clearServerLines();
void clearUserButtons(); void clearUserButtons();

View File

@ -98,10 +98,10 @@ void ConnectionSlotThread::setTaskCompleted(int eventId) {
} }
} }
void ConnectionSlotThread::purgeAllEvents() { //void ConnectionSlotThread::purgeAllEvents() {
MutexSafeWrapper safeMutex(triggerIdMutex,CODE_AT_LINE); // MutexSafeWrapper safeMutex(triggerIdMutex,CODE_AT_LINE);
eventList.clear(); // eventList.clear();
} //}
void ConnectionSlotThread::setAllEventsCompleted() { void ConnectionSlotThread::setAllEventsCompleted() {
MutexSafeWrapper safeMutex(triggerIdMutex,CODE_AT_LINE); MutexSafeWrapper safeMutex(triggerIdMutex,CODE_AT_LINE);
@ -1574,12 +1574,12 @@ vector<NetworkCommand> ConnectionSlot::getPendingNetworkCommandList(bool clearLi
return ret; return ret;
} }
void ConnectionSlot::clearPendingNetworkCommandList() { //void ConnectionSlot::clearPendingNetworkCommandList() {
MutexSafeWrapper safeMutexSlot(mutexPendingNetworkCommandList,CODE_AT_LINE); // MutexSafeWrapper safeMutexSlot(mutexPendingNetworkCommandList,CODE_AT_LINE);
if(vctPendingNetworkCommandList.empty() == false) { // if(vctPendingNetworkCommandList.empty() == false) {
vctPendingNetworkCommandList.clear(); // vctPendingNetworkCommandList.clear();
} // }
} //}
bool ConnectionSlot::hasValidSocketId() { bool ConnectionSlot::hasValidSocketId() {
bool result = false; bool result = false;

View File

@ -114,7 +114,7 @@ public:
void setSlotIndex(int index) { this->slotIndex = index; } void setSlotIndex(int index) { this->slotIndex = index; }
void purgeCompletedEvents(); void purgeCompletedEvents();
void purgeAllEvents(); //void purgeAllEvents();
void setAllEventsCompleted(); void setAllEventsCompleted();
virtual bool canShutdown(bool deleteSelfIfShutdownDelayed=false); virtual bool canShutdown(bool deleteSelfIfShutdownDelayed=false);
@ -222,7 +222,7 @@ public:
void clearThreadErrorList() { threadErrorList.clear(); } void clearThreadErrorList() { threadErrorList.clear(); }
vector<NetworkCommand> getPendingNetworkCommandList(bool clearList=false); vector<NetworkCommand> getPendingNetworkCommandList(bool clearList=false);
void clearPendingNetworkCommandList(); //void clearPendingNetworkCommandList();
void signalUpdate(ConnectionSlotEvent *event); void signalUpdate(ConnectionSlotEvent *event);
bool updateCompleted(ConnectionSlotEvent *event); bool updateCompleted(ConnectionSlotEvent *event);

View File

@ -151,9 +151,9 @@ struct SteamPrivate {
STEAMSHIM_setStatF(name, value); STEAMSHIM_setStatF(name, value);
update(); update();
} }
void clearLocalStats() { // void clearLocalStats() {
stats.clear(); // stats.clear();
} // }
const STEAMSHIM_Event * update(STEAMSHIM_EventType *waitForEvent=NULL) { const STEAMSHIM_Event * update(STEAMSHIM_EventType *waitForEvent=NULL) {
const STEAMSHIM_Event *e; const STEAMSHIM_Event *e;

View File

@ -92,9 +92,9 @@ void Command::setPos(const Vec2i &pos){
this->pos= pos; this->pos= pos;
} }
void Command::setOriginalPos(const Vec2i &pos) { //void Command::setOriginalPos(const Vec2i &pos) {
this->originalPos= pos; // this->originalPos= pos;
} //}
void Command::setPosToOriginalPos() { void Command::setPosToOriginalPos() {
this->pos= this->originalPos; this->pos= this->originalPos;

View File

@ -77,7 +77,7 @@ public:
//set //set
void setCommandType(const CommandType *commandType); void setCommandType(const CommandType *commandType);
void setPos(const Vec2i &pos); void setPos(const Vec2i &pos);
void setOriginalPos(const Vec2i &pos); //void setOriginalPos(const Vec2i &pos);
void setPosToOriginalPos(); void setPosToOriginalPos();
void setUnit(Unit *unit); void setUnit(Unit *unit);

View File

@ -633,18 +633,18 @@ void Faction::removeUnitFromMovingList(int unitId) {
unitsMovingList.erase(unitId); unitsMovingList.erase(unitId);
} }
int Faction::getUnitMovingListCount() { //int Faction::getUnitMovingListCount() {
return (int)unitsMovingList.size(); // return (int)unitsMovingList.size();
} //}
void Faction::addUnitToPathfindingList(int unitId) { void Faction::addUnitToPathfindingList(int unitId) {
//printf("ADD (1) Faction [%d - %s] threaded updates for [%d] units\n",this->getStartLocationIndex(),this->getType()->getName().c_str(),unitsPathfindingList.size()); //printf("ADD (1) Faction [%d - %s] threaded updates for [%d] units\n",this->getStartLocationIndex(),this->getType()->getName().c_str(),unitsPathfindingList.size());
unitsPathfindingList[unitId] = getWorld()->getFrameCount(); unitsPathfindingList[unitId] = getWorld()->getFrameCount();
//printf("ADD (2) Faction [%d - %s] threaded updates for [%d] units\n",this->getStartLocationIndex(),this->getType()->getName().c_str(),unitsPathfindingList.size()); //printf("ADD (2) Faction [%d - %s] threaded updates for [%d] units\n",this->getStartLocationIndex(),this->getType()->getName().c_str(),unitsPathfindingList.size());
} }
void Faction::removeUnitFromPathfindingList(int unitId) { //void Faction::removeUnitFromPathfindingList(int unitId) {
unitsPathfindingList.erase(unitId); // unitsPathfindingList.erase(unitId);
} //}
int Faction::getUnitPathfindingListCount() { int Faction::getUnitPathfindingListCount() {
//printf("GET Faction [%d - %s] threaded updates for [%d] units\n",this->getStartLocationIndex(),this->getType()->getName().c_str(),unitsPathfindingList.size()); //printf("GET Faction [%d - %s] threaded updates for [%d] units\n",this->getStartLocationIndex(),this->getType()->getName().c_str(),unitsPathfindingList.size());
@ -1939,84 +1939,84 @@ void Faction::deletePixels() {
} }
} }
Unit * Faction::findClosestUnitWithSkillClass( const Vec2i &pos,const CommandClass &cmdClass, //Unit * Faction::findClosestUnitWithSkillClass( const Vec2i &pos,const CommandClass &cmdClass,
const std::vector<SkillClass> &skillClassList, // const std::vector<SkillClass> &skillClassList,
const UnitType *unitType) { // const UnitType *unitType) {
Unit *result = NULL; // Unit *result = NULL;
//
/* ///*
std::map<CommandClass,std::map<int,int> >::iterator iterFind = cacheUnitCommandClassList.find(cmdClass); // std::map<CommandClass,std::map<int,int> >::iterator iterFind = cacheUnitCommandClassList.find(cmdClass);
if(iterFind != cacheUnitCommandClassList.end()) { // if(iterFind != cacheUnitCommandClassList.end()) {
for(std::map<int,int>::iterator iter = iterFind->second.begin(); // for(std::map<int,int>::iterator iter = iterFind->second.begin();
iter != iterFind->second.end(); ++iter) { // iter != iterFind->second.end(); ++iter) {
Unit *curUnit = findUnit(iter->second); // Unit *curUnit = findUnit(iter->second);
if(curUnit != NULL) { // if(curUnit != NULL) {
//
const CommandType *cmdType = curUnit->getType()->getFirstCtOfClass(cmdClass); // const CommandType *cmdType = curUnit->getType()->getFirstCtOfClass(cmdClass);
bool isUnitPossibleCandidate = (cmdType != NULL); // bool isUnitPossibleCandidate = (cmdType != NULL);
if(skillClassList.empty() == false) { // if(skillClassList.empty() == false) {
isUnitPossibleCandidate = false; // isUnitPossibleCandidate = false;
//
for(int j = 0; j < skillClassList.size(); ++j) { // for(int j = 0; j < skillClassList.size(); ++j) {
SkillClass skValue = skillClassList[j]; // SkillClass skValue = skillClassList[j];
if(curUnit->getCurrSkill()->getClass() == skValue) { // if(curUnit->getCurrSkill()->getClass() == skValue) {
isUnitPossibleCandidate = true; // isUnitPossibleCandidate = true;
break; // break;
} // }
} // }
} // }
//
if(isUnitPossibleCandidate == true) { // if(isUnitPossibleCandidate == true) {
if(result == NULL || curUnit->getPos().dist(pos) < result->getPos().dist(pos)) { // if(result == NULL || curUnit->getPos().dist(pos) < result->getPos().dist(pos)) {
result = curUnit; // result = curUnit;
} // }
} // }
} // }
} // }
} // }
*/ //*/
//
//if(result == NULL) { // //if(result == NULL) {
for(int i = 0; i < getUnitCount(); ++i) { // for(int i = 0; i < getUnitCount(); ++i) {
Unit *curUnit = getUnit(i); // Unit *curUnit = getUnit(i);
//
bool isUnitPossibleCandidate = false; // bool isUnitPossibleCandidate = false;
//
const CommandType *cmdType = curUnit->getType()->getFirstCtOfClass(cmdClass); // const CommandType *cmdType = curUnit->getType()->getFirstCtOfClass(cmdClass);
if(cmdType != NULL) { // if(cmdType != NULL) {
const RepairCommandType *rct = dynamic_cast<const RepairCommandType *>(cmdType); // const RepairCommandType *rct = dynamic_cast<const RepairCommandType *>(cmdType);
if(rct != NULL && rct->isRepairableUnitType(unitType)) { // if(rct != NULL && rct->isRepairableUnitType(unitType)) {
isUnitPossibleCandidate = true; // isUnitPossibleCandidate = true;
} // }
} // }
else { // else {
isUnitPossibleCandidate = false; // isUnitPossibleCandidate = false;
} // }
//
if(isUnitPossibleCandidate == true && skillClassList.empty() == false) { // if(isUnitPossibleCandidate == true && skillClassList.empty() == false) {
isUnitPossibleCandidate = false; // isUnitPossibleCandidate = false;
//
for(int j = 0; j < (int)skillClassList.size(); ++j) { // for(int j = 0; j < (int)skillClassList.size(); ++j) {
SkillClass skValue = skillClassList[j]; // SkillClass skValue = skillClassList[j];
if(curUnit->getCurrSkill()->getClass() == skValue) { // if(curUnit->getCurrSkill()->getClass() == skValue) {
isUnitPossibleCandidate = true; // isUnitPossibleCandidate = true;
break; // break;
} // }
} // }
} // }
//
//
if(isUnitPossibleCandidate == true) { // if(isUnitPossibleCandidate == true) {
//cacheUnitCommandClassList[cmdClass][curUnit->getId()] = curUnit->getId(); // //cacheUnitCommandClassList[cmdClass][curUnit->getId()] = curUnit->getId();
//
if(result == NULL || curUnit->getPos().dist(pos) < result->getPos().dist(pos)) { // if(result == NULL || curUnit->getPos().dist(pos) < result->getPos().dist(pos)) {
result = curUnit; // result = curUnit;
} // }
} // }
} // }
//} // //}
return result; // return result;
} //}
int Faction::getFrameCount() { int Faction::getFrameCount() {
int frameCount = 0; int frameCount = 0;

View File

@ -238,10 +238,10 @@ public:
//std::map<int,int> unitsMovingList; //std::map<int,int> unitsMovingList;
void addUnitToMovingList(int unitId); void addUnitToMovingList(int unitId);
void removeUnitFromMovingList(int unitId); void removeUnitFromMovingList(int unitId);
int getUnitMovingListCount(); //int getUnitMovingListCount();
void addUnitToPathfindingList(int unitId); void addUnitToPathfindingList(int unitId);
void removeUnitFromPathfindingList(int unitId); //void removeUnitFromPathfindingList(int unitId);
int getUnitPathfindingListCount(); int getUnitPathfindingListCount();
void clearUnitsPathfinding(); void clearUnitsPathfinding();
bool canUnitsPathfind(); bool canUnitsPathfind();
@ -347,9 +347,9 @@ public:
void cleanupResourceTypeTargetCache(std::vector<Vec2i> *deleteListPtr,int frameIndex); void cleanupResourceTypeTargetCache(std::vector<Vec2i> *deleteListPtr,int frameIndex);
inline int getCacheResourceTargetListSize() const { return (int)cacheResourceTargetList.size(); } inline int getCacheResourceTargetListSize() const { return (int)cacheResourceTargetList.size(); }
Unit * findClosestUnitWithSkillClass(const Vec2i &pos,const CommandClass &cmdClass, // Unit * findClosestUnitWithSkillClass(const Vec2i &pos,const CommandClass &cmdClass,
const std::vector<SkillClass> &skillClassList, // const std::vector<SkillClass> &skillClassList,
const UnitType *unitType); // const UnitType *unitType);
void deletePixels(); void deletePixels();

View File

@ -195,20 +195,20 @@ Checksum UnitPathBasic::getCRC() {
// class UnitPath // class UnitPath
// ===================================================== // =====================================================
void WaypointPath::condense() { //void WaypointPath::condense() {
if (size() < 2) { // if (size() < 2) {
return; // return;
} // }
iterator prev, curr; // iterator prev, curr;
prev = curr = begin(); // prev = curr = begin();
while (++curr != end()) { // while (++curr != end()) {
if (prev->dist(*curr) < 3.f) { // if (prev->dist(*curr) < 3.f) {
prev = erase(prev); // prev = erase(prev);
} else { // } else {
++prev; // ++prev;
} // }
} // }
} //}
std::string UnitPath::toString() const { std::string UnitPath::toString() const {
std::string result = "unit path blockCount = " + intToStr(blockCount) + " pathQueue size = " + intToStr(size()); std::string result = "unit path blockCount = " + intToStr(blockCount) + " pathQueue size = " + intToStr(size());
@ -866,17 +866,17 @@ void Unit::setModelFacing(CardinalDir value) {
lastRotation = targetRotation = rotation = value * 90.f; lastRotation = targetRotation = rotation = value * 90.f;
} }
void Unit::setCurrField(Field currField) { //void Unit::setCurrField(Field currField) {
Field original_field = this->currField; // Field original_field = this->currField;
//
this->currField = currField; // this->currField = currField;
//
if(original_field != this->currField) { // if(original_field != this->currField) {
//printf("File: %s line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__); // //printf("File: %s line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
game->getScriptManager()->onUnitTriggerEvent(this,utet_FieldChanged); // game->getScriptManager()->onUnitTriggerEvent(this,utet_FieldChanged);
//printf("File: %s line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__); // //printf("File: %s line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
} // }
} //}
// ====================================== get ====================================== // ====================================== get ======================================
Vec2i Unit::getCenteredPos() const { Vec2i Unit::getCenteredPos() const {
@ -2163,9 +2163,9 @@ void Unit::addObserver(UnitObserver *unitObserver){
observers.push_back(unitObserver); observers.push_back(unitObserver);
} }
void Unit::removeObserver(UnitObserver *unitObserver){ //void Unit::removeObserver(UnitObserver *unitObserver){
observers.remove(unitObserver); // observers.remove(unitObserver);
} //}
void Unit::notifyObservers(UnitObserver::Event event){ void Unit::notifyObservers(UnitObserver::Event event){
for(Observers::iterator it= observers.begin(); it!=observers.end(); ++it){ for(Observers::iterator it= observers.begin(); it!=observers.end(); ++it){
@ -4568,13 +4568,13 @@ void Unit::addBadHarvestPos(const Vec2i &value) {
cleanupOldBadHarvestPos(); cleanupOldBadHarvestPos();
} }
void Unit::removeBadHarvestPos(const Vec2i &value) { //void Unit::removeBadHarvestPos(const Vec2i &value) {
std::map<Vec2i,int>::iterator iter = badHarvestPosList.find(value); // std::map<Vec2i,int>::iterator iter = badHarvestPosList.find(value);
if(iter != badHarvestPosList.end()) { // if(iter != badHarvestPosList.end()) {
badHarvestPosList.erase(value); // badHarvestPosList.erase(value);
} // }
cleanupOldBadHarvestPos(); // cleanupOldBadHarvestPos();
} //}
void Unit::cleanupOldBadHarvestPos() { void Unit::cleanupOldBadHarvestPos() {
const unsigned int cleanupInterval = (GameConstants::updateFps * 5); const unsigned int cleanupInterval = (GameConstants::updateFps * 5);

View File

@ -284,7 +284,7 @@ public:
void push(const Vec2i &pos) { push_front(pos); } void push(const Vec2i &pos) { push_front(pos); }
Vec2i peek() const {return front();} Vec2i peek() const {return front();}
void pop() {erase(begin());} void pop() {erase(begin());}
void condense(); //void condense();
}; };
@ -613,7 +613,7 @@ public:
bool isInteresting(InterestingUnitType iut) const; bool isInteresting(InterestingUnitType iut) const;
//set //set
void setCurrField(Field currField); //void setCurrField(Field currField);
void setCurrSkill(const SkillType *currSkill); void setCurrSkill(const SkillType *currSkill);
void setCurrSkill(SkillClass sc); void setCurrSkill(SkillClass sc);
@ -668,7 +668,7 @@ public:
//observers //observers
void addObserver(UnitObserver *unitObserver) ; void addObserver(UnitObserver *unitObserver) ;
void removeObserver(UnitObserver *unitObserver); //void removeObserver(UnitObserver *unitObserver);
void notifyObservers(UnitObserver::Event event); void notifyObservers(UnitObserver::Event event);
//other //other
@ -720,7 +720,7 @@ public:
//std::vector<std::pair<Vec2i,Chrono> > getBadHarvestPosList() const { return badHarvestPosList; } //std::vector<std::pair<Vec2i,Chrono> > getBadHarvestPosList() const { return badHarvestPosList; }
//void setBadHarvestPosList(std::vector<std::pair<Vec2i,Chrono> > value) { badHarvestPosList = value; } //void setBadHarvestPosList(std::vector<std::pair<Vec2i,Chrono> > value) { badHarvestPosList = value; }
void addBadHarvestPos(const Vec2i &value); void addBadHarvestPos(const Vec2i &value);
void removeBadHarvestPos(const Vec2i &value); //void removeBadHarvestPos(const Vec2i &value);
inline bool isBadHarvestPos(const Vec2i &value,bool checkPeerUnits=true) const { inline bool isBadHarvestPos(const Vec2i &value,bool checkPeerUnits=true) const {
bool result = false; bool result = false;
if(badHarvestPosList.empty() == true) { if(badHarvestPosList.empty() == true) {

View File

@ -915,25 +915,25 @@ const UnitType *FactionType::getUnitType(const string &name) const{
throw megaglest_runtime_error("Unit type not found: [" + name + "] in faction type [" + this->name + "]",true); throw megaglest_runtime_error("Unit type not found: [" + name + "] in faction type [" + this->name + "]",true);
} }
const UnitType *FactionType::getUnitTypeById(int id) const{ //const UnitType *FactionType::getUnitTypeById(int id) const{
for(int i=0; i < (int)unitTypes.size();i++){ // for(int i=0; i < (int)unitTypes.size();i++){
if(unitTypes[i].getId() == id) { // if(unitTypes[i].getId() == id) {
return &unitTypes[i]; // 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()); // 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 < (int)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()); // 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()); // 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 < (int)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()); // 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());
} // }
//
throw megaglest_runtime_error("Unit type not found: [" + intToStr(id) + "] in faction type [" + this->name + "]",true); // throw megaglest_runtime_error("Unit type not found: [" + intToStr(id) + "] in faction type [" + this->name + "]",true);
} //}
const UpgradeType *FactionType::getUpgradeType(const string &name) const{ const UpgradeType *FactionType::getUpgradeType(const string &name) const{
for(int i=0; i < (int)upgradeTypes.size();i++){ for(int i=0; i < (int)upgradeTypes.size();i++){

View File

@ -142,7 +142,7 @@ public:
const UnitType *getUnitType(const string &name) const; const UnitType *getUnitType(const string &name) const;
const UnitType *getUnitTypeById(int id) const; //const UnitType *getUnitTypeById(int id) const;
const UpgradeType *getUpgradeType(const string &name) const; const UpgradeType *getUpgradeType(const string &name) const;
int getStartingResourceAmount(const ResourceType *resourceType) const; int getStartingResourceAmount(const ResourceType *resourceType) const;

View File

@ -1184,15 +1184,15 @@ bool UnitType::hasCommandType(const CommandType *commandType) const {
return false; return false;
} }
bool UnitType::hasSkillType(const SkillType *skillType) const { //bool UnitType::hasSkillType(const SkillType *skillType) const {
assert(skillType!=NULL); // assert(skillType!=NULL);
for(int i=0; i < (int)skillTypes.size(); ++i) { // for(int i=0; i < (int)skillTypes.size(); ++i) {
if(skillTypes[i]==skillType) { // if(skillTypes[i]==skillType) {
return true; // return true;
} // }
} // }
return false; // return false;
} //}
bool UnitType::isOfClass(UnitClass uc) const{ bool UnitType::isOfClass(UnitClass uc) const{
switch(uc){ switch(uc){

View File

@ -336,7 +336,7 @@ public:
inline bool hasCommandClass(CommandClass commandClass) const { inline bool hasCommandClass(CommandClass commandClass) const {
return firstCommandTypeOfClass[commandClass]!=NULL; return firstCommandTypeOfClass[commandClass]!=NULL;
} }
bool hasSkillType(const SkillType *skillType) const; //bool hasSkillType(const SkillType *skillType) const;
bool hasSkillClass(SkillClass skillClass) const; bool hasSkillClass(SkillClass skillClass) const;
inline bool hasCellMap() const {return cellMap!=NULL;} inline bool hasCellMap() const {return cellMap!=NULL;}
inline bool getAllowEmptyCellMap() const {return allowEmptyCellMap;} inline bool getAllowEmptyCellMap() const {return allowEmptyCellMap;}

View File

@ -906,29 +906,29 @@ bool Map::canMorph(const Vec2i &pos,const Unit *currentUnit,const UnitType *targ
} }
} }
bool Map::canOccupy(const Vec2i &pos, Field field, const UnitType *ut, CardinalDir facing) { //bool Map::canOccupy(const Vec2i &pos, Field field, const UnitType *ut, CardinalDir facing) {
if (ut->hasCellMap() && isInside(pos) && isInsideSurface(toSurfCoords(pos))) { // if (ut->hasCellMap() && isInside(pos) && isInsideSurface(toSurfCoords(pos))) {
for (int y=0; y < ut->getSize(); ++y) { // for (int y=0; y < ut->getSize(); ++y) {
for (int x=0; x < ut->getSize(); ++x) { // for (int x=0; x < ut->getSize(); ++x) {
Vec2i cellPos = pos + Vec2i(x, y); // Vec2i cellPos = pos + Vec2i(x, y);
if(isInside(cellPos) && isInsideSurface(toSurfCoords(cellPos))) { // if(isInside(cellPos) && isInsideSurface(toSurfCoords(cellPos))) {
if (ut->getCellMapCell(x, y, facing)) { // if (ut->getCellMapCell(x, y, facing)) {
if (isFreeCell(cellPos, field) == false) { // if (isFreeCell(cellPos, field) == false) {
return false; // return false;
} // }
} // }
} // }
else { // else {
return false; // return false;
} // }
} // }
} // }
return true; // return true;
} // }
else { // else {
return isFreeCells(pos, ut->getSize(), field); // return isFreeCells(pos, ut->getSize(), field);
} // }
} //}
// ==================== unit placement ==================== // ==================== unit placement ====================
@ -1193,38 +1193,38 @@ Vec2i Map::computeDestPos( const Vec2i &refUnitPos, const Vec2i &unitPos,
return pos; return pos;
} }
std::pair<float,Vec2i> Map::getUnitDistanceToPos(const Unit *unit,Vec2i pos,const UnitType *ut) { //std::pair<float,Vec2i> Map::getUnitDistanceToPos(const Unit *unit,Vec2i pos,const UnitType *ut) {
if(unit == NULL) { // if(unit == NULL) {
throw megaglest_runtime_error("unit == NULL"); // throw megaglest_runtime_error("unit == NULL");
} // }
//
std::pair<float,Vec2i> result(-1,Vec2i(0)); // std::pair<float,Vec2i> result(-1,Vec2i(0));
//int unitId= unit->getId(); // //int unitId= unit->getId();
Vec2i unitPos= computeDestPos(unit->getPosNotThreadSafe(), unit->getPosNotThreadSafe(), pos); // Vec2i unitPos= computeDestPos(unit->getPosNotThreadSafe(), unit->getPosNotThreadSafe(), pos);
//
Vec2i start = pos - Vec2i(1); // Vec2i start = pos - Vec2i(1);
int unitTypeSize = 0; // int unitTypeSize = 0;
if(ut != NULL) { // if(ut != NULL) {
unitTypeSize = ut->getSize(); // unitTypeSize = ut->getSize();
} // }
Vec2i end = pos + Vec2i(unitTypeSize); // Vec2i end = pos + Vec2i(unitTypeSize);
//
for(int i = start.x; i <= end.x; ++i) { // for(int i = start.x; i <= end.x; ++i) {
for(int j = start.y; j <= end.y; ++j){ // for(int j = start.y; j <= end.y; ++j){
Vec2i testPos(i,j); // Vec2i testPos(i,j);
//
if(ut == NULL || isInUnitTypeCells(ut, pos,testPos) == false) { // if(ut == NULL || isInUnitTypeCells(ut, pos,testPos) == false) {
float distance = unitPos.dist(testPos); // float distance = unitPos.dist(testPos);
if(result.first < 0 || result.first > distance) { // if(result.first < 0 || result.first > distance) {
result.first = distance; // result.first = distance;
result.second = testPos; // result.second = testPos;
} // }
} // }
} // }
} // }
//
return result; // return result;
} //}
const Unit * Map::findClosestUnitToPos(const Selection *selection, Vec2i originalBuildPos, const Unit * Map::findClosestUnitToPos(const Selection *selection, Vec2i originalBuildPos,
const UnitType *ut) const { const UnitType *ut) const {
@ -2049,9 +2049,9 @@ bool PosQuadIterator::next() {
return true; return true;
} }
void PosQuadIterator::skipX() { //void PosQuadIterator::skipX() {
pos.x+= step; // pos.x+= step;
} //}
const Vec2i &PosQuadIterator::getPos(){ const Vec2i &PosQuadIterator::getPos(){
return pos; return pos;

View File

@ -332,7 +332,7 @@ public:
bool isFreeCellsOrHasUnit(const Vec2i &pos, int size, Field field, const Unit *unit) const; bool isFreeCellsOrHasUnit(const Vec2i &pos, int size, Field field, const Unit *unit) const;
bool isAproxFreeCells(const Vec2i &pos, int size, Field field, int teamIndex) const; bool isAproxFreeCells(const Vec2i &pos, int size, Field field, int teamIndex) const;
bool canMorph(const Vec2i &pos,const Unit *currentUnit,const UnitType *targetUnitType ) const; bool canMorph(const Vec2i &pos,const Unit *currentUnit,const UnitType *targetUnitType ) const;
bool canOccupy(const Vec2i &pos, Field field, const UnitType *ut, CardinalDir facing); //bool canOccupy(const Vec2i &pos, Field field, const UnitType *ut, CardinalDir facing);
//unit placement //unit placement
bool aproxCanMove(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2, std::map<Vec2i, std::map<Vec2i, std::map<int, std::map<int, std::map<Field,bool> > > > > *lookupCache=NULL) const; bool aproxCanMove(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2, std::map<Vec2i, std::map<Vec2i, std::map<int, std::map<int, std::map<Field,bool> > > > > *lookupCache=NULL) const;
@ -348,7 +348,7 @@ public:
bool isInUnitTypeCells(const UnitType *ut, const Vec2i &pos,const Vec2i &testPos) const; bool isInUnitTypeCells(const UnitType *ut, const Vec2i &pos,const Vec2i &testPos) const;
bool isNextToUnitTypeCells(const UnitType *ut, const Vec2i &pos,const Vec2i &testPos) const; bool isNextToUnitTypeCells(const UnitType *ut, const Vec2i &pos,const Vec2i &testPos) const;
Vec2i findBestBuildApproach(const Unit *unit, Vec2i originalBuildPos,const UnitType *ut) const; Vec2i findBestBuildApproach(const Unit *unit, Vec2i originalBuildPos,const UnitType *ut) const;
std::pair<float,Vec2i> getUnitDistanceToPos(const Unit *unit,Vec2i pos,const UnitType *ut); //std::pair<float,Vec2i> getUnitDistanceToPos(const Unit *unit,Vec2i pos,const UnitType *ut);
//misc //misc
bool isNextTo(const Vec2i &pos, const Unit *unit) const; bool isNextTo(const Vec2i &pos, const Unit *unit) const;
@ -660,7 +660,7 @@ private:
public: public:
PosQuadIterator(const Map *map,const Quad2i &quad, int step=1); PosQuadIterator(const Map *map,const Quad2i &quad, int step=1);
bool next(); bool next();
void skipX(); //void skipX();
const Vec2i &getPos(); const Vec2i &getPos();
}; };

View File

@ -48,7 +48,7 @@ int getGlMaxTextureSize();
int getGlMaxTextureUnits(); int getGlMaxTextureUnits();
int getGlModelviewMatrixStackDepth(); int getGlModelviewMatrixStackDepth();
int getGlProjectionMatrixStackDepth(); int getGlProjectionMatrixStackDepth();
void checkGlExtension(const char *extensionName); //void checkGlExtension(const char *extensionName);
void inline _assertGl(const char *file, int line, GLenum *forceErrorNumber = NULL) { void inline _assertGl(const char *file, int line, GLenum *forceErrorNumber = NULL) {
GLenum error = (forceErrorNumber != NULL ? *forceErrorNumber : glGetError()); GLenum error = (forceErrorNumber != NULL ? *forceErrorNumber : glGetError());

View File

@ -231,7 +231,7 @@ string replaceBy(const string &s, char c1, char c2);
vector<string> split(string s,string d); vector<string> split(string s,string d);
string toLower(const string &s); string toLower(const string &s);
bool compareNonCaseSensitive(const string a, const string b); bool compareNonCaseSensitive(const string a, const string b);
void copyStringToBuffer(char *buffer, int bufferSize, const string& s); //void copyStringToBuffer(char *buffer, int bufferSize, const string& s);
//numeric fcs //numeric fcs
int clamp(int value, int min, int max); int clamp(int value, int min, int max);

View File

@ -167,10 +167,10 @@ int getGlProjectionMatrixStackDepth() {
return i; return i;
} }
void checkGlExtension(const char *extensionName) { //void checkGlExtension(const char *extensionName) {
if(!isGlExtensionSupported(extensionName)){ // if(!isGlExtensionSupported(extensionName)){
throw megaglest_runtime_error("OpenGL extension not supported: " + string(extensionName)); // throw megaglest_runtime_error("OpenGL extension not supported: " + string(extensionName));
} // }
} //}
}}}// end namespace }}}// end namespace

View File

@ -201,8 +201,8 @@ bool IsNumeric(const char *p, bool allowNegative) {
class Comma: public numpunct<char>// own facet class class Comma: public numpunct<char>// own facet class
{ {
protected: protected:
char do_thousands_sep() const { return ','; }// use the comma //char do_thousands_sep() const { return ','; }// use the comma
string do_grouping() const { return "\3"; }//group 3 digits //string do_grouping() const { return "\3"; }//group 3 digits
}; };
string formatNumber(uint64 f) { string formatNumber(uint64 f) {

View File

@ -745,10 +745,10 @@ bool compareNonCaseSensitive(const string a, const string b) {
return (toLower(a) < toLower(b)); return (toLower(a) < toLower(b));
} }
void copyStringToBuffer(char *buffer, int bufferSize, const string& s){ //void copyStringToBuffer(char *buffer, int bufferSize, const string& s){
strncpy(buffer, s.c_str(), bufferSize-1); // strncpy(buffer, s.c_str(), bufferSize-1);
buffer[bufferSize-1]= '\0'; // buffer[bufferSize-1]= '\0';
} //}
// ==================== numeric fcs ==================== // ==================== numeric fcs ====================