Dear CrystalSpace3D fellows;
I cannot successfully place a mesh into a celRegion, and in turn, a csRegion, using the PcZoneManager's PointMesh() function. I have a world class that has an entity which holds a Zone Manager property class. It's PointMesh() function cannot find the entity, region and start position using the names that I give to it. It keeps on having trouble when using string manipulation functions to examine the names I passed to it. I am using a debugger to see this. It has visible trouble during the string manipulation function, Replace(), that I believe is being called on each of the names that I passed to the function: the entity name, the region name and the start position name. The Replace() function leads to the GetDataMutable() function, which returns a pointer to a string's data. The function attempts to return the "mutable" data, but it cannot access the address of it and the debugger says,
Cannot access memory at 0x0.
The address is usually 0x0, but sometimes it is 0xffffffff, or something similiar;
I have had trouble in the past with objects that carry these addresses. Does 0x0 stand for invalid memory position? The PointMesh function goes through all of it's steps, but when it initializes a pointer to the celEntity which has the name I specified, the pointer is not a valid address to my entity. The same happens for the PcMesh of course, since it is queried from the entity, but even the region that I specified does not get initialized. Nothing does. At the very end of the function, then my debugger shows the whole function command even though the function is basicly finished. My debugger does this with all functions; it is as if the function is being reexecuted after it has prepared itself, though I guess this isn't so. The command, looks like this,
0x4137c8ee in celPcZoneManager::PointMesh (this=0x6e656700,
entity=0x73726f54 <Address 0x73726f54 out of bounds>,
regionname=0x6361466f <Address 0x6361466f out of bounds>,
startname=0x79726f74 <Address 0x79726f74 out of bounds>)
Then, in spite of those errors, the function returns, 0, which I believe means CEL_ZONEERROR_OK, but my program glitches right after and sends out a segmentation fault.
I passed the same entity name and region name to a function that I made for placing a mesh into a sector and it's corresponding celRegion and my function doesn't have trouble with the const char pointers. Although it doesn't use the Replace function on them, it does use
GetDataMutable() and it has no memory access problems while doing so. However, my function is nonfunctional in other ways.
Could anyone tell me why memory can be unaccessible? Could I be attempting to access private members of a class, or is the reason always that the memory space I am examining is not a valid patch of memory? I need to ask more questions later, please respond if you can shed light on my problems.
StewyP of the Eridanus Project