Correct check for ACE_BIG_ENDIAN. Warning fixed and code cleanups.

This commit is contained in:
VladimirMangos 2008-11-03 18:01:31 +03:00
parent 843a0d7d02
commit 3e43600c3b
14 changed files with 60 additions and 57 deletions

View file

@ -261,7 +261,7 @@ public:
/** Returns the bounds of the sub array. Used by makeNode. */
static AABox computeBounds(
const Array<_AABSPTree::Handle<T>*>& point,
const Array<_AABSPTree::Handle<T>*>& point,
int beginIndex,
int endIndex) {
@ -770,9 +770,11 @@ public:
// Some of the elements in the lt or gt array might really overlap the split location.
// Move them as needed.
for (int i = 0; i < lt.size(); ++i) {
const AABox& bounds = lt[i]->bounds;
if ((bounds.low()[splitAxis] <= splitLocation) && (bounds.high()[splitAxis] >= splitLocation)) {
for (int i = 0; i < lt.size(); ++i)
{
const AABox& lt_bounds = lt[i]->bounds;
if ((bounds.low()[splitAxis] <= splitLocation) && (lt_bounds.high()[splitAxis] >= splitLocation))
{
node->valueArray.append(lt[i]);
// Remove this element and process the new one that
// is swapped in in its place.
@ -780,9 +782,11 @@ public:
}
}
for (int i = 0; i < gt.size(); ++i) {
const AABox& bounds = gt[i]->bounds;
if ((bounds.low()[splitAxis] <= splitLocation) && (bounds.high()[splitAxis] >= splitLocation)) {
for (int i = 0; i < gt.size(); ++i)
{
const AABox& gt_bounds = gt[i]->bounds;
if ((bounds.low()[splitAxis] <= splitLocation) && (gt_bounds.high()[splitAxis] >= splitLocation))
{
node->valueArray.append(gt[i]);
// Remove this element and process the new one that
// is swapped in in its place.
@ -819,19 +823,20 @@ public:
// Verify that all objects ended up on the correct side of the split.
// (i.e., make sure that the Array partition was correct)
for (int i = 0; i < lt.size(); ++i) {
const AABox& bounds = lt[i]->bounds;
debugAssert(bounds.high()[splitAxis] < splitLocation);
const AABox& lt_bounds = lt[i]->bounds;
debugAssert(lt_bounds.high()[splitAxis] < splitLocation);
}
for (int i = 0; i < gt.size(); ++i) {
const AABox& bounds = gt[i]->bounds;
debugAssert(bounds.low()[splitAxis] > splitLocation);
const AABox& gt_bounds = gt[i]->bounds;
debugAssert(gt_bounds.low()[splitAxis] > splitLocation);
}
for (int i = 0; i < node->valueArray.size(); ++i) {
const AABox& bounds = node->valueArray[i]->bounds;
debugAssert(bounds.high()[splitAxis] >= splitLocation);
debugAssert(bounds.low()[splitAxis] <= splitLocation);
for (int i = 0; i < node->valueArray.size(); ++i)
{
const AABox& node_bounds = node->valueArray[i]->bounds;
debugAssert(node_bounds.high()[splitAxis] >= splitLocation);
debugAssert(node_bounds.low()[splitAxis] <= splitLocation);
}
# endif
@ -925,16 +930,17 @@ public:
/**
Throws out all elements of the set.
*/
void clear() {
void clear()
{
typedef typename Table<_internal::Indirector<_AABSPTree::Handle<T> >, Node* >::Iterator It;
// Delete all handles stored in the member table
It cur = memberTable.begin();
It end = memberTable.end();
while (cur != end) {
delete cur->key.handle;
cur->key.handle = NULL;
++cur;
It tab_cur = memberTable.begin();
It tab_end = memberTable.end();
while (tab_cur != tab_end) {
delete tab_cur->key.handle;
tab_cur->key.handle = NULL;
++tab_cur;
}
memberTable.clear();
@ -1543,10 +1549,6 @@ public:
private:
friend class AABSPTree<T>;
// Note: this is a Table iterator, we are currently defining
// Set iterator
typename Table<Member, Node*>::Iterator it;
Iterator(const typename Table<Member, Node*>::Iterator& it) : it(it) {}
public:

View file

@ -126,8 +126,8 @@ namespace VMAP
}
const G3D::Array<unsigned int>& getMaps() const { return iMapIds; }
inline bool isAlreadyProcessedSingleFile(std::string pName) { return(iProcesseSingleFiles.containsKey(pName)); }
inline void addAlreadyProcessedSingleFile(std::string pName) { iProcesseSingleFiles.set(pName,pName); }
bool isAlreadyProcessedSingleFile(std::string pName) const { return iProcesseSingleFiles.containsKey(pName); }
void addAlreadyProcessedSingleFile(std::string pName) { iProcesseSingleFiles.set(pName,pName); }
inline void addWorldAreaMap(unsigned int pMapId)
{
@ -136,7 +136,7 @@ namespace VMAP
iWorldAreaGroups.append(pMapId);
}
}
inline bool isWorldAreaMap(unsigned int pMapId) { return(iWorldAreaGroups.contains(pMapId)); }
bool isWorldAreaMap(unsigned int pMapId) const { return(iWorldAreaGroups.contains(pMapId)); }
void setModelNameFilterMethod(bool (*pFilterMethod)(char *pName)) { iFilterMethod = pFilterMethod; }
};

View file

@ -52,8 +52,9 @@ namespace VMAP
SubModel *iSubModel;
G3D::AABox iBox;
ModelContainer (const ModelContainer& c): BaseModel(c) {}
ModelContainer& operator=(const ModelContainer& ) {}
// not allowed copy
explicit ModelContainer (const ModelContainer&);
ModelContainer& operator=(const ModelContainer&);
public:
ModelContainer() : BaseModel() { iNSubModel =0; iSubModel = 0; };
@ -65,7 +66,7 @@ namespace VMAP
~ModelContainer(void);
inline const void setSubModel(const SubModel& pSubModel, int pPos) { iSubModel[pPos] = pSubModel; }
inline void setSubModel(const SubModel& pSubModel, int pPos) { iSubModel[pPos] = pSubModel; }
inline const SubModel& getSubModel(int pPos) const { return iSubModel[pPos]; }

View file

@ -23,13 +23,13 @@
namespace VMAP
{
//=====================================
#define MAX_CAN_FALL_DISTANCE 10.0
#define MAX_CAN_FALL_DISTANCE 10.0f
const char VMAP_MAGIC[] = "VMAP_2.0";
class VMapDefinitions
{
public:
static const double getMaxCanFallDistance() { return(MAX_CAN_FALL_DISTANCE); }
static float getMaxCanFallDistance() { return MAX_CAN_FALL_DISTANCE; }
};
//======================================

View file

@ -88,14 +88,14 @@ namespace VMAP
private:
float getIntersectionTime(const G3D::Ray& pRay, float pMaxDist, bool pStopAtFirstHit);
bool isAlreadyLoaded(const std::string& pName) { return(iLoadedModelContainer.containsKey(pName)); }
bool isAlreadyLoaded(const std::string& pName) const { return(iLoadedModelContainer.containsKey(pName)); }
void setLoadedMapTile(unsigned int pTileIdent) { iLoadedMapTiles.set(pTileIdent, true); }
void removeLoadedMapTile(unsigned int pTileIdent) { iLoadedMapTiles.remove(pTileIdent); }
bool hasLoadedMapTiles() { return(iLoadedMapTiles.size() > 0); }
bool containsLoadedMapTile(unsigned int pTileIdent) { return(iLoadedMapTiles.containsKey(pTileIdent)); }
bool hasLoadedMapTiles() const { return iLoadedMapTiles.size() > 0; }
bool containsLoadedMapTile(unsigned int pTileIdent) const { return(iLoadedMapTiles.containsKey(pTileIdent)); }
public:
ManagedModelContainer *getModelContainer(const std::string& pName) { return(iLoadedModelContainer.get(pName)); }
const bool hasDirFile(const std::string& pDirName) const { return(iLoadedDirFiles.containsKey(pDirName)); }
bool hasDirFile(const std::string& pDirName) const { return(iLoadedDirFiles.containsKey(pDirName)); }
FilesInDir& getDirFiles(const std::string& pDirName) const { return(iLoadedDirFiles.get(pDirName)); }
public:
MapTree(const char *pBasePath);
@ -111,7 +111,7 @@ namespace VMAP
void unloadMap(const std::string& dirFileName, unsigned int pMapTileIdent, bool pForce=false);
void getModelContainer(G3D::Array<ModelContainer *>& pArray ) { iTree->getMembers(pArray); }
const void addDirFile(const std::string& pDirName, const FilesInDir& pFilesInDir) { iLoadedDirFiles.set(pDirName, pFilesInDir); }
void addDirFile(const std::string& pDirName, const FilesInDir& pFilesInDir) { iLoadedDirFiles.set(pDirName, pFilesInDir); }
size_t size() { return(iTree->size()); }
};

View file

@ -62,7 +62,7 @@ namespace VMAP
{
// Integer representation of a floating-point value.
#define IR(x) ((G3D::uint32&)x)
#define IR(x) (reinterpret_cast<G3D::uint32 const&>(x))
Inside = true;
const G3D::Vector3& MinB = box.low();