Multi-structs?
Displaying 1-8 of 8 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Overkill

Will it be possible to have a struct inside a struct at some time?

ex. ally[].magic[].name

Code:

struct magic_t
{
string name;
string desc;
int has;
//-- Other magic stuff here--
}

struct char_t
{
int hp, mp;
//-- Other status crap here --
magic_t magic;
}

char_t ally;


---------------

So, comments? Would other people find this useful as well?

Posted on 2004-03-27 00:05:51 (last edited on 2004-03-27 00:14:31)

mcgrue

Yes, it would be useful.

No, it won't be in in any immediatly pending v3 releases.

As for more details than that, I'm sure someone higher up on the engine chain will answer you shortly.

Posted on 2004-03-27 00:34:14

KilloZapit

You could do what I do and use fake pointers....

Posted on 2004-03-27 00:37:30

mcgrue

That's one of two methods I use in the Sully system, actually.

I make master arrays of various structs, and reference them in other structs via their indices. -1 becomes the "unset value" in this system for me.

The other method I use is just making a comma-seperated string of values. I only use this method for faking dynamically sized lists of ints and strings, and only in places infrequently accessed. v3's Token functions make it pretty easy to access things with a light wrapper function, tho.

Posted on 2004-03-27 00:40:39

KilloZapit

The only real problem is that using int indices makes it hard to see at a glance what it is indexing...

On the subject, can the VC compiler do arbitrary string preprocessing? It would be nice if I could tell it to replace all instances of "self." with "objs[self]." for instance. You know, just to save me having to type the extra six characters. :P

Posted on 2004-03-27 00:47:45

mcgrue

#define self objs[self]

?

I also used DEFINES in the case of int indexes just to make it feel like I'm actually using types.

#define ITEM int

ITEM getItemByName( string s ) {...}
void giveItem( ITEM i ) {...}

etc.

Posted on 2004-03-27 02:23:17

KilloZapit

I didn't think #define worked like that. Neat!

Posted on 2004-03-27 07:08:01

mcgrue

To the best of my knowledge, #DEFINE is just a global seek-replace that occurs before actual compiling.

Posted on 2004-03-27 08:15:10


Displaying 1-8 of 8 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.