1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00

fixing MSVC 2013 warning C4244: & C4305

conversion from 'const float' to 'int', possible loss of data
conversion from 'double' to 'int', possible loss of data
conversion from 'float' to 'int', possible loss of data
This commit is contained in:
dteviot 2015-03-08 18:11:54 +13:00
parent ca8c8c6aa4
commit f19863b545

View File

@ -21,6 +21,7 @@
#include "../mwworld/ptr.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwmechanics/pathfinding.hpp"
#include "renderconst.hpp"
@ -81,12 +82,12 @@ ManualObject *Debugging::createPathgridLines(const ESM::Pathgrid *pathgrid)
{
const ESM::Pathgrid::Edge &edge = *it;
const ESM::Pathgrid::Point &p1 = pathgrid->mPoints[edge.mV0], &p2 = pathgrid->mPoints[edge.mV1];
Vector3 direction = (Vector3(p2.mX, p2.mY, p2.mZ) - Vector3(p1.mX, p1.mY, p1.mZ));
Vector3 direction = (MWMechanics::PathFinder::MakeOgreVector3(p2) - MWMechanics::PathFinder::MakeOgreVector3(p1));
Vector3 lineDisplacement = direction.crossProduct(Vector3::UNIT_Z).normalisedCopy();
lineDisplacement = lineDisplacement * POINT_MESH_BASE +
Vector3(0, 0, 10); // move lines up a little, so they will be less covered by meshes/landscape
result->position(Vector3(p1.mX, p1.mY, p1.mZ) + lineDisplacement);
result->position(Vector3(p2.mX, p2.mY, p2.mZ) + lineDisplacement);
result->position(MWMechanics::PathFinder::MakeOgreVector3(p1) + lineDisplacement);
result->position(MWMechanics::PathFinder::MakeOgreVector3(p2) + lineDisplacement);
}
result->end();
@ -108,7 +109,7 @@ ManualObject *Debugging::createPathgridPoints(const ESM::Pathgrid *pathgrid)
it != pathgrid->mPoints.end();
++it, startIndex += 6)
{
Vector3 pointPos(it->mX, it->mY, it->mZ);
Vector3 pointPos(MWMechanics::PathFinder::MakeOgreVector3(*it));
if (!first)
{
@ -117,11 +118,13 @@ ManualObject *Debugging::createPathgridPoints(const ESM::Pathgrid *pathgrid)
result->index(startIndex); // start point of current octahedron
}
Ogre::Real pointMeshBase = static_cast<Ogre::Real>(POINT_MESH_BASE);
result->position(pointPos + Vector3(0, 0, height)); // 0
result->position(pointPos + Vector3(-POINT_MESH_BASE, -POINT_MESH_BASE, 0)); // 1
result->position(pointPos + Vector3(POINT_MESH_BASE, -POINT_MESH_BASE, 0)); // 2
result->position(pointPos + Vector3(POINT_MESH_BASE, POINT_MESH_BASE, 0)); // 3
result->position(pointPos + Vector3(-POINT_MESH_BASE, POINT_MESH_BASE, 0)); // 4
result->position(pointPos + Vector3(-pointMeshBase, -pointMeshBase, 0)); // 1
result->position(pointPos + Vector3(pointMeshBase, -pointMeshBase, 0)); // 2
result->position(pointPos + Vector3(pointMeshBase, pointMeshBase, 0)); // 3
result->position(pointPos + Vector3(-pointMeshBase, pointMeshBase, 0)); // 4
result->position(pointPos + Vector3(0, 0, -height)); // 5
result->index(startIndex + 0);
@ -239,8 +242,8 @@ void Debugging::enableCellPathgrid(MWWorld::CellStore *store)
Vector3 cellPathGridPos(0, 0, 0);
if (store->getCell()->isExterior())
{
cellPathGridPos.x = store->getCell()->mData.mX * ESM::Land::REAL_SIZE;
cellPathGridPos.y = store->getCell()->mData.mY * ESM::Land::REAL_SIZE;
cellPathGridPos.x = static_cast<Ogre::Real>(store->getCell()->mData.mX * ESM::Land::REAL_SIZE);
cellPathGridPos.y = static_cast<Ogre::Real>(store->getCell()->mData.mY * ESM::Land::REAL_SIZE);
}
SceneNode *cellPathGrid = mPathGridRoot->createChildSceneNode(cellPathGridPos);
cellPathGrid->attachObject(createPathgridLines(pathgrid));