diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 05055597b..015fa8642 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -547,8 +547,8 @@ void Renderer::renderMouse2d(int x, int y, int anim, float fade){ anim= anim*2-maxMouse2dAnim; - color2= (abs(anim*fadeFactor)/static_cast(maxMouse2dAnim))/2.f+0.4f; - color1= (abs(anim*fadeFactor)/static_cast(maxMouse2dAnim))/2.f+0.8f; + color2= (abs(anim * (int)fadeFactor) / static_cast(maxMouse2dAnim)) / 2.f + 0.4f; + color1= (abs(anim * (int)fadeFactor) / static_cast(maxMouse2dAnim)) / 2.f + 0.8f; glPushAttrib(GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_LINE_BIT); glEnable(GL_BLEND); @@ -618,7 +618,7 @@ void Renderer::renderMouse3d() { throw runtime_error(szBuf); } - Vec3f pos3f= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y); + Vec3f pos3f= Vec3f((float)pos.x, map->getCell(pos)->getHeight(), (float)pos.y); if(gui->isPlacingBuilding()){ @@ -921,7 +921,7 @@ void Renderer::renderTextShadow(const string &text, const Font2D *font,const Vec textRenderer->begin(font); glColor3f(0.0f, 0.0f, 0.0f); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - textRenderer->render(text, pos.x-1.0f, pos.y-1.0f); + textRenderer->render(text, pos.x - 1, pos.y - 1); } //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); glColor3f(color.x,color.y,color.z); @@ -984,16 +984,16 @@ void Renderer::renderButton(const GraphicButton *button){ glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(0.f, 0.f); - glVertex2f(x, y); + glVertex2f((float)x, (float)y); glTexCoord2f(0.f, 1.f); - glVertex2f(x, y+h); + glVertex2f((float)x, (float)(y+h)); glTexCoord2f(1.f, 0.f); - glVertex2f(x+w, y); + glVertex2f((float)(x+w), (float)y); glTexCoord2f(1.f, 1.f); - glVertex2f(x+w, y+h); + glVertex2f((float)(x+w), (float)(y+h)); glEnd(); @@ -1011,25 +1011,25 @@ void Renderer::renderButton(const GraphicButton *button){ glBegin(GL_TRIANGLE_FAN); glColor4fv(color2.ptr()); - glVertex2f(x+w/2, y+h/2); + glVertex2f((float)(x+w/2), (float)(y+h/2)); glColor4fv(color1.ptr()); - glVertex2f(x-lightSize, y-lightSize); + glVertex2f((float)(x-lightSize), (float)(y-lightSize)); glColor4fv(color1.ptr()); - glVertex2f(x+w+lightSize, y-lightSize); + glVertex2f((float)(x+w+lightSize), (float)(y-lightSize)); glColor4fv(color1.ptr()); - glVertex2f(x+w+lightSize, y+h+lightSize); + glVertex2f((float)(x+w+lightSize), (float)(y+h+lightSize)); glColor4fv(color1.ptr()); - glVertex2f(x+w+lightSize, y+h+lightSize); + glVertex2f((float)(x+w+lightSize), (float)(y+h+lightSize)); glColor4fv(color1.ptr()); - glVertex2f(x-lightSize, y+h+lightSize); + glVertex2f((float)(x-lightSize), (float)(y+h+lightSize)); glColor4fv(color1.ptr()); - glVertex2f(x-lightSize, y-lightSize); + glVertex2f((float)(x-lightSize), (float)(y-lightSize)); glEnd(); } @@ -1377,7 +1377,7 @@ void Renderer::renderWater(){ GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, computeWaterColor(waterLevel, tc1->getHeight()).ptr()); glMultiTexCoord2fv(GL_TEXTURE1, tc1->getFowTexCoord().ptr()); - glTexCoord3f(i, 1.f, waterAnim); + glTexCoord3f((float)i, 1.f, waterAnim); glVertex3f( static_cast(i)*Map::mapScale, waterLevel, @@ -1388,7 +1388,7 @@ void Renderer::renderWater(){ GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, computeWaterColor(waterLevel, tc0->getHeight()).ptr()); glMultiTexCoord2fv(GL_TEXTURE1, tc0->getFowTexCoord().ptr()); - glTexCoord3f(i, 0.f, waterAnim); + glTexCoord3f((float)i, 0.f, waterAnim); glVertex3f( static_cast(i)*Map::mapScale, waterLevel, @@ -1405,7 +1405,7 @@ void Renderer::renderWater(){ GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, computeWaterColor(waterLevel, tc1->getHeight()).ptr()); glMultiTexCoord2fv(GL_TEXTURE1, tc1->getFowTexCoord().ptr()); - glTexCoord3f(i, 1.f, waterAnim); + glTexCoord3f((float)i, 1.f, waterAnim); glVertex3f( static_cast(i)*Map::mapScale, waterLevel, @@ -1416,7 +1416,7 @@ void Renderer::renderWater(){ GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, computeWaterColor(waterLevel, tc0->getHeight()).ptr()); glMultiTexCoord2fv(GL_TEXTURE1, tc0->getFowTexCoord().ptr()); - glTexCoord3f(i, 0.f, waterAnim); + glTexCoord3f((float)i, 0.f, waterAnim); glVertex3f( static_cast(i)*Map::mapScale, waterLevel, @@ -1588,7 +1588,7 @@ void Renderer::renderSelectionEffects(){ } else{ Vec2i pos= c->getPos(); - arrowTarget= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y); + arrowTarget= Vec3f((float)pos.x, map->getCell(pos)->getHeight(), (float)pos.y); } renderArrow(unit->getCurrVectorFlat(), arrowTarget, arrowColor, 0.3f); @@ -1598,7 +1598,7 @@ void Renderer::renderSelectionEffects(){ //meeting point arrow if(unit->getType()->getMeetingPoint()){ Vec2i pos= unit->getMeetingPos(); - Vec3f arrowTarget= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y); + Vec3f arrowTarget= Vec3f((float)pos.x, map->getCell(pos)->getHeight(), (float)pos.y); renderArrow(unit->getCurrVectorFlat(), arrowTarget, Vec3f(0.f, 0.f, 1.f), 0.3f); } @@ -1964,9 +1964,9 @@ void Renderer::renderMenuBackground(const MenuBackground *menuBackground){ glBegin(GL_TRIANGLE_STRIP); for(int j=1; jgetGameCamera()->getPos(); - glTranslatef(static_cast(-pos.x), 0, static_cast(-pos.z)); + glTranslatef(static_cast(-pos.x), 0.0f, static_cast(-pos.z)); } else{ diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 264dfdc73..b814322e9 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -413,7 +413,7 @@ void Unit::setPos(const Vec2i &pos){ void Unit::setTargetPos(const Vec2i &targetPos){ Vec2i relPos= targetPos - pos; - Vec2f relPosf= Vec2f(relPos.x, relPos.y); + Vec2f relPosf= Vec2f((float)relPos.x, (float)relPos.y); targetRotation= radToDeg(streflop::atan2(relPosf.x, relPosf.y)); targetRef= NULL; @@ -717,7 +717,7 @@ bool Unit::update(){ const int rotFactor= 2; if(progress<1.f/rotFactor){ if(type->getFirstStOfClass(scMove)){ - if(abs(lastRotation-targetRotation)<180) + if(abs((int)(lastRotation-targetRotation)) < 180) rotation= lastRotation+(targetRotation-lastRotation)*progress*rotFactor; else{ float rotationTerm= targetRotation>lastRotation? -360.f: +360.f; @@ -991,7 +991,7 @@ void Unit::updateTarget(){ //update target pos targetPos= target->getCellPos(); Vec2i relPos= targetPos - pos; - Vec2f relPosf= Vec2f(relPos.x, relPos.y); + Vec2f relPosf= Vec2f((float)relPos.x, (float)relPos.y); targetRotation= radToDeg(streflop::atan2(relPosf.x, relPosf.y)); //update target vec diff --git a/source/glest_game/types/command_type.cpp b/source/glest_game/types/command_type.cpp index d47be32d0..e923b1940 100644 --- a/source/glest_game/types/command_type.cpp +++ b/source/glest_game/types/command_type.cpp @@ -290,7 +290,7 @@ string AttackStoppedCommandType::getDesc(const TotalUpgrade *totalUpgrade) const } //attack distance - str+= lang.get("AttackDistance")+": "+floatToStr(attackSkillType->getAttackRange()); + str+= lang.get("AttackDistance")+": "+intToStr(attackSkillType->getAttackRange()); if(totalUpgrade->getAttackRange()!=0){ str+= "+"+intToStr(totalUpgrade->getAttackRange()!=0); } diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 339ba6c55..3e84a8a69 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -708,7 +708,7 @@ void UnitUpdater::hit(Unit *attacker, const AttackSkillType* ast, const Vec2i &t void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attacked, float distance){ //get vars - float damage= ast->getTotalAttackStrength(attacker->getTotalUpgrade()); + int damage= ast->getTotalAttackStrength(attacker->getTotalUpgrade()); int var= ast->getAttackVar(); int armor= attacked->getType()->getTotalArmor(attacked->getTotalUpgrade()); float damageMultiplier= world->getTechTree()->getDamageMultiplier(ast->getAttackType(), attacked->getType()->getArmorType()); @@ -839,7 +839,7 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr, con for(int j=center.y-range; jisInside(i, j) && streflop::floor(floatCenter.dist(Vec2f(i, j))) <= (range+1)){ + if(map->isInside(i, j) && streflop::floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){ //all fields for(int k=0; k= 0 && acquire_file_lock(SystemFlags::lockFile) == true) { - break; - } - } + if(SystemFlags::lockFile >= 0 && acquire_file_lock(SystemFlags::lockFile) == true) { + break; + } + } - SystemFlags::lockfilename = newlockfile; - debugLog += intToStr(idx); + SystemFlags::lockfilename = newlockfile; + debugLog += intToStr(idx); - printf("Opening additional logfile [%s]\n",debugLog.c_str()); - } + printf("Opening additional logfile [%s]\n",debugLog.c_str()); + } + } if(currentDebugLog.fileStream == NULL) { currentDebugLog.fileStream = new std::ofstream();