Multi dim struct arrays
Displaying 1-20 of 22 total.
12
next
gannon
|
are multi dim struct arrays supported in Verge? I tried making one but it seemed to not like that
here is what I did
DWES_usable dwes_useables[DWES_TOTAL_USABLE_GROUPS][DWES_TOTAL_USABLES_IN_GROUP];
Posted on 2004-05-18 00:54:48
|
Overkill
|
You have to have second dimension inside the struct for it to work, which I know is painful. You're allow multi-dimensions declared in your struct.
struct DWES_usable
{
string name[DWES_TOTAL_USABLES_IN_GROUP];
string desc[DWES_TOTAL_USABLES_IN_GROUP];
string effect_func[DWES_TOTAL_USABLES_IN_GROUP];
};
DWES_usable dwes_usables[DWES_TOTAL_USABLE_GROUPS];
//----
Posted on 2004-05-18 02:15:21
|
RageCage
|
or you could work around that by
int DWES_name[99][99];
int DWES_desc[99][99];
int DWES_effect[99][99];
or whatever.
Posted on 2004-05-18 02:19:00
|
mcgrue
|
Quote:Originally posted by gannon
are multi dim struct arrays supported in Verge? I tried making one but it seemed to not like that
here is what I did
DWES_usable dwes_useables[DWES_TOTAL_USABLE_GROUPS][DWES_TOTAL_USABLES_IN_GROUP];
What you did is permissible. What overkill suggested is not. What is the error message you're choking on?
Posted on 2004-05-18 02:30:36
|
gannon
|
dwes_main.vc(343): Expecting ";" ,but got a "[" instead
When I comment out that array it compiles fine.
(btw, the struct is a bit too complex for overkills suggestion)
Posted on 2004-05-18 02:45:11 (last edited on 2004-05-18 02:46:58)
|
RageCage
|
no, I'm pretty sure overkill is right. And its true, you can't declaire multi-dimentional arrays with struct defined identifiers
hail the fancy lingo!
Posted on 2004-05-18 02:47:02 (last edited on 2004-05-18 23:24:44)
|
Overkill
|
Quote:Originally posted by mcgrue
What you did is permissible. What overkill suggested is not.
What I suggested was merely a workaround that would compile. Not the ideal solution, just a working solution, until the dev team adds the support.
Posted on 2004-05-18 21:09:44
|
mcgrue
|
Quote:Originally posted by overkill
What I suggested was merely a workaround that would compile. Not the ideal solution, just a working solution, until the dev team adds the support.
Are you sure that compiles? Last I checked, you could not put arrays inside structs... although I haven't tried in quite some time.
Posted on 2004-05-18 21:26:55
|
rpgking
|
Arrays inside structs work perfectly. I just tested it.
Posted on 2004-05-18 21:52:55 (last edited on 2004-05-18 22:02:09)
|
vecna
|
Yep you can have arrays inside structs. Just not multidimensional ones. Don't ask me, I just work here.
Posted on 2004-05-18 22:12:12
|
gannon
|
odd I have them and the compiler didn't complain will there be a problem?
Posted on 2004-05-18 23:03:33
|
mcgrue
|
Quote:Originally posted by vecna
Yep you can have arrays inside structs. Just not multidimensional ones. Don't ask me, I just work here.
Ah, crap.
Well, time to recode some of Sully. I was convinced that was impossible, so I did a few instances of:
character.slot1
character.slot2
character.slot3
character.slot4
...
...but first I'll contninue finishing off this blasted docs section. So gaffes like this will be eliminated.
Posted on 2004-05-19 00:43:59
|
RageCage
|
it never ends =p
Posted on 2004-05-19 01:08:54 (last edited on 2004-05-19 01:09:08)
|
Overkill
|
Multi-dimensional arrays work fine for me inside structs. Just you can't have multi-dimensional arrays OF structs.
struct enm_t
{
int ai[TOTAL_ENTITIES];
int x0[TOTAL_ENTITIES], y0[TOTAL_ENTITIES];
int x100[TOTAL_ENTITIES], y100[TOTAL_ENTITIES];
int xspeed[TOTAL_ENTITIES], yspeed[TOTAL_ENTITIES];
int var[10][TOTAL_ENTITIES];
int dir[TOTAL_ENTITIES], pause[TOTAL_ENTITIES];
int hide[TOTAL_ENTITIES];
int dmg[TOTAL_ENTITIES];
};
enm_t enemy;
EDIT: Realized I bolded the wrong line. :(
Posted on 2004-05-19 02:49:04 (last edited on 2004-05-19 02:50:20)
|
vecna
|
apparently I'm smarter than I remember, then! But yeah that makes sense. I had originally thought that I HAD allowed multi-dim arrays.. then grue asked me about it, and I looked at the code and thought it was only setup for one-dimensional arrays, but you're right, that only applies to the struct array. It allocates the first dimension for the struct and the rest are applied to the variable.
Posted on 2004-05-19 13:02:10
|
Sungam
|
So... are there any plans to allow multi-dimensional arrays of structs in the future?
Posted on 2004-09-27 16:28:09
|
vecna
|
It's possible, but practically speaking, it won't happen for a while. I'm planning to release a netcode build tonight, then after that my next task is going to be adding floats, which will be a sizeable endeavor, and after that I still have a number of things I'd like to add before I do things like multidim struct arrays, since it's such an easy thing to get around.
So basically it'll probably eventually be added, but its not going to be soon so I wouldn't plan on it or wait for it or anything.
Posted on 2004-09-27 18:11:15
|
basil
|
If floats are coming I'll be very, very happy
Posted on 2004-09-27 20:26:27
|
ThinIce
|
Floats + netcode = gasmic!
Posted on 2004-09-27 22:32:35
|
Overkill
|
Whoa, if there is going to netcode, first dibs on making v3IRC!
Posted on 2004-09-28 02:53:13
|