its not getting fixed any time soon if not never. im sorry to bust ur balls on this news.
My V-maps work on custom maps (edited blizz ones) and even on custom continents (map id 5000+ for example), so I don't know why it isn't working for you :S
bool StaticMapTree::InitMap(const std::string & fname, VMapManager2* vm)
if(success) { try { iNTreeValues = iTree.primCount(); iTreeValues = new ModelInstance[iNTreeValues]; } catch(...) { printf("FATAL ERROR CAUGHT: %s", fname.c_str()); return false; } }
Value of iNTreeValues? I'd guess 0 or negative. What does the remainder of that function do?
bool StaticMapTree::InitMap(const std::string & fname, VMapManager2* vm) { bool success = true; std::string fullname = iBasePath + fname; FILE* rf = fopen(fullname.c_str(), "rb"); if(!rf) return false; else { char chunk[8]; //general info if(!readChunk(rf, chunk, VMAP_MAGIC, 8)) success = false; char tiled; if(success && fread(&tiled, sizeof(char), 1, rf) != 1) success = false; iIsTiled = (tiled != 0); // Nodes if(success && !readChunk(rf, chunk, "NODE", 4)) success = false; if(success) success = iTree.readFromFile(rf); if(success) { try { iNTreeValues = iTree.primCount(); iTreeValues = new ModelInstance[iNTreeValues]; } catch(...) { printf("Caught fatal error!!! < MapTree.cpp, fname: %sn", fname.c_str()); printf("iNTreeValues = %dn", iTree.primCount()); return false; } } if(success && !readChunk(rf, chunk, "GOBJ", 4)) success = false; // global model spawns // only non-tiled maps have them, and if so exactly one (so far at least...) ModelSpawn spawn;#ifdef VMAP_DEBUG DEBUG_LOG("Map isTiled: %u", static_cast<G3D::uint32>(iIsTiled));#endif if(!iIsTiled && ModelSpawn::readFromFile(rf, spawn)) { WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); if(model) { // assume that global model always is the first and only tree value (could be improved...) iTreeValues[0] = ModelInstance(spawn, model); iLoadedSpawns[0] = 1; } else success = false; } fclose(rf); } return success; }
So the exception is a std::bad_alloc? Either RAM is full, or 97987 * sizeof (ModelInstance) > numeric_limits<size_t>::max(), which would be a huge ModelInstance.Is there a ctor of ModelInstance that may throw?
class ModelInstance: public ModelSpawn { public: ModelInstance(): iModel(0) {} ModelInstance(const ModelSpawn & spawn, WorldModel* model); void setUnloaded() { iModel = 0; } bool intersectRay(const G3D::Ray & pRay, float & pMaxDist, bool pStopAtFirstHit) const; void intersectPoint(const G3D::Vector3 & p, AreaInfo & info) const; bool GetLocationInfo(const G3D::Vector3 & p, LocationInfo & info) const; bool GetLiquidLevel(const G3D::Vector3 & p, LocationInfo & info, float & liqHeight) const; protected: G3D::Matrix3 iInvRot; float iInvScale; WorldModel* iModel;#ifdef MMAP_GENERATOR public: WorldModel* const getWorldModel();#endif
ModelInstance::ModelInstance(const ModelSpawn & spawn, WorldModel* model): ModelSpawn(spawn), iModel(model) { iInvRot = G3D::Matrix3::fromEulerAnglesZYX(G3D::pi() * iRot.y / 180.f, G3D::pi() * iRot.x / 180.f, G3D::pi() * iRot.z / 180.f).inverse(); iInvScale = 1.f / iScale; }