From 939e88ce384b97266eb323766f94339e5c736fdc Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 28 Sep 2013 07:10:25 +0000 Subject: [PATCH] - attempt to fix additional oos issues --- source/glest_game/game/game.cpp | 48 ++++++----------- source/glest_game/global/core_data.cpp | 21 -------- source/glest_game/graphics/particle_type.cpp | 30 +++++------ source/glest_game/graphics/renderer.cpp | 52 ------------------- source/glest_game/type_instances/object.cpp | 9 ---- source/glest_game/type_instances/unit.cpp | 4 -- source/glest_game/world/map.h | 1 - source/glest_game/world/world.cpp | 4 +- .../shared_lib/include/graphics/math_util.h | 2 +- 9 files changed, 34 insertions(+), 137 deletions(-) diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 86467c14..b41ca5e8 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -4259,36 +4259,23 @@ void Game::mouseMove(int x, int y, const MouseState *ms) { mouseY = y; if (ms->get(mbCenter)) { - //if (input.isCtrlDown()) { - // float speed = input.isShiftDown() ? 1.f : 0.125f; - // float response = input.isShiftDown() ? 0.1875f : 0.0625f; - // gameCamera.moveForwardH((y - lastMousePos.y) * speed, response); - // gameCamera.moveSideH((x - lastMousePos.x) * speed, response); - //} else mouseMoved = true; - { - //float ymult = Config::getInstance().getCameraInvertYAxis() ? -0.2f : 0.2f; - //float xmult = Config::getInstance().getCameraInvertXAxis() ? -0.2f : 0.2f; + if(currentCameraFollowUnit == NULL) { + float ymult = 0.2f; + float xmult = 0.2f; - //if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - if(currentCameraFollowUnit==NULL){ - float ymult = 0.2f; - float xmult = 0.2f; - - Vec2i oldPos=Shared::Platform::Window::getOldMousePos(); - int oldx= (oldPos.x * metrics.getVirtualW() / metrics.getScreenW()); - int oldy= ((metrics.getScreenH()-oldPos.y) * metrics.getVirtualH() / metrics.getScreenH()); - lastMousePos.x=oldx; - lastMousePos.y=oldy; - gameCamera.transitionVH(-(y - oldy) * ymult, (oldx - x) * xmult); - } - mouseX=lastMousePos.x; - mouseY=lastMousePos.y; - Shared::Platform::Window::revertMousePos(); - - //if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - return; + Vec2i oldPos=Shared::Platform::Window::getOldMousePos(); + int oldx= (oldPos.x * metrics.getVirtualW() / metrics.getScreenW()); + int oldy= ((metrics.getScreenH()-oldPos.y) * metrics.getVirtualH() / metrics.getScreenH()); + lastMousePos.x=oldx; + lastMousePos.y=oldy; + gameCamera.transitionVH(-(y - oldy) * ymult, (oldx - x) * xmult); } + mouseX=lastMousePos.x; + mouseY=lastMousePos.y; + Shared::Platform::Window::revertMousePos(); + + return; } else if(currentCameraFollowUnit==NULL) { //if(Window::isKeyDown() == false) @@ -4412,10 +4399,7 @@ void Game::eventMouseWheel(int x, int y, int zDelta) { } try { - //if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - //gameCamera.transitionXYZ(0.0f, -(float)zDelta / 30.0f, 0.0f); gameCamera.zoom((float)zDelta / 60.0f); - //gameCamera.setMoveY(1); } catch(const exception &ex) { char szBuf[8096]=""; @@ -5175,7 +5159,7 @@ string Game::getDebugStats(std::map &factionDebugInfo) { } //intToStr(stats.getFramesToCalculatePlaytime()/GameConstants::updateFps/60 - str+= "Time: " + floatToStr(world.getTimeFlow()->getTime(),2) + " [" + floatToStr((float)world.getStats()->getFramesToCalculatePlaytime() / (float)GameConstants::updateFps / 60.0,2) + "]\n"; + str+= "Time: " + doubleToStr(world.getTimeFlow()->getTime(),2) + " [" + doubleToStr((double)world.getStats()->getFramesToCalculatePlaytime() / (double)GameConstants::updateFps / 60.0,2) + "]\n"; if(SystemFlags::getThreadedLoggerRunning() == true) { str+= "Log buffer count: " + intToStr(SystemFlags::getLogEntryBufferCount())+"\n"; @@ -5219,7 +5203,7 @@ string Game::getDebugStats(std::map &factionDebugInfo) { // } str+= "\n"; - str+= "Visible quad area: " + floatToStr(visibleQuad.area()) +"\n"; + str+= "Visible quad area: " + doubleToStr(visibleQuad.area()) +"\n"; // str+= "Visible quad camera area: " + floatToStr(visibleQuadCamera.area()) +"\n"; // Rect2i boundingRect= visibleQuad.computeBoundingRect(); diff --git a/source/glest_game/global/core_data.cpp b/source/glest_game/global/core_data.cpp index 032724df..0e01e017 100644 --- a/source/glest_game/global/core_data.cpp +++ b/source/glest_game/global/core_data.cpp @@ -682,7 +682,6 @@ void CoreData::loadFonts() { if(displayFont) { displayFont->setType(displayFontName,config.getString("FontDisplay",""),config.getString("FontDisplayFamily","")); displayFont->setSize(displayFontSize); - //displayFont->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -695,7 +694,6 @@ void CoreData::loadFonts() { if(displayFont3D) { displayFont3D->setType(displayFontName,config.getString("FontDisplay",""),config.getString("FontDisplayFamily","")); displayFont3D->setSize(displayFontSize); - //displayFont3D->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -727,7 +725,6 @@ void CoreData::loadFonts() { if(displayFontSmall) { displayFontSmall->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""),config.getString("FontSmallDisplayFamily","")); displayFontSmall->setSize(displayFontNameSmallSize); - //displayFontSmall->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -740,7 +737,6 @@ void CoreData::loadFonts() { if(displayFontSmall3D) { displayFontSmall3D->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""),config.getString("FontSmallDisplayFamily","")); displayFontSmall3D->setSize(displayFontNameSmallSize); - //displayFontSmall3D->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -774,7 +770,6 @@ void CoreData::loadFonts() { menuFontNormal->setType(menuFontNameNormal,config.getString("FontMenuNormal",""),config.getString("FontMenuNormalFamily","")); menuFontNormal->setSize(menuFontNameNormalSize); menuFontNormal->setWidth(Font::wBold); - //menuFontNormal->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -788,7 +783,6 @@ void CoreData::loadFonts() { menuFontNormal3D->setType(menuFontNameNormal,config.getString("FontMenuNormal",""),config.getString("FontMenuNormalFamily","")); menuFontNormal3D->setSize(menuFontNameNormalSize); menuFontNormal3D->setWidth(Font::wBold); - //menuFontNormal3D->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -819,7 +813,6 @@ void CoreData::loadFonts() { if(menuFontBig) { menuFontBig->setType(menuFontNameBig,config.getString("FontMenuBig",""),config.getString("FontMenuBigFamily","")); menuFontBig->setSize(menuFontNameBigSize); - //menuFontBig->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -832,7 +825,6 @@ void CoreData::loadFonts() { if(menuFontBig3D) { menuFontBig3D->setType(menuFontNameBig,config.getString("FontMenuBig",""),config.getString("FontMenuBigFamily","")); menuFontBig3D->setSize(menuFontNameBigSize); - //menuFontBig3D->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -863,7 +855,6 @@ void CoreData::loadFonts() { if(menuFontVeryBig) { menuFontVeryBig->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""),config.getString("FontMenuVeryBigFamily","")); menuFontVeryBig->setSize(menuFontNameVeryBigSize); - //menuFontVeryBig->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -876,7 +867,6 @@ void CoreData::loadFonts() { if(menuFontVeryBig3D) { menuFontVeryBig3D->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""),config.getString("FontMenuVeryBigFamily","")); menuFontVeryBig3D->setSize(menuFontNameVeryBigSize); - //menuFontVeryBig3D->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -910,7 +900,6 @@ void CoreData::loadFonts() { if(consoleFont) { consoleFont->setType(consoleFontName,config.getString("FontConsole",""),config.getString("FontConsoleFamily","")); consoleFont->setSize(consoleFontNameSize); - //consoleFont->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -923,7 +912,6 @@ void CoreData::loadFonts() { if(consoleFont3D) { consoleFont3D->setType(consoleFontName,config.getString("FontConsole",""),config.getString("FontConsoleFamily","")); consoleFont3D->setSize(consoleFontNameSize); - //consoleFont3D->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str())); } } @@ -937,15 +925,6 @@ int CoreData::computeFontSize(int size) { int screenH = config.getInt("ScreenHeight"); rs = size * screenH / 1024; } - else { - if(Renderer::renderText3DEnabled) { - //rs = ((float)size * 0.85); - //rs = 24; - } - //int screenH = config.getInt("ScreenHeight"); - //rs = size * screenH / 1024; - - } //FontSizeAdjustment rs += config.getInt("FontSizeAdjustment"); if(Font::forceLegacyFonts == false) { diff --git a/source/glest_game/graphics/particle_type.cpp b/source/glest_game/graphics/particle_type.cpp index dba7fd1a..911d3cd9 100644 --- a/source/glest_game/graphics/particle_type.cpp +++ b/source/glest_game/graphics/particle_type.cpp @@ -327,7 +327,7 @@ void ParticleSystemType::saveGame(XmlNode *rootNode) { // Texture2D *texture; // Model *model; // float modelCycle; - particleSystemTypeNode->addAttribute("modelCycle",floatToStr(modelCycle,16), mapTagReplacements); + particleSystemTypeNode->addAttribute("modelCycle",doubleToStr(modelCycle,16), mapTagReplacements); // string primitive; particleSystemTypeNode->addAttribute("primitive",primitive, mapTagReplacements); // Vec3f offset; @@ -337,15 +337,15 @@ void ParticleSystemType::saveGame(XmlNode *rootNode) { // Vec4f colorNoEnergy; particleSystemTypeNode->addAttribute("colorNoEnergy",colorNoEnergy.getString(), mapTagReplacements); // float size; - particleSystemTypeNode->addAttribute("size",floatToStr(size,16), mapTagReplacements); + particleSystemTypeNode->addAttribute("size",doubleToStr(size,16), mapTagReplacements); // float sizeNoEnergy; - particleSystemTypeNode->addAttribute("sizeNoEnergy",floatToStr(sizeNoEnergy,16), mapTagReplacements); + particleSystemTypeNode->addAttribute("sizeNoEnergy",doubleToStr(sizeNoEnergy,16), mapTagReplacements); // float speed; - particleSystemTypeNode->addAttribute("speed",floatToStr(speed,16), mapTagReplacements); + particleSystemTypeNode->addAttribute("speed",doubleToStr(speed,16), mapTagReplacements); // float gravity; - particleSystemTypeNode->addAttribute("gravity",floatToStr(gravity,16), mapTagReplacements); + particleSystemTypeNode->addAttribute("gravity",doubleToStr(gravity,16), mapTagReplacements); // float emissionRate; - particleSystemTypeNode->addAttribute("emissionRate",floatToStr(emissionRate,16), mapTagReplacements); + particleSystemTypeNode->addAttribute("emissionRate",doubleToStr(emissionRate,16), mapTagReplacements); // int energyMax; particleSystemTypeNode->addAttribute("energyMax",intToStr(energyMax), mapTagReplacements); // int energyVar; @@ -413,7 +413,7 @@ void ParticleSystemTypeProjectile::load(const XmlNode* particleFileNode, const s //trajectory speed const XmlNode *tajectorySpeedNode= tajectoryNode->getChild("speed"); - trajectorySpeed= tajectorySpeedNode->getAttribute("value")->getFloatValue() / (float)GameConstants::updateFps; + trajectorySpeed= tajectorySpeedNode->getAttribute("value")->getFloatValue() / (double)GameConstants::updateFps; //printf("[%s] trajectorySpeed = %f\n",path.c_str(),trajectorySpeed); if(trajectory=="parabolic" || trajectory=="spiral"){ @@ -466,11 +466,11 @@ void ParticleSystemTypeProjectile::saveGame(XmlNode *rootNode) { // string trajectory; particleSystemTypeProjectileNode->addAttribute("trajectory",trajectory, mapTagReplacements); // float trajectorySpeed; - particleSystemTypeProjectileNode->addAttribute("trajectorySpeed",floatToStr(trajectorySpeed,16), mapTagReplacements); + particleSystemTypeProjectileNode->addAttribute("trajectorySpeed",doubleToStr(trajectorySpeed,16), mapTagReplacements); // float trajectoryScale; - particleSystemTypeProjectileNode->addAttribute("trajectoryScale",floatToStr(trajectoryScale,16), mapTagReplacements); + particleSystemTypeProjectileNode->addAttribute("trajectoryScale",doubleToStr(trajectoryScale,16), mapTagReplacements); // float trajectoryFrequency; - particleSystemTypeProjectileNode->addAttribute("trajectoryFrequency",floatToStr(trajectoryFrequency,16), mapTagReplacements); + particleSystemTypeProjectileNode->addAttribute("trajectoryFrequency",doubleToStr(trajectoryFrequency,16), mapTagReplacements); } // =========================================================== @@ -549,15 +549,15 @@ void ParticleSystemTypeSplash::saveGame(XmlNode *rootNode) { XmlNode *particleSystemTypeSplashNode = rootNode->addChild("ParticleSystemTypeSplash"); // float emissionRateFade; - particleSystemTypeSplashNode->addAttribute("emissionRateFade",floatToStr(emissionRateFade,16), mapTagReplacements); + particleSystemTypeSplashNode->addAttribute("emissionRateFade",doubleToStr(emissionRateFade,16), mapTagReplacements); // float verticalSpreadA; - particleSystemTypeSplashNode->addAttribute("verticalSpreadA",floatToStr(verticalSpreadA,16), mapTagReplacements); + particleSystemTypeSplashNode->addAttribute("verticalSpreadA",doubleToStr(verticalSpreadA,16), mapTagReplacements); // float verticalSpreadB; - particleSystemTypeSplashNode->addAttribute("verticalSpreadB",floatToStr(verticalSpreadB,16), mapTagReplacements); + particleSystemTypeSplashNode->addAttribute("verticalSpreadB",doubleToStr(verticalSpreadB,16), mapTagReplacements); // float horizontalSpreadA; - particleSystemTypeSplashNode->addAttribute("horizontalSpreadA",floatToStr(horizontalSpreadA,16), mapTagReplacements); + particleSystemTypeSplashNode->addAttribute("horizontalSpreadA",doubleToStr(horizontalSpreadA,16), mapTagReplacements); // float horizontalSpreadB; - particleSystemTypeSplashNode->addAttribute("horizontalSpreadB",floatToStr(horizontalSpreadB,16), mapTagReplacements); + particleSystemTypeSplashNode->addAttribute("horizontalSpreadB",doubleToStr(horizontalSpreadB,16), mapTagReplacements); } }}//end mamespace diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index b57ed42d..f5052f5d 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -1082,58 +1082,6 @@ void Renderer::setupLighting() { } } -/* - if(timeFlow->isTotalNight()) { - for(int i = 0; i < world->getFactionCount() && lightCount < maxLights; ++i) { - for(int j = 0; j < world->getFaction(i)->getUnitCount() && lightCount < maxLights; ++j) { - Unit *unit= world->getFaction(i)->getUnit(j); - if(world->toRenderUnit(unit) && - unit->getCurrVector().dist(gameCamera->getPos()) < maxLightDist && - unit->getType()->getLight() && unit->isOperative()){ - //printf("$$$ Show light for faction: %s # %d / %d for Unit [%d - %s]\n",world->getFaction(i)->getType()->getName().c_str(),lightCount,maxLights,unit->getId(),unit->getFullName().c_str()); - - Vec4f pos= Vec4f(unit->getCurrVector()); - pos.y+=4.f; - - GLenum lightEnum= GL_LIGHT0 + lightCount; - - glEnable(lightEnum); - glLightfv(lightEnum, GL_POSITION, pos.ptr()); - glLightfv(lightEnum, GL_AMBIENT, Vec4f(unit->getType()->getLightColor()).ptr()); - glLightfv(lightEnum, GL_DIFFUSE, Vec4f(unit->getType()->getLightColor()).ptr()); - glLightfv(lightEnum, GL_SPECULAR, Vec4f(unit->getType()->getLightColor()*0.3f).ptr()); - glLightf(lightEnum, GL_QUADRATIC_ATTENUATION, 0.05f); - - ++lightCount; - - const GameCamera *gameCamera= game->getGameCamera(); - - if(Vec3f(pos).dist(gameCamera->getPos())getPos())){ - nearestLightPos= pos; - } - } - } - } - } -*/ - -// else { -// for(int i = 0; i < world->getFactionCount() && lightCount < maxLights; ++i) { -// for(int j = 0; j < world->getFaction(i)->getUnitCount() && lightCount < maxLights; ++j) { -// Unit *unit= world->getFaction(i)->getUnit(j); -// if(world->toRenderUnit(unit) == true) { -// float dist = unit->getCurrVector().dist(gameCamera->getPos()); -// bool showUnitLight = dist < maxLightDist && -// unit->getType()->getLight() && unit->isOperative(); -// -// if(showUnitLight == false && unit->getType()->getLight() == true) { -// printf("$$$ Show light for faction: %s # %d / %d for Unit [%d - %s] showUnitLight = %d dist = %f [%f] unit->getType()->getLight() = %d unit->isOperative() = %d\n",world->getFaction(i)->getType()->getName().c_str(),lightCount,maxLights,unit->getId(),unit->getFullName().c_str(),showUnitLight,dist,maxLightDist,unit->getType()->getLight(),unit->isOperative()); -// } -// } -// } -// } -// } - assertGl(); } diff --git a/source/glest_game/type_instances/object.cpp b/source/glest_game/type_instances/object.cpp index 36a600be..5c9e6375 100644 --- a/source/glest_game/type_instances/object.cpp +++ b/source/glest_game/type_instances/object.cpp @@ -165,16 +165,7 @@ void Object::update() { double newAnimProgress = animProgress + f*(((double)objectType->getTilesetModelType(variation)->getAnimSpeed() * heightFactor) / speedDenominator); - // printf("A [%f] B [%f] C [%f] D [%f] E [%f] F [%f]\n", - // ((float)objectType->getTilesetModelType(variation)->getAnimSpeed() * heightFactor), - // speedDenominator, - // ((objectType->getTilesetModelType(variation)->getAnimSpeed() * heightFactor) / speedDenominator), - // (animProgress + ((objectType->getTilesetModelType(variation)->getAnimSpeed() * heightFactor) / speedDenominator)), - // animProgress,newAnimProgress); - animProgress = newAnimProgress; - // printf("#2 new animProgress [%f]\n",animProgress); - if(animProgress > 1.f) { animProgress = 0.f; } diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 32ea8c9d..18bdcdec 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -2509,7 +2509,6 @@ void Unit::updateTimedParticles() { UnitParticleSystemType *pst = queuedUnitParticleSystemTypes[i]; if(pst != NULL) { if(truncateDecimal(pst->getStartTime(),16) <= truncateDecimal(getAnimProgressAsFloat(),16)) { - //printf("STARTING queued particle system type [%s] [%f] [%f] [%f] [%f]\n",pst->getType().c_str(),truncateDecimal(pst->getStartTime()),truncateDecimal(pst->getEndTime()),truncateDecimal(animProgress),truncateDecimal(lastAnimProgress)); UnitParticleSystem *ups = new UnitParticleSystem(200); ups->setParticleOwner(this); @@ -2542,10 +2541,8 @@ void Unit::updateTimedParticles() { double particleEndTime = truncateDecimal(pet,16); if(particleStartTime != 0.0 || particleEndTime != 1.0) { - //printf("Checking for end particle system #%d [%d] [%f] [%f] [%f] [%f]\n",i,ps->shape,truncateDecimal(ps->getStartTime()),truncateDecimal(ps->getEndTime()),truncateDecimal(animProgress),truncateDecimal(lastAnimProgress)); double animProgressTime = truncateDecimal(getAnimProgressAsFloat(),16); if(animProgressTime >= 0.99 || animProgressTime >= particleEndTime) { - //printf("ENDING particle system [%d]\n",ps->shape); ps->fade(); unitParticleSystems.erase(unitParticleSystems.begin() + i); @@ -3099,7 +3096,6 @@ string Unit::getDesc(bool translatedValue) const { str += lang.get("MaxUnitCount")+ ": " + intToStr(faction->getCountForMaxUnitCount(type)) + "/" + intToStr(type->getMaxUnitCount()); } - //str += "\n"+lang.get("Hp")+ ": " + intToStr(hp) + "/" + intToStr(type->getTotalMaxHp(&totalUpgrade)) + " [" + floatToStr(getHpRatio()) + "] [" + floatToStr(animProgress) + "]"; str += "\n"+lang.get("Hp")+ ": " + intToStr(hp) + "/" + intToStr(type->getTotalMaxHp(&totalUpgrade)); if(type->getHpRegeneration() != 0 || totalUpgrade.getMaxHpRegeneration() != 0) { str+= " (" + lang.get("Regeneration") + ": " + intToStr(type->getHpRegeneration()); diff --git a/source/glest_game/world/map.h b/source/glest_game/world/map.h index 8cf7f2ad..b9f76099 100644 --- a/source/glest_game/world/map.h +++ b/source/glest_game/world/map.h @@ -306,7 +306,6 @@ public: inline bool getSubmerged(const Cell *c) const {return c->getHeight()getHeight()getHeight()= getFactionCount()) { @@ -1174,7 +1174,7 @@ Unit *World::nearestStore(const Vec2i &pos, int factionIndex, const ResourceType for(int i=0; i < getFaction(factionIndex)->getUnitCount(); ++i) { Unit *u= getFaction(factionIndex)->getUnit(i); if(u != NULL) { - float tmpDist= u->getPos().dist(pos); + double tmpDist= u->getPos().dist(pos); if(tmpDist < currDist && u->getType() != NULL && u->getType()->getStore(rt) > 0 && u->isOperative()) { currDist= tmpDist; currUnit= u; diff --git a/source/shared_lib/include/graphics/math_util.h b/source/shared_lib/include/graphics/math_util.h index a3bcb611..f1683656 100644 --- a/source/shared_lib/include/graphics/math_util.h +++ b/source/shared_lib/include/graphics/math_util.h @@ -233,7 +233,7 @@ public: } } - float area(){ + double area() { Vec2i v0= p[3]-p[0]; Vec2i v1= p[1]-p[2];