(warning: manually formatted because of wonky forum formatting problems)
Got a couple more questions:
Arrays: can I use {-notation for 2D arrays?. Example:
int nums[2][5];
nums[0] = { 0,1,2,3,4 };
nums[1] = { 5,6,7,8,9 };
EDIT: are generic 2d arrays even available? Meaning:
nums[n][n] = 1;
I'm having trouble assigning a value to an element that way. I suppose I can fake it with a struct... and that might even work better for what I'm doing, but being able to dive through a 2D array with a for-loop is... err... valuable.
Next...
Are there any issues with setting variables for a struct defined in a different file? Let me explain:
I have a file, skills.vc, that is included from system.vc. In skills.vc I am defining a struct of type "skill", and I define it with a handful of variables. Nothing fancy at all. However, from "skills.vc" I include a file called "backstab.vc", which contains
only the following:
skill backstab;
backstab.cost = 10;
backstab.class = 1; // 1=rogue
backstab.first_att = 5; // how many rounds reset?
backstab.second_att = main_char.to_hit / 2; // chance to-hit
backstab.third_att = main_char.level * 10 / 2; // how much damage bonus?
backstab.name = "backstab";
backstab.cap_name = "Backstab";
backstab.action_text = "backstabs";
Again, nothing fancy... and since I moved the "#include" line in skills.vc beyond
the structure's definition (lower down in the actual file) it seems to get to the code in
backstab.vc, but it halts at line 3 (according to vcc), saying "expecting a variable for function definition..."
Got any thoughts? It's almost like it doesn't want me to touch the variables in the struct.
For reference... here's the contents of skills.vc:
#define NUM_SKILLS 3
struct skill
{
int cost; // to use
int class;
int first_att; // \
int second_att; // | store data in atts
int third_att; // /
string name; // "backstab"
string cap_name; // "Backstab"
string action_text; // "backstabs"
};
#include "backstab.vc" // moved after skill-template struct def
// to eliminate errors because these
// includes use the struct
I'm wondering if it's just sloppy code... like am I over looking something?? ...or am I
breaking some rule of structs, variable scope, or includes?
Thanks for your help.
-lok