Jump to content
XCOMUFO & Xenocide

Cleaning Up The Xnetloader


SupSuper

Recommended Posts

decided to take this to a new topic.

 

anyways, i've been taking a look at the xnetloader code and... quite frankly, i can't make heads or tails out of it. anyone care to explain it to me?

the assetmanager code looks simpler, as far as i can tell it's for loading the proper models for the x-net entries from the XML files and creating them in Ogre.

 

also, rincewind, what do you have in mind for the data structure? should it just contain x-net entries, names and categories?

Edited by SupSuper
Link to comment
Share on other sites

decided to take this to a new topic.

 

anyways, i've been taking a look at the xnetloader code and... quite frankly, i can't make heads or tails out of it. anyone care to explain it to me?

the assetmanager code looks simpler, as far as i can tell it's for loading the proper models for the x-net entries from the XML files and creating them in Ogre.

 

also, rincewind, what do you have in mind for the data structure? should it just contain x-net entries, names and categories?

 

Ok, here we go:

from the point of view of an external interface of the XNetloader, what we need is the ability to get a list of the categories (that is their names).

A list of the XNet-Entries on a per category-basis and the ability to get an XNet-entry using its symbolic name (e.g. XNET_PLASMA_CANNON).

An XNet entry itself should contain its name, a link to it's category (probably a pointer to the category object) the short description, the text-body and the fluff text.

 

Internally, I would keep a Hashmap of SharedPointers to the XNet-Entries with their symbolic name as key and return a const copy of the sharedptr once an entry is requested.

Also, you should probably keep list's for each category that contain sharedPtr's to the XNetEntries. You can then just return those lists on request (making them const, too of course).

 

So on startup, you would fill the data structures and after that just return pointers to the entries. So each entry should only exit once and you just give out pointers to it.

 

Hope I made sense so far, for reading the XML, just look at how the assetmapper does it or ask here if you need help.

 

Greetings,

 

Rincewind

Link to comment
Share on other sites

×
×
  • Create New...