trackgen: fix gcc warnings

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8901 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: cf83b57dd1e6319bdc70b9786ecdabfc3a34ef06
Former-commit-id: f1466e0070fd91f56b6d8f4bb5ceb7539fe19afc
This commit is contained in:
iobyte 2023-04-24 13:47:50 +00:00
parent 50370e0cd3
commit da4fac882c
2 changed files with 11 additions and 9 deletions

View file

@ -494,7 +494,7 @@ void Ac3d::BoundingBox::extend(const V3d &vertex)
void Ac3d::BoundingSphere::extend(const BoundingBox &boundingBox)
{
V3d half = (boundingBox.max - boundingBox.min) / 2;
const V3d half = (boundingBox.max - boundingBox.min) / 2;
center = boundingBox.min + half;
radius = half.length();
}
@ -521,8 +521,8 @@ Ac3d::Object::Object(std::ifstream &fin)
parse(fin, tokens.at(1));
return;
}
else
throw Exception("Invalid AC3D file");
throw Exception("Invalid AC3D file");
}
}
@ -786,12 +786,12 @@ Ac3d::BoundingSphere Ac3d::Object::getBoundingSphere() const
return bs;
}
void Ac3d::Object::remapMaterials(const std::map<int, int> &materialMap)
void Ac3d::Object::remapMaterials(const MaterialMap &materialMap)
{
if (type == "poly")
{
for (auto &surface : surfaces)
surface.mat = materialMap.find(surface.mat)->second;
surface.mat = static_cast<int>(materialMap.find(surface.mat)->second);
}
else
{
@ -918,12 +918,12 @@ void Ac3d::merge(const Ac3d & ac3d)
return;
}
std::map<int, int> materialMap;
MaterialMap materialMap;
for (int i = 0; i < ac3d.materials.size(); i++)
for (size_t i = 0; i < ac3d.materials.size(); i++)
{
bool found = false;
for (int j = 0; j < materials.size(); j++)
for (size_t j = 0; j < materials.size(); j++)
{
if (ac3d.materials[i].same(materials[j]))
{

View file

@ -197,6 +197,8 @@ struct Ac3d
void extend(const BoundingBox &boundingBox);
};
typedef std::map<size_t, size_t> MaterialMap;
struct Object
{
std::string type;
@ -226,7 +228,7 @@ struct Ac3d
void flipAxes(bool in);
BoundingBox getBoundingBox() const;
BoundingSphere getBoundingSphere() const;
void remapMaterials(const std::map<int, int> &materialMap);
void remapMaterials(const MaterialMap &materialMap);
};
bool versionC = false;