The "old global array m_spawns[x]" doesn't exist any more (which wasn't really global anways). There was an array in the Map class and a QList in the EQPacket class both with data that replicated what was in the SpawnShell and each other (this duplication of data really added a lot of bloat to ShowEQ's memory usage). The SpawnShell manages an STL map of Spawn data in a format independent of the network transfer format.
To retrieve information on a specific spawn by id, you can retrieve it using the SpawnShell's findID() method with a type of tSpawn which returns a pointer to the const Item base class of the Spawn object as such:
Code:
const Item* item = m_spawnShell->findID(tSpawn, spawnId);
where spawnId is the number of the spawn you are requesting.
You can coerce this to the const Spawn type using either the safe spawnType inilne function (which will only do the conversion if you actually have an instance of the Spawn class) and returns NULL otherwise, for example:
Code:
const Spawn* spawn = spawnType(item);
if (spawn != NULL)
{
// whatever read access you wanted to make to the Spawn object
}
Or if your usage of findID always passes the tSpawn itemType and you wanna play fast and loose you can just cast it to the const Spawn type as follows:
Code:
const Spawn* spawn = (const Spawn*)item;
If for some odd reason you need to get an iterator over the map of spawns you can do the following:
[const]
// retrieve a const reference to the map that the spawns are stored in.
const ItemMap& itemMap = m_spawnShell->spawns();
// declare an iterator over the set of spawns
ItemConstIterator it;
// variable to store the pointer to the Item base class
const Item* item;
// variable to store the pointer to the Spawn class
const Spawn* spawn;
// iterate over the spawns
for (it = itemMap.begin(); it != itemMap.end(); ++it)
{
// retrieve a pointer to the item
item = it->second;
// coerce it to the Spawn type
spawn = (const Spawn*)item;
// perform whatever read accesses you need on the spawn object.
}
[/code]
These are not globablly accessible in a non-const fashion because it protects the SpawnShell from people accidentally deleting or modifying the Spawn data in an uncontrolled fashion thus creating hard to track down bugs. The only class that should be modifying the Spawn's data is the SpawnShell. There used to be a lot of bugs/problems caused by the uncontrolled modification of these data structures and the data passed into notifications.
As to Yendors comment, the spawn logging stuff should never have been hacked into the EQPacket class in the first place. It is easy enough to create an object that receives all the correct notifications to do the logging elsewhere. As to finding a spawns name by id, I'd suggest looking at the SpawnShell class (see the methods I listed above). One of my running projects is to migrate ShowEQ to a variant of the logging that SINS does (which would add back the spawn logging).
Enjoy,
Zaphod (dohpaZ)