Fixed the seveal hunderd warnings in TerraPage loader!
This commit is contained in:
@@ -102,17 +102,18 @@ bool trpgMatTable1_0::Read(trpgReadBuffer &buf)
|
||||
}
|
||||
|
||||
// Now convert to the new style material table
|
||||
for (i=0;i<shortTable.size();i++) {
|
||||
for (i=0;i<static_cast<int>(shortTable.size());i++)
|
||||
{
|
||||
trpgShortMaterial &shortMat = shortTable[i];
|
||||
trpgMaterial &baseMat = baseMats[shortMat.baseMat];
|
||||
matTables.push_back(baseMat);
|
||||
trpgMaterial &newMat = matTables[matTables.size()-1];
|
||||
newMat.SetNumTexture(shortMat.texids.size());
|
||||
for (j=0;j<shortMat.texids.size();j++) {
|
||||
int texId;
|
||||
trpgTextureEnv texEnv;
|
||||
baseMat.GetTexture(j,texId,texEnv);
|
||||
newMat.SetTexture(j,shortMat.texids[j],texEnv);
|
||||
for (unsigned j=0;j<shortMat.texids.size();j++) {
|
||||
int texId;
|
||||
trpgTextureEnv texEnv;
|
||||
baseMat.GetTexture(j,texId,texEnv);
|
||||
newMat.SetTexture(j,shortMat.texids[j],texEnv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,19 +132,21 @@ bool trpgMatTable1_0::Write(trpgWriteBuffer &buf)
|
||||
|
||||
// Iterate over the existing materials
|
||||
int i;
|
||||
for (i=0;i<numTable*numMat;i++) {
|
||||
trpgMaterial &mat = matTables[i];
|
||||
// Fill in the short material
|
||||
trpgShortMaterial &sMat = shortMats[i];
|
||||
int numTex;
|
||||
mat.GetNumTexture(numTex);
|
||||
for (int j=0;j<numTex;j++) {
|
||||
int texId;
|
||||
trpgTextureEnv texEnv;
|
||||
mat.GetTexture(j,texId,texEnv);
|
||||
sMat.texids.push_back(texId);
|
||||
sMat.baseMat = i;
|
||||
}
|
||||
for (i=0;i<numTable*numMat;i++)
|
||||
{
|
||||
trpgMaterial &mat = matTables[i];
|
||||
// Fill in the short material
|
||||
trpgShortMaterial &sMat = shortMats[i];
|
||||
int numTex;
|
||||
mat.GetNumTexture(numTex);
|
||||
for (int j=0;j<numTex;j++)
|
||||
{
|
||||
int texId;
|
||||
trpgTextureEnv texEnv;
|
||||
mat.GetTexture(j,texId,texEnv);
|
||||
sMat.texids.push_back(texId);
|
||||
sMat.baseMat = i;
|
||||
}
|
||||
}
|
||||
|
||||
// Write the 1.0 material table
|
||||
@@ -153,23 +156,23 @@ bool trpgMatTable1_0::Write(trpgWriteBuffer &buf)
|
||||
|
||||
// Write the short materials
|
||||
buf.Begin(TRPGSHORTMATTABLE);
|
||||
for (i=0;i<shortMats.size();i++) {
|
||||
trpgShortMaterial &sMat = shortMats[i];
|
||||
buf.Add(sMat.baseMat);
|
||||
buf.Add((int)(sMat.texids.size()));
|
||||
int j;
|
||||
for (j=0;j<sMat.texids.size();j++)
|
||||
buf.Add(sMat.texids[j]);
|
||||
for (i=0;i<static_cast<int>(shortMats.size());i++)
|
||||
{
|
||||
trpgShortMaterial &sMat = shortMats[i];
|
||||
buf.Add(sMat.baseMat);
|
||||
buf.Add((int)(sMat.texids.size()));
|
||||
for (unsigned int j=0;j<sMat.texids.size();j++)
|
||||
buf.Add(sMat.texids[j]);
|
||||
}
|
||||
buf.End();
|
||||
|
||||
// Write the regular materials
|
||||
buf.Add(numTable*numMat);
|
||||
for (i=0;i<numTable*numMat;i++) {
|
||||
trpgMaterial &mat = matTables[i];
|
||||
// This will be bigger than the old 1.0 material, but it doesn't matter since
|
||||
// the new stuff is on the end.
|
||||
mat.Write(buf);
|
||||
trpgMaterial &mat = matTables[i];
|
||||
// This will be bigger than the old 1.0 material, but it doesn't matter since
|
||||
// the new stuff is on the end.
|
||||
mat.Write(buf);
|
||||
}
|
||||
|
||||
// Close Mat Table
|
||||
@@ -227,7 +230,7 @@ bool trpgTexTable1_0::Read(trpgReadBuffer &buf)
|
||||
try {
|
||||
buf.Get(numTex);
|
||||
texList.resize(numTex);
|
||||
for (unsigned int i=0;i<numTex;i++) {
|
||||
for (int i=0;i<numTex;i++) {
|
||||
trpgTexture1_0 tex1_0;
|
||||
tex1_0.Read(buf);
|
||||
texList[i] = tex1_0;
|
||||
@@ -263,7 +266,7 @@ bool trpgTexTable1_0::Write(trpgWriteBuffer &buf)
|
||||
|
||||
}
|
||||
|
||||
trpgTileTable1_0::trpgTileTable1_0(const trpgTileTable &inTable)
|
||||
trpgTileTable1_0::trpgTileTable1_0(const trpgTileTable &)
|
||||
{
|
||||
// Nothing to copy for now
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ bool trpgGeometry::GetNumMaterial(int &n) const
|
||||
bool trpgGeometry::GetMaterial(int id,int32 &m,bool &isLocal) const
|
||||
{
|
||||
isLocal = false;
|
||||
if (!isValid() || id < 0 || id >= materials.size()) return false;
|
||||
if (!isValid() || id < 0 || static_cast<unsigned int>(id) >= materials.size()) return false;
|
||||
m = materials[id];
|
||||
if (m < 0) {
|
||||
m = -m - 1;
|
||||
@@ -341,7 +341,7 @@ bool trpgGeometry::GetNumVertex(int &v) const
|
||||
}
|
||||
bool trpgGeometry::GetVertices(float32 *v) const
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (!isValid()) return false;
|
||||
if (vertDataFloat.size() != 0)
|
||||
@@ -354,7 +354,7 @@ bool trpgGeometry::GetVertices(float32 *v) const
|
||||
}
|
||||
bool trpgGeometry::GetVertices(float64 *v) const
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (!isValid()) return false;
|
||||
if (vertDataFloat.size() != 0)
|
||||
@@ -367,7 +367,7 @@ bool trpgGeometry::GetVertices(float64 *v) const
|
||||
}
|
||||
bool trpgGeometry::GetVertices(osg::Vec3* v) const
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (!isValid()) return false;
|
||||
if (vertDataFloat.size() != 0)
|
||||
@@ -394,7 +394,7 @@ bool trpgGeometry::GetVertex(int n,trpg3dPoint &pt) const
|
||||
{
|
||||
int id = 3*n;
|
||||
int idMax = 3*n+2;
|
||||
if (id < 0 || (idMax >= vertDataFloat.size() && idMax >= vertDataDouble.size()))
|
||||
if (id < 0 || (static_cast<unsigned int>(idMax) >= vertDataFloat.size() && static_cast<unsigned int>(idMax) >= vertDataDouble.size()))
|
||||
return false;
|
||||
if (vertDataFloat.size() > vertDataDouble.size()) {
|
||||
pt.x = vertDataFloat[id];
|
||||
@@ -419,7 +419,7 @@ bool trpgGeometry::GetNumNormal(int32 &n) const
|
||||
}
|
||||
bool trpgGeometry::GetNormals(float32 *v) const
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (!isValid()) return false;
|
||||
if (normDataFloat.size() != 0)
|
||||
@@ -432,7 +432,7 @@ bool trpgGeometry::GetNormals(float32 *v) const
|
||||
}
|
||||
bool trpgGeometry::GetNormals(float64 *v) const
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (!isValid()) return false;
|
||||
if (normDataFloat.size() != 0)
|
||||
@@ -446,7 +446,7 @@ bool trpgGeometry::GetNormals(float64 *v) const
|
||||
|
||||
bool trpgGeometry::GetNormals(osg::Vec3* v) const
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (!isValid()) return false;
|
||||
if (normDataFloat.size() != 0)
|
||||
@@ -477,7 +477,7 @@ bool trpgGeometry::GetNumColorSets(int &n) const
|
||||
}
|
||||
bool trpgGeometry::GetColorSet(int id,trpgColorInfo *ci) const
|
||||
{
|
||||
if (!isValid() || id < 0 || id >= colors.size()) return false;
|
||||
if (!isValid() || id < 0 || static_cast<unsigned int>(id) >= colors.size()) return false;
|
||||
*ci = colors[id];
|
||||
return true;
|
||||
}
|
||||
@@ -489,7 +489,7 @@ bool trpgGeometry::GetNumTexCoordSets(int &n) const
|
||||
}
|
||||
bool trpgGeometry::GetTexCoordSet(int id,trpgTexData *tx) const
|
||||
{
|
||||
if (!isValid() || id < 0 || id >= texData.size()) return false;
|
||||
if (!isValid() || id < 0 || static_cast<unsigned int>(id) >= texData.size()) return false;
|
||||
*tx = texData[id];
|
||||
return true;
|
||||
}
|
||||
@@ -502,7 +502,7 @@ bool trpgGeometry::GetNumEdgeFlag(int &n) const
|
||||
bool trpgGeometry::GetEdgeFlags(char *e) const
|
||||
{
|
||||
if (!isValid()) return false;
|
||||
for (int i=0;i<edgeFlags.size();i++)
|
||||
for (unsigned int i=0;i<edgeFlags.size();i++)
|
||||
e[i] = edgeFlags[i];
|
||||
return true;
|
||||
}
|
||||
@@ -518,8 +518,6 @@ bool trpgGeometry::isValid() const
|
||||
// Order doesn't matter very much for this
|
||||
bool trpgGeometry::Write(trpgWriteBuffer &buf)
|
||||
{
|
||||
unsigned int i,j;
|
||||
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -534,7 +532,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
|
||||
buf.Add(numPrim);
|
||||
if (primLength.size() != 0) {
|
||||
buf.Add((uint8)1);
|
||||
for (i=0;i<(unsigned int)numPrim;i++)
|
||||
for (int i=0;i<numPrim;i++)
|
||||
buf.Add(primLength[i]);
|
||||
} else
|
||||
buf.Add((uint8)0);
|
||||
@@ -547,7 +545,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
|
||||
if (materials.size() > 0) {
|
||||
buf.Begin(TRPG_GEOM_MATERIAL);
|
||||
buf.Add((int32)materials.size());
|
||||
for (i=0;i<materials.size();i++)
|
||||
for (unsigned int i=0;i<materials.size();i++)
|
||||
buf.Add(materials[i]);
|
||||
buf.End();
|
||||
}
|
||||
@@ -561,7 +559,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
|
||||
buf.Begin(TRPG_GEOM_VERT32);
|
||||
int32 num = vertDataFloat.size()/3;
|
||||
buf.Add(num);
|
||||
for (i=0;i<3*num;i++)
|
||||
for (int i=0;i<3*num;i++)
|
||||
buf.Add(vertDataFloat[i]);
|
||||
buf.End();
|
||||
}
|
||||
@@ -569,7 +567,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
|
||||
buf.Begin(TRPG_GEOM_VERT64);
|
||||
int32 num = vertDataDouble.size()/3;
|
||||
buf.Add(num);
|
||||
for (i=0;i<3*num;i++)
|
||||
for (int i=0;i<3*num;i++)
|
||||
buf.Add(vertDataDouble[i]);
|
||||
buf.End();
|
||||
}
|
||||
@@ -584,7 +582,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
|
||||
buf.Add((int32)normBind);
|
||||
int32 num = normDataFloat.size()/3;
|
||||
buf.Add(num);
|
||||
for (i=0;i<3*num;i++)
|
||||
for (int i=0;i<3*num;i++)
|
||||
buf.Add(normDataFloat[i]);
|
||||
buf.End();
|
||||
}
|
||||
@@ -593,7 +591,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
|
||||
buf.Add((int32)normBind);
|
||||
int32 num = normDataDouble.size()/3;
|
||||
buf.Add(num);
|
||||
for (i=0;i<3*num;i++)
|
||||
for (int i=0;i<3*num;i++)
|
||||
buf.Add(normDataDouble[i]);
|
||||
buf.End();
|
||||
}
|
||||
@@ -604,14 +602,14 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
|
||||
Colors
|
||||
*/
|
||||
if (colors.size() > 0) {
|
||||
for (i=0;i<colors.size();i++) {
|
||||
for (unsigned int i=0;i<colors.size();i++) {
|
||||
trpgColorInfo &ci = colors[i];
|
||||
if (ci.data.size()) {
|
||||
buf.Begin(TRPG_GEOM_COLOR);
|
||||
buf.Add((int32)ci.type);
|
||||
buf.Add((int32)ci.bind);
|
||||
buf.Add((int32)ci.data.size());
|
||||
for (j=0;j<ci.data.size();j++)
|
||||
for (unsigned j=0;j<ci.data.size();j++)
|
||||
buf.Add(ci.data[j]);
|
||||
buf.End();
|
||||
}
|
||||
@@ -623,14 +621,14 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
|
||||
Num coords
|
||||
Texture coords
|
||||
*/
|
||||
for (i=0;i<texData.size();i++) {
|
||||
for (unsigned int i=0;i<texData.size();i++) {
|
||||
trpgTexData &td = texData[i];
|
||||
if (td.floatData.size()) {
|
||||
buf.Begin(TRPG_GEOM_TEX32);
|
||||
buf.Add((int32)td.bind);
|
||||
int32 num = td.floatData.size()/2;
|
||||
buf.Add(num);
|
||||
for (j=0;j<num*2;j++)
|
||||
for (int j=0;j<num*2;j++)
|
||||
buf.Add(td.floatData[j]);
|
||||
buf.End();
|
||||
}
|
||||
@@ -639,7 +637,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
|
||||
buf.Add((int32)td.bind);
|
||||
int32 num = td.doubleData.size()/2;
|
||||
buf.Add(num);
|
||||
for (j=0;j<num*2;j++)
|
||||
for (int j=0;j<num*2;j++)
|
||||
buf.Add(td.doubleData[j]);
|
||||
buf.End();
|
||||
|
||||
@@ -654,7 +652,7 @@ bool trpgGeometry::Write(trpgWriteBuffer &buf)
|
||||
if (edgeFlags.size() > 0) {
|
||||
buf.Begin(TRPG_GEOM_EFLAG);
|
||||
buf.Add((int32)edgeFlags.size());
|
||||
for (i=0;i<edgeFlags.size();i++)
|
||||
for (unsigned int i=0;i<edgeFlags.size();i++)
|
||||
buf.Add(edgeFlags[i]);
|
||||
buf.End();
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ void trpgHeader::SetDbVersion(int32 vmaj,int32 vmin)
|
||||
}
|
||||
void trpgHeader::SetTileSize(int id,const trpg2dPoint &pt)
|
||||
{
|
||||
if (id < 0 || id >= tileSize.size()) return;
|
||||
if (id < 0 || static_cast<unsigned int>(id) >= tileSize.size()) return;
|
||||
tileSize[id] = pt;
|
||||
}
|
||||
void trpgHeader::SetOrigin(const trpg3dPoint &pt)
|
||||
@@ -203,7 +203,7 @@ bool trpgHeader::GetDbVersion(int32 &vmaj,int32 &vmin) const
|
||||
bool trpgHeader::GetTileSize(int id,trpg2dPoint &pt) const
|
||||
{
|
||||
if (!isValid()) return false;
|
||||
if (id < 0 || id >= tileSize.size()) return false;
|
||||
if (id < 0 || static_cast<unsigned int>(id) >= tileSize.size()) return false;
|
||||
pt = tileSize[id];
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ trpgLightAttr::trpgLightAttr(void)
|
||||
Reset();
|
||||
}
|
||||
|
||||
trpgLightAttr::trpgLightAttr(const trpgLightAttr &in)
|
||||
trpgLightAttr::trpgLightAttr(const trpgLightAttr &in):trpgReadWriteable()
|
||||
{
|
||||
operator=(in);
|
||||
}
|
||||
@@ -691,7 +691,7 @@ trpgLight::trpgLight(void)
|
||||
index = -1;
|
||||
}
|
||||
|
||||
trpgLight::trpgLight(const trpgLight &in)
|
||||
trpgLight::trpgLight(const trpgLight &in):trpgReadWriteable()
|
||||
{
|
||||
operator=(in);
|
||||
}
|
||||
@@ -732,7 +732,7 @@ bool trpgLight::GetVertex(uint32 ix, trpg3dPoint &pt) const
|
||||
|
||||
bool trpgLight::GetVertices(trpg3dPoint *pts) const
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (!isValid()) return false;
|
||||
|
||||
@@ -745,8 +745,8 @@ bool trpgLight::GetVertices(trpg3dPoint *pts) const
|
||||
|
||||
bool trpgLight::GetVertices(float64 *fts) const
|
||||
{
|
||||
int i;
|
||||
int j = 0;
|
||||
unsigned int i;
|
||||
unsigned int j = 0;
|
||||
|
||||
if (!isValid()) return false;
|
||||
|
||||
@@ -762,8 +762,8 @@ bool trpgLight::GetVertices(float64 *fts) const
|
||||
|
||||
bool trpgLight::GetVertices(float32 *fts) const
|
||||
{
|
||||
int i;
|
||||
int j = 0;
|
||||
unsigned int i;
|
||||
unsigned int j = 0;
|
||||
|
||||
if (!isValid()) return false;
|
||||
|
||||
@@ -840,7 +840,7 @@ trpgLight& trpgLight::operator = (const trpgLight &in)
|
||||
Reset();
|
||||
|
||||
index = in.index;
|
||||
for ( int i = 0; i < in.lightPoints.size(); i++ )
|
||||
for ( unsigned int i = 0; i < in.lightPoints.size(); i++ )
|
||||
lightPoints.push_back(in.lightPoints[i]);
|
||||
|
||||
return *this;
|
||||
@@ -856,7 +856,7 @@ trpgLightTable::trpgLightTable()
|
||||
{
|
||||
}
|
||||
|
||||
trpgLightTable::trpgLightTable(const trpgLightTable &in)
|
||||
trpgLightTable::trpgLightTable(const trpgLightTable &in):trpgReadWriteable()
|
||||
{
|
||||
*this = in;
|
||||
}
|
||||
@@ -891,7 +891,7 @@ int trpgLightTable::AddLightAttr(const trpgLightAttr& inLight)
|
||||
}
|
||||
int trpgLightTable::FindAddLightAttr(const trpgLightAttr& inLight)
|
||||
{
|
||||
for (int i=0;i<lightList.size();i++)
|
||||
for (unsigned int i=0;i<lightList.size();i++)
|
||||
if (lightList[i] == inLight)
|
||||
return i;
|
||||
|
||||
@@ -903,7 +903,7 @@ int trpgLightTable::FindAddLightAttr(const trpgLightAttr& inLight)
|
||||
trpgLightTable &trpgLightTable::operator = (const trpgLightTable &in)
|
||||
{
|
||||
Reset();
|
||||
for (int i=0;i<in.lightList.size();i++)
|
||||
for (unsigned int i=0;i<in.lightList.size();i++)
|
||||
AddLightAttr(in.lightList[i]);
|
||||
|
||||
return *this;
|
||||
@@ -941,7 +941,7 @@ bool trpgLightTable::GetNumLightAttrs(int &no) const
|
||||
|
||||
const trpgLightAttr* trpgLightTable::GetLightAttrRef(int id) const
|
||||
{
|
||||
if (id < 0 || id >= lightList.size()) return NULL;
|
||||
if (id < 0 || id >= static_cast<int>(lightList.size())) return NULL;
|
||||
return &lightList[id];
|
||||
}
|
||||
|
||||
@@ -954,7 +954,7 @@ bool trpgLightTable::Read(trpgReadBuffer &buf)
|
||||
try {
|
||||
buf.Get(numLights);
|
||||
lightList.resize(numLights);
|
||||
for (unsigned int i=0;i<numLights;i++) {
|
||||
for (int i=0;i<numLights;i++) {
|
||||
buf.GetToken(lightTok,len);
|
||||
if (lightTok != TRPGLIGHTATTR) throw 1;
|
||||
buf.PushLimit(len);
|
||||
|
||||
@@ -53,7 +53,7 @@ bool trpgMatTable::isValid() const
|
||||
if (numTable <= 0 || numMat <= 0)
|
||||
return false;
|
||||
|
||||
for (int i=0;i<matTables.size();i++)
|
||||
for (unsigned int i=0;i<matTables.size();i++)
|
||||
if (!matTables[i].isValid())
|
||||
return false;
|
||||
|
||||
@@ -103,7 +103,7 @@ int trpgMatTable::AddMaterial(const trpgMaterial &mat)
|
||||
|
||||
// Look for a matching base material minus the textures
|
||||
trpgMaterial cmat = mat;
|
||||
int baseMat;
|
||||
unsigned int baseMat;
|
||||
for (baseMat = 0;baseMat < matTables.size();baseMat++) {
|
||||
trpgMaterial &bm = matTables[baseMat];
|
||||
// Compare structures
|
||||
@@ -116,7 +116,7 @@ int trpgMatTable::AddMaterial(const trpgMaterial &mat)
|
||||
cmat.autoNormal == bm.autoNormal && cmat.texEnvs.size() == bm.texEnvs.size()) {
|
||||
// Test the texture envs
|
||||
bool isSame=true;
|
||||
int i;
|
||||
unsigned int i;
|
||||
for (i=0;i<cmat.texEnvs.size();i++) {
|
||||
trpgTextureEnv &e1 = cmat.texEnvs[i];
|
||||
trpgTextureEnv &e2 = bm.texEnvs[i];
|
||||
@@ -150,8 +150,6 @@ int trpgMatTable::AddMaterial(const trpgMaterial &mat)
|
||||
// Write out material table
|
||||
bool trpgMatTable::Write(trpgWriteBuffer &buf)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -162,7 +160,7 @@ bool trpgMatTable::Write(trpgWriteBuffer &buf)
|
||||
buf.Add((int32)numMat);
|
||||
|
||||
// Write the materials
|
||||
for (i=0;i<matTables.size();i++)
|
||||
for (unsigned int i=0;i<matTables.size();i++)
|
||||
matTables[i].Write(buf);
|
||||
|
||||
buf.End();
|
||||
@@ -897,7 +895,7 @@ trpgTexture::trpgTexture()
|
||||
}
|
||||
|
||||
// Copy construction
|
||||
trpgTexture::trpgTexture(const trpgTexture &in)
|
||||
trpgTexture::trpgTexture(const trpgTexture &in):trpgReadWriteable()
|
||||
{
|
||||
mode = in.mode;
|
||||
type = in.type;
|
||||
@@ -1400,7 +1398,7 @@ void trpgTexture::CalcMipLevelSizes()
|
||||
trpgTexTable::trpgTexTable()
|
||||
{
|
||||
}
|
||||
trpgTexTable::trpgTexTable(const trpgTexTable &in)
|
||||
trpgTexTable::trpgTexTable(const trpgTexTable &in):trpgReadWriteable()
|
||||
{
|
||||
*this = in;
|
||||
}
|
||||
@@ -1442,7 +1440,7 @@ int trpgTexTable::AddTexture(const trpgTexture &inTex)
|
||||
}
|
||||
int trpgTexTable::FindAddTexture(const trpgTexture &inTex)
|
||||
{
|
||||
for (int i=0;i<texList.size();i++)
|
||||
for (unsigned int i=0;i<texList.size();i++)
|
||||
if (texList[i] == inTex)
|
||||
return i;
|
||||
|
||||
@@ -1460,7 +1458,7 @@ void trpgTexTable::SetTexture(int id,const trpgTexture &inTex)
|
||||
trpgTexTable &trpgTexTable::operator = (const trpgTexTable &in)
|
||||
{
|
||||
Reset();
|
||||
for (int i=0;i<in.texList.size();i++)
|
||||
for (unsigned int i=0;i<in.texList.size();i++)
|
||||
AddTexture(in.texList[i]);
|
||||
|
||||
return *this;
|
||||
@@ -1498,14 +1496,14 @@ bool trpgTexTable::GetNumTextures(int &no) const
|
||||
bool trpgTexTable::GetTexture(int id,trpgTexture &ret) const
|
||||
{
|
||||
if (!isValid()) return false;
|
||||
if (id < 0 || id >= texList.size()) return false;
|
||||
if (id < 0 || id >= static_cast<int>(texList.size())) return false;
|
||||
|
||||
ret = texList[id];
|
||||
return true;
|
||||
}
|
||||
const trpgTexture *trpgTexTable::GetTextureRef(int id) const
|
||||
{
|
||||
if (id < 0 || id >= texList.size()) return NULL;
|
||||
if (id < 0 || id >= static_cast<int>(texList.size())) return NULL;
|
||||
return &texList[id];
|
||||
}
|
||||
|
||||
@@ -1518,7 +1516,7 @@ bool trpgTexTable::Read(trpgReadBuffer &buf)
|
||||
try {
|
||||
buf.Get(numTex);
|
||||
texList.resize(numTex);
|
||||
for (unsigned int i=0;i<numTex;i++) {
|
||||
for (int i=0;i<numTex;i++) {
|
||||
buf.GetToken(texTok,len);
|
||||
if (texTok != TRPGTEXTURE) throw 1;
|
||||
buf.PushLimit(len);
|
||||
|
||||
@@ -34,7 +34,7 @@ trpgModel::trpgModel()
|
||||
type = External;
|
||||
useCount = 0;
|
||||
}
|
||||
trpgModel::trpgModel(const trpgModel &in)
|
||||
trpgModel::trpgModel(const trpgModel &in):trpgReadWriteable()
|
||||
{
|
||||
name = NULL;
|
||||
type = External;
|
||||
@@ -233,7 +233,7 @@ void trpgModelTable::SetNumModels(int no)
|
||||
}
|
||||
void trpgModelTable::SetModel(int id,const trpgModel &mod)
|
||||
{
|
||||
if (id < 0 || (unsigned int)id >= models.size())
|
||||
if (id < 0 || static_cast<unsigned int>(id) >= models.size())
|
||||
return;
|
||||
|
||||
models[id] = mod;
|
||||
@@ -292,14 +292,14 @@ bool trpgModelTable::GetNumModels(int &nm) const
|
||||
}
|
||||
bool trpgModelTable::GetModel(int id,trpgModel &model) const
|
||||
{
|
||||
if (!isValid() || id < 0 || id >= models.size())
|
||||
if (!isValid() || id < 0 || static_cast<unsigned int>(id) >= models.size())
|
||||
return false;
|
||||
model = models[id];
|
||||
return true;
|
||||
}
|
||||
trpgModel *trpgModelTable::GetModelRef(int id)
|
||||
{
|
||||
if (id < 0 || id >= models.size())
|
||||
if (id < 0 || static_cast<unsigned int>(id) >= models.size())
|
||||
return NULL;
|
||||
return &models[id];
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ bool trpgr_Parser::Parse(trpgReadBuffer &buf)
|
||||
class trpgSceneHelperPush : public trpgr_Callback {
|
||||
public:
|
||||
trpgSceneHelperPush(trpgSceneParser *in_parse) { parse = in_parse; };
|
||||
void *Parse(trpgToken tok,trpgReadBuffer &buf) {
|
||||
void *Parse(trpgToken ,trpgReadBuffer &) {
|
||||
// Call the start children callback
|
||||
parse->StartChildren(parse->lastObject);
|
||||
parse->parents.push_back(parse->lastObject);
|
||||
@@ -225,7 +225,7 @@ protected:
|
||||
class trpgSceneHelperPop : public trpgr_Callback {
|
||||
public:
|
||||
trpgSceneHelperPop(trpgSceneParser *in_parse) { parse = in_parse; };
|
||||
void *Parse(trpgToken tok,trpgReadBuffer &buf) {
|
||||
void *Parse(trpgToken ,trpgReadBuffer &) {
|
||||
// Make sure we don't have an extra pop
|
||||
if (parse->parents.size() == 0)
|
||||
// Note: let someone know about the extra pop
|
||||
@@ -246,7 +246,7 @@ protected:
|
||||
class trpgSceneHelperDefault : public trpgr_Callback {
|
||||
public:
|
||||
trpgSceneHelperDefault(trpgSceneParser *in_parse) { parse = in_parse; }
|
||||
void *Parse(trpgToken tok,trpgReadBuffer &buf) {
|
||||
void *Parse(trpgToken ,trpgReadBuffer &) {
|
||||
// Absorb it quietly
|
||||
return (void *)1;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ bool trpgTexTable::Print(trpgPrintBuffer &buf) const
|
||||
|
||||
buf.prnLine("----Texture Table----");
|
||||
buf.IncreaseIndent();
|
||||
for (int i=0;i<texList.size();i++) {
|
||||
for (unsigned int i=0;i<texList.size();i++) {
|
||||
sprintf(ls,"Texture %d",i); buf.prnLine(ls);
|
||||
texList[i].Print(buf);
|
||||
}
|
||||
@@ -262,7 +262,7 @@ bool trpgModelTable::Print(trpgPrintBuffer &buf) const
|
||||
|
||||
buf.prnLine("----Model Table----");
|
||||
buf.IncreaseIndent();
|
||||
for (int i=0;i<models.size();i++) {
|
||||
for (unsigned int i=0;i<models.size();i++) {
|
||||
sprintf(ls,"Model %d",i); buf.prnLine(ls);
|
||||
models[i].Print(buf);
|
||||
}
|
||||
@@ -305,7 +305,7 @@ bool trpgTileHeader::Print(trpgPrintBuffer &buf) const
|
||||
|
||||
sprintf(ls,"matList size = %d",matList.size()); buf.prnLine(ls);
|
||||
buf.IncreaseIndent();
|
||||
int i;
|
||||
unsigned int i;
|
||||
for (i=0;i<matList.size();i++) {
|
||||
sprintf(ls,"matList[%d] = %d",i,matList[i]); buf.prnLine(ls);
|
||||
}
|
||||
@@ -342,7 +342,7 @@ bool trpgColorInfo::Print(trpgPrintBuffer &buf) const
|
||||
sprintf(ls,"type = %d, bind = %d",type,bind); buf.prnLine(ls);
|
||||
sprintf(ls,"colorData size = %d",data.size());
|
||||
buf.IncreaseIndent();
|
||||
for (int i=0;i<data.size();i++) {
|
||||
for (unsigned int i=0;i<data.size();i++) {
|
||||
sprintf(ls,"color[%d] = (%f,%f,%f)",i,data[i].red,data[i].blue,data[i].green); buf.prnLine(ls);
|
||||
}
|
||||
buf.DecreaseIndent(2);
|
||||
@@ -364,7 +364,7 @@ bool trpgTexData::Print(trpgPrintBuffer &buf) const
|
||||
if (floatData.size()) {
|
||||
sprintf(ls,"tex coords (float) = %d",floatData.size()); buf.prnLine(ls);
|
||||
buf.IncreaseIndent();
|
||||
for (int i=0;i<floatData.size()/2;i++) {
|
||||
for (unsigned int i=0;i<floatData.size()/2;i++) {
|
||||
sprintf(ls,"tex coord[%d] = (%f,%f)",i,floatData[i*2+0],floatData[i*2+1]); buf.prnLine(ls);
|
||||
}
|
||||
buf.DecreaseIndent();
|
||||
@@ -372,7 +372,7 @@ bool trpgTexData::Print(trpgPrintBuffer &buf) const
|
||||
if (doubleData.size()) {
|
||||
sprintf(ls,"tex coords (double) = %d",doubleData.size());
|
||||
buf.IncreaseIndent();
|
||||
for (int i=0;i<doubleData.size()/2;i++) {
|
||||
for (unsigned int i=0;i<doubleData.size()/2;i++) {
|
||||
sprintf(ls,"tex coord[%d] = (%f,%f)",i,doubleData[i*2+0],doubleData[i*2+1]), buf.prnLine(ls);
|
||||
}
|
||||
buf.DecreaseIndent();
|
||||
@@ -397,7 +397,7 @@ bool trpgGeometry::Print(trpgPrintBuffer &buf) const
|
||||
sprintf(ls,"Material size = %d",materials.size()); buf.prnLine(ls);
|
||||
buf.IncreaseIndent();
|
||||
ls[0] = 0;
|
||||
int i;
|
||||
unsigned int i;
|
||||
for (i=0;i<materials.size();i++) {
|
||||
char locStr[100];
|
||||
sprintf(locStr,"%d ",materials[i]);
|
||||
@@ -631,12 +631,12 @@ bool trpgTileTable::Print(trpgPrintBuffer &buf) const
|
||||
buf.IncreaseIndent();
|
||||
sprintf(ls,"mode = %d",mode); buf.prnLine(ls);
|
||||
sprintf(ls,"numLod = %d",lodInfo.size()); buf.prnLine(ls);
|
||||
for (int i=0;i<lodInfo.size();i++) {
|
||||
for (unsigned int i=0;i<lodInfo.size();i++) {
|
||||
const LodInfo &li = lodInfo[i];
|
||||
sprintf(ls,"LOD %d, numX = %d, numY = %d",i,li.numX,li.numY); buf.prnLine(ls);
|
||||
buf.prnLine("File ID, Offset, Zmin, Zmax");
|
||||
buf.IncreaseIndent();
|
||||
for (int j=0;j<li.addr.size();j++) {
|
||||
for (unsigned int j=0;j<li.addr.size();j++) {
|
||||
sprintf(ls,"%d %d %f %f",li.addr[j].file,li.addr[j].offset,li.elev_min[j],li.elev_max[j]); buf.prnLine(ls);
|
||||
}
|
||||
buf.DecreaseIndent();
|
||||
@@ -769,7 +769,7 @@ bool trpgLightTable::Print(trpgPrintBuffer &buf) const
|
||||
|
||||
buf.prnLine("----Light Table----");
|
||||
buf.IncreaseIndent();
|
||||
for (int i=0;i<lightList.size();i++) {
|
||||
for (unsigned int i=0;i<lightList.size();i++) {
|
||||
sprintf(ls,"Light %d",i); buf.prnLine(ls);
|
||||
lightList[i].Print(buf);
|
||||
}
|
||||
@@ -827,7 +827,7 @@ bool trpgRangeTable::Print(trpgPrintBuffer &buf) const
|
||||
|
||||
buf.prnLine("----Range Table----");
|
||||
buf.IncreaseIndent();
|
||||
for (int i=0;i<rangeList.size();i++) {
|
||||
for (unsigned int i=0;i<rangeList.size();i++) {
|
||||
sprintf(ls,"----Range %d----",i); buf.prnLine(ls);
|
||||
rangeList[i].Print(buf);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ trpgRange::~trpgRange(void)
|
||||
Reset();
|
||||
}
|
||||
|
||||
trpgRange::trpgRange(const trpgRange &in)
|
||||
trpgRange::trpgRange(const trpgRange &in):trpgReadWriteable()
|
||||
{
|
||||
*this = in;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ bool trpgRangeTable::GetRange(int id,trpgRange &ret) const
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
if (id < 0 || id >= rangeList.size())
|
||||
if (id < 0 || id >= static_cast<int>(rangeList.size()))
|
||||
return false;
|
||||
|
||||
ret = rangeList[id];
|
||||
@@ -225,7 +225,7 @@ bool trpgRangeTable::SetRange(int id,trpgRange &inRange)
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
if (id < 0 || id >= rangeList.size())
|
||||
if (id < 0 || id >= static_cast<int>(rangeList.size()))
|
||||
return false;
|
||||
|
||||
rangeList[id] = inRange;
|
||||
@@ -242,7 +242,7 @@ int trpgRangeTable::AddRange(trpgRange &range)
|
||||
|
||||
int trpgRangeTable::FindAddRange(trpgRange &range)
|
||||
{
|
||||
for (int i=0;i<rangeList.size();i++) {
|
||||
for (unsigned int i=0;i<rangeList.size();i++) {
|
||||
if (range == rangeList[i])
|
||||
return i;
|
||||
}
|
||||
@@ -258,7 +258,7 @@ bool trpgRangeTable::Write(trpgWriteBuffer &buf)
|
||||
buf.Begin(TRPGRANGETABLE);
|
||||
buf.Add((int32)rangeList.size());
|
||||
|
||||
for (int i=0;i<rangeList.size();i++) {
|
||||
for (unsigned int i=0;i<rangeList.size();i++) {
|
||||
trpgRange &range = rangeList[i];
|
||||
range.Write(buf);
|
||||
}
|
||||
@@ -296,7 +296,7 @@ trpgRangeTable & trpgRangeTable::operator = (const trpgRangeTable &inTab)
|
||||
{
|
||||
Reset();
|
||||
|
||||
for (int i=0;i<inTab.rangeList.size();i++)
|
||||
for (unsigned int i=0;i<inTab.rangeList.size();i++)
|
||||
rangeList.push_back(rangeList[i]);
|
||||
|
||||
return *this;
|
||||
|
||||
@@ -123,7 +123,7 @@ bool trpgr_Archive::ReadHeader()
|
||||
trpgMemReadBuffer buf(ness);
|
||||
buf.SetLength(headLen);
|
||||
char *data = buf.GetDataPtr();
|
||||
if (fread(data,1,headLen,fp) != headLen) return false;
|
||||
if (fread(data,1,headLen,fp) != static_cast<unsigned int>(headLen)) return false;
|
||||
|
||||
// Set up a parser
|
||||
// Catch the tables we need for the archive
|
||||
@@ -179,10 +179,10 @@ bool trpgr_Archive::ReadTile(uint32 x,uint32 y,uint32 lod,trpgMemReadBuffer &buf
|
||||
// Reality check the address
|
||||
int32 numLods;
|
||||
header.GetNumLods(numLods);
|
||||
if (lod >= numLods) return false;
|
||||
if (lod >= static_cast<unsigned int>(numLods)) return false;
|
||||
trpg2iPoint lodSize;
|
||||
header.GetLodSize(lod,lodSize);
|
||||
if (x >= lodSize.x || y >= lodSize.y) return false;
|
||||
if (x >= static_cast<unsigned int>(lodSize.x) || y >= static_cast<unsigned int>(lodSize.y)) return false;
|
||||
|
||||
trpgTileTable::TileMode tileMode;
|
||||
tileTable.GetMode(tileMode);
|
||||
@@ -275,7 +275,7 @@ bool trpgr_Archive::trpgGetTileMBR(uint32 x,uint32 y,uint32 lod,trpg3dPoint &ll,
|
||||
header.GetNumLods(numLod);
|
||||
trpg2iPoint maxXY;
|
||||
header.GetLodSize(lod,maxXY);
|
||||
if (x >= maxXY.x || y>= maxXY.y)
|
||||
if (x >= static_cast<unsigned int>(maxXY.x) || y>= static_cast<unsigned int>(maxXY.y))
|
||||
return false;
|
||||
|
||||
trpg3dPoint origin;
|
||||
@@ -478,7 +478,7 @@ bool trpgrImageHelper::GetImagePath(const trpgTexture *tex,char *fullPath,int pa
|
||||
tex->GetName(name,nameLen);
|
||||
nameLen = strlen(name);
|
||||
|
||||
if (strlen(dir) + nameLen + 2 > pathLen)
|
||||
if (strlen(dir) + nameLen + 2 > static_cast<unsigned int>(pathLen))
|
||||
return false;
|
||||
|
||||
sprintf(fullPath,"%s" PATHSEPERATOR "%s",dir,name);
|
||||
|
||||
@@ -298,7 +298,7 @@ bool trpgReadBuffer::SkipToLimit()
|
||||
// See if the next read is going to blow the limits
|
||||
bool trpgReadBuffer::TestLimit(int len)
|
||||
{
|
||||
for (int i=0;i<limits.size();i++)
|
||||
for (unsigned int i=0;i<limits.size();i++)
|
||||
if (len > limits[i])
|
||||
return false;
|
||||
|
||||
@@ -309,7 +309,7 @@ bool trpgReadBuffer::TestLimit(int len)
|
||||
// We just read a few bytes. Update the limits
|
||||
void trpgReadBuffer::UpdateLimits(int len)
|
||||
{
|
||||
for (int i=0;i<limits.size();i++)
|
||||
for (unsigned int i=0;i<limits.size();i++)
|
||||
limits[i] -= len;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ bool trpgMemReadBuffer::isEmpty()
|
||||
return true;
|
||||
|
||||
// Also test the limits
|
||||
for (int i=0;i<limits.size();i++)
|
||||
for (unsigned int i=0;i<limits.size();i++)
|
||||
if (limits[i] == 0) return true;
|
||||
|
||||
return false;
|
||||
@@ -483,7 +483,7 @@ bool trpgrAppFile::Read(trpgMemReadBuffer *buf,int32 offset)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fread(data,sizeof(char),len,fp) != len) {
|
||||
if (fread(data,sizeof(char),len,fp) != static_cast<unsigned int>(len)) {
|
||||
valid = false;
|
||||
return false;
|
||||
}
|
||||
@@ -522,7 +522,7 @@ bool trpgrAppFile::Read(char *data,int32 offset,uint32 dataSize)
|
||||
return false;
|
||||
}
|
||||
// It's all right to read less than the whol data block
|
||||
if (dataSize > len)
|
||||
if (dataSize > static_cast<unsigned int>(len))
|
||||
return false;
|
||||
|
||||
// Read the raw data
|
||||
|
||||
@@ -145,7 +145,7 @@ trpgReadGroupBase::~trpgReadGroupBase()
|
||||
// Delete all children
|
||||
void trpgReadGroupBase::DeleteChildren()
|
||||
{
|
||||
for (int i=0;i<children.size();i++)
|
||||
for (unsigned int i=0;i<children.size();i++)
|
||||
if (children[i])
|
||||
delete children[i];
|
||||
}
|
||||
@@ -159,7 +159,7 @@ void trpgReadGroupBase::AddChild(trpgReadNode *n)
|
||||
// Unref a child (but don't delete it)
|
||||
void trpgReadGroupBase::unRefChild(int id)
|
||||
{
|
||||
if (id < 0 || id >= children.size())
|
||||
if (id < 0 || id >= static_cast<int>(children.size()))
|
||||
return;
|
||||
children[id] = NULL;
|
||||
}
|
||||
@@ -167,7 +167,7 @@ void trpgReadGroupBase::unRefChild(int id)
|
||||
// Unref all the children (they've probably been moved elsewhere)
|
||||
void trpgReadGroupBase::unRefChildren()
|
||||
{
|
||||
for (int i=0;i<children.size();i++)
|
||||
for (unsigned int i=0;i<children.size();i++)
|
||||
unRefChild(i);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ trpgMBR trpgReadGroupBase::GetMBR() const
|
||||
trpgMBR *cmbr = const_cast<trpgMBR *>(&mbr);
|
||||
trpgMBR kmbr;
|
||||
// Ask the kids
|
||||
for (int i=0;i<children.size();i++) {
|
||||
for (unsigned int i=0;i<children.size();i++) {
|
||||
kmbr = children[i]->GetMBR();
|
||||
cmbr->Union(kmbr);
|
||||
}
|
||||
@@ -232,7 +232,7 @@ trpgMBR trpgReadGeometry::GetMBR() const
|
||||
class trpgReadGeometryHelper : public trpgr_Callback {
|
||||
public:
|
||||
trpgReadGeometryHelper(trpgSceneGraphParser *in_parse) { parse = in_parse;}
|
||||
void *Parse(trpgToken tok,trpgReadBuffer &buf) {
|
||||
void *Parse(trpgToken,trpgReadBuffer &buf) {
|
||||
trpgReadGeometry *geom = new trpgReadGeometry();
|
||||
trpgGeometry *data = geom->GetData();
|
||||
if (!data->Read(buf)) {
|
||||
@@ -261,7 +261,7 @@ protected:
|
||||
class trpgReadGroupHelper : public trpgr_Callback {
|
||||
public:
|
||||
trpgReadGroupHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; }
|
||||
void *Parse(trpgToken tok,trpgReadBuffer &buf) {
|
||||
void *Parse(trpgToken,trpgReadBuffer &buf) {
|
||||
trpgReadGroup *group = new trpgReadGroup();
|
||||
trpgGroup *data = group->GetData();
|
||||
if (!data->Read(buf)) {
|
||||
@@ -286,7 +286,7 @@ protected:
|
||||
class trpgReadBillboardHelper : public trpgr_Callback {
|
||||
public:
|
||||
trpgReadBillboardHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; }
|
||||
void *Parse(trpgToken tok,trpgReadBuffer &buf) {
|
||||
void *Parse(trpgToken,trpgReadBuffer &buf) {
|
||||
trpgReadBillboard *group = new trpgReadBillboard();
|
||||
trpgBillboard *data = group->GetData();
|
||||
if (!data->Read(buf)) {
|
||||
@@ -311,7 +311,7 @@ protected:
|
||||
class trpgReadAttachHelper : public trpgr_Callback {
|
||||
public:
|
||||
trpgReadAttachHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; }
|
||||
void *Parse(trpgToken tok,trpgReadBuffer &buf) {
|
||||
void *Parse(trpgToken,trpgReadBuffer &buf) {
|
||||
trpgReadAttach *attach = new trpgReadAttach();
|
||||
trpgAttach *data = attach->GetData();
|
||||
if (!data->Read(buf)) {
|
||||
@@ -336,7 +336,7 @@ protected:
|
||||
class trpgReadLodHelper : public trpgr_Callback {
|
||||
public:
|
||||
trpgReadLodHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; }
|
||||
void *Parse(trpgToken tok,trpgReadBuffer &buf) {
|
||||
void *Parse(trpgToken,trpgReadBuffer &buf) {
|
||||
trpgReadLod *lod = new trpgReadLod();
|
||||
trpgLod *data = lod->GetData();
|
||||
if (!data->Read(buf)) {
|
||||
@@ -361,7 +361,7 @@ protected:
|
||||
class trpgReadModelRefHelper : public trpgr_Callback {
|
||||
public:
|
||||
trpgReadModelRefHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; }
|
||||
void *Parse(trpgToken tok,trpgReadBuffer &buf) {
|
||||
void *Parse(trpgToken,trpgReadBuffer &buf) {
|
||||
trpgReadModelRef *mod = new trpgReadModelRef();
|
||||
trpgModelRef *data = mod->GetData();
|
||||
if (!data->Read(buf)) {
|
||||
@@ -381,7 +381,8 @@ protected:
|
||||
class trpgReadTileHeaderHelper : public trpgr_Callback {
|
||||
public:
|
||||
trpgReadTileHeaderHelper(trpgSceneGraphParser *in_parse) { parse = in_parse; }
|
||||
void *Parse(trpgToken tok,trpgReadBuffer &buf) {
|
||||
void *Parse(trpgToken,trpgReadBuffer &buf)
|
||||
{
|
||||
trpgReadTileHeader *th = parse->GetTileHeaderRef();
|
||||
trpgTileHeader *data = th->GetData();
|
||||
if (!data->Read(buf))
|
||||
@@ -488,7 +489,7 @@ bool trpgSceneGraphParser::StartChildren(void *in_node)
|
||||
for the parent above the current one.
|
||||
If there isn't one, we'll just stick things in our top group.
|
||||
*/
|
||||
bool trpgSceneGraphParser::EndChildren(void *in_node)
|
||||
bool trpgSceneGraphParser::EndChildren(void *)
|
||||
{
|
||||
// We don't need it here, but this is the node we just
|
||||
// finished putting children under. If you need to close
|
||||
|
||||
@@ -65,7 +65,7 @@ void trpgTileTable::SetNumLod(int numLod)
|
||||
|
||||
void trpgTileTable::SetNumTiles(int nx,int ny,int lod)
|
||||
{
|
||||
if (nx <= 0 || ny <= 0 || lod < 0 || lod >= lodInfo.size())
|
||||
if (nx <= 0 || ny <= 0 || lod < 0 || static_cast<unsigned int>(lod) >= lodInfo.size())
|
||||
return;
|
||||
|
||||
// Got a table we need to maintain
|
||||
@@ -97,7 +97,7 @@ void trpgTileTable::SetNumTiles(int nx,int ny,int lod)
|
||||
}
|
||||
void trpgTileTable::SetTile(int x,int y,int lod,trpgwAppAddress &ref,float32 zmin,float32 zmax)
|
||||
{
|
||||
if (lod < 0 || lod >= lodInfo.size()) return;
|
||||
if (lod < 0 || static_cast<unsigned int>(lod) >= lodInfo.size()) return;
|
||||
if (mode != Local)
|
||||
return;
|
||||
LodInfo &li = lodInfo[lod];
|
||||
@@ -129,7 +129,7 @@ bool trpgTileTable::GetTile(int x,int y,int lod,trpgwAppAddress &ref,float32 &zm
|
||||
{
|
||||
if (!isValid()) return false;
|
||||
|
||||
if (lod < 0 || lod >= lodInfo.size()) return false;
|
||||
if (lod < 0 || static_cast<unsigned int>(lod) >= lodInfo.size()) return false;
|
||||
if (mode != Local)
|
||||
return false;
|
||||
const LodInfo &li = lodInfo[lod];
|
||||
@@ -162,7 +162,7 @@ bool trpgTileTable::Write(trpgWriteBuffer &buf)
|
||||
buf.Add(numLod);
|
||||
|
||||
// Write each terrain LOD set
|
||||
for (unsigned int i=0;i<numLod;i++) {
|
||||
for (int i=0;i<numLod;i++) {
|
||||
LodInfo &li = lodInfo[i];
|
||||
buf.Add(li.numX);
|
||||
buf.Add(li.numY);
|
||||
@@ -205,7 +205,7 @@ bool trpgTileTable::Read(trpgReadBuffer &buf)
|
||||
if (numLod <= 0) throw 1;
|
||||
lodInfo.resize(numLod);
|
||||
|
||||
for (unsigned int i=0;i<numLod;i++) {
|
||||
for (int i=0;i<numLod;i++) {
|
||||
LodInfo &li = lodInfo[i];
|
||||
buf.Get(li.numX);
|
||||
buf.Get(li.numY);
|
||||
@@ -214,7 +214,7 @@ bool trpgTileTable::Read(trpgReadBuffer &buf)
|
||||
li.addr.resize(numTile);
|
||||
li.elev_min.resize(numTile);
|
||||
li.elev_max.resize(numTile);
|
||||
unsigned int j;
|
||||
int j;
|
||||
for (j=0;j<numTile;j++) {
|
||||
trpgwAppAddress &ref = li.addr[j];
|
||||
buf.Get(ref.file);
|
||||
@@ -259,13 +259,13 @@ void trpgTileHeader::Reset()
|
||||
// Set functions
|
||||
void trpgTileHeader::SetMaterial(int no,int id)
|
||||
{
|
||||
if (no < 0 || no >= matList.size())
|
||||
if (no < 0 || static_cast<unsigned int>(no) >= matList.size())
|
||||
return;
|
||||
matList[no] = id;
|
||||
}
|
||||
void trpgTileHeader::SetModel(int no,int id)
|
||||
{
|
||||
if (no < 0 || no >= modelList.size())
|
||||
if (no < 0 || static_cast<unsigned int>(no) >= modelList.size())
|
||||
return;
|
||||
modelList[no] = id;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ void trpgTileHeader::SetModel(int no,int id)
|
||||
void trpgTileHeader::AddMaterial(int id)
|
||||
{
|
||||
// Look for it first
|
||||
for (int i=0;i<matList.size();i++)
|
||||
for (unsigned int i=0;i<matList.size();i++)
|
||||
if (matList[i] == id)
|
||||
return;
|
||||
// Didn't find it, add it.
|
||||
@@ -282,7 +282,7 @@ void trpgTileHeader::AddMaterial(int id)
|
||||
}
|
||||
void trpgTileHeader::AddModel(int id)
|
||||
{
|
||||
for (int i=0;i<modelList.size();i++)
|
||||
for (unsigned int i=0;i<modelList.size();i++)
|
||||
if (modelList[i] == id)
|
||||
return;
|
||||
modelList.push_back(id);
|
||||
@@ -309,7 +309,7 @@ bool trpgTileHeader::GetNumLocalMaterial(int32 &retNum) const
|
||||
|
||||
bool trpgTileHeader::GetLocalMaterial(int32 id,trpgLocalMaterial &retMat) const
|
||||
{
|
||||
if (id < 0 || id >= locMats.size())
|
||||
if (id < 0 || static_cast<unsigned int>(id) >= locMats.size())
|
||||
return false;
|
||||
|
||||
retMat = locMats[id];
|
||||
@@ -333,7 +333,7 @@ bool trpgTileHeader::GetNumMaterial(int32 &no) const
|
||||
}
|
||||
bool trpgTileHeader::GetMaterial(int32 id,int32 &mat) const
|
||||
{
|
||||
if (!isValid() || id < 0 || id >= matList.size())
|
||||
if (!isValid() || id < 0 || static_cast<unsigned int>(id) >= matList.size())
|
||||
return false;
|
||||
mat = matList[id];
|
||||
return true;
|
||||
@@ -346,7 +346,7 @@ bool trpgTileHeader::GetNumModel(int32 &no) const
|
||||
}
|
||||
bool trpgTileHeader::GetModel(int32 id,int32 &m) const
|
||||
{
|
||||
if (!isValid() || id < 0 || id >= modelList.size())
|
||||
if (!isValid() || id < 0 || static_cast<unsigned int>(id) >= modelList.size())
|
||||
return false;
|
||||
m = modelList[id];
|
||||
return true;
|
||||
|
||||
@@ -254,7 +254,7 @@ bool trpgwArchive::WriteHeader()
|
||||
int32 numLod;
|
||||
header.GetNumLods(numLod);
|
||||
tileTable.SetNumLod(numLod);
|
||||
for (unsigned int i=0;i<numLod;i++) {
|
||||
for (int i=0;i<numLod;i++) {
|
||||
trpg2iPoint lodSize;
|
||||
header.GetLodSize(i,lodSize);
|
||||
tileTable.SetNumTiles(lodSize.x,lodSize.y,i);
|
||||
@@ -320,7 +320,7 @@ bool trpgwArchive::WriteHeader()
|
||||
|
||||
// Write the header length
|
||||
int32 headerSize = buf.length();
|
||||
int headLen = headerSize;
|
||||
unsigned int headLen = headerSize;
|
||||
if (ness != cpuNess)
|
||||
headerSize = trpg_byteswap_int(headerSize);
|
||||
if (fwrite(&headerSize,1,sizeof(int32),fp) != sizeof(int32)) return false;
|
||||
@@ -414,7 +414,7 @@ bool trpgwArchive::WriteTile(unsigned int x,unsigned int y,unsigned int lod, flo
|
||||
return false;
|
||||
|
||||
// Write the header first
|
||||
int len;
|
||||
unsigned int len;
|
||||
const char *data;
|
||||
if (head) {
|
||||
data = head->getData();
|
||||
@@ -616,7 +616,7 @@ void trpgwGeomHelper::ResetPolygon()
|
||||
|
||||
// Set the current color
|
||||
// Note: Required
|
||||
void trpgwGeomHelper::SetColor(trpgColor &col)
|
||||
void trpgwGeomHelper::SetColor(trpgColor &)
|
||||
{
|
||||
// tmpColor = col;
|
||||
}
|
||||
@@ -853,7 +853,7 @@ void trpgwGeomHelper::Optimize()
|
||||
break;
|
||||
case Fan:
|
||||
{
|
||||
bool isFan;
|
||||
bool isFan=false; // value shouldn't matter to the loop below, but set to false to remove warnings.
|
||||
int primLen = 0;
|
||||
|
||||
// Dump A into the Fan
|
||||
|
||||
@@ -332,14 +332,14 @@ bool trpgwAppFile::Append(const trpgMemWriteBuffer *buf1,const trpgMemWriteBuffe
|
||||
// Write the data out
|
||||
const char *data = buf1->getData();
|
||||
int len = buf1->length();
|
||||
if (fwrite(data,sizeof(char),len,fp) != len) {
|
||||
if (fwrite(data,sizeof(char),len,fp) != static_cast<unsigned int>(len)) {
|
||||
valid = false;
|
||||
return false;
|
||||
}
|
||||
if (buf2) {
|
||||
data = buf2->getData();
|
||||
len = buf2->length();
|
||||
if (fwrite(data,sizeof(char),len,fp) != len) {
|
||||
if (fwrite(data,sizeof(char),len,fp) != static_cast<unsigned int>(len)) {
|
||||
valid = false;
|
||||
return false;
|
||||
}
|
||||
@@ -362,7 +362,7 @@ bool trpgwAppFile::Append(const char *data,int size)
|
||||
}
|
||||
|
||||
// Write the data out
|
||||
if (fwrite(data,sizeof(char),size,fp) != size) {
|
||||
if (fwrite(data,sizeof(char),size,fp) != static_cast<unsigned int>(size)) {
|
||||
valid = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user