Hey all,
I am running into a minor problem, and would like to know the most
elegant way to sidestep it. Currently, circle accepts a new socket,
throws it into the input and output FD sets, and loads the character off
file, attaching it to ->character pointer off the descriptor.
Well, in C++, with class inheritance, making a instance pointer for
each (character) class in the descriptor is a waste of space, and the
typeid() call would only be useful if thrown into a large switch, which is
rather silly.
(new connection) pointer (player classes)
Descriptor /---------> Player
| / |
Player *pl->character -/ -------------------------------
| |
Mage Warrior
The way that this is done now, since there is just one char_data struct,
is pretty straitforward. However, I would like to be able to pull run time
info
on the character read from file, and create an instance of the actual class
it belongs to. I need not only to access the class functions (which
currently
I can get around with virtual keywording), but would like to be able to
access class-dependant data types
(new connection) (player classes)
Descriptor Player
| |
Mage *pl->character -------------------------------
\ | |
\------> Mage Warrior
Except, i need the mage pointer to be created based on the typeid()
of the class size read from a binary player file.
Anyone have an elegant way of doing this?
Franco Gasperino
Cutting Edge Communications
509-444-INET
awe@cet.com
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST