int random[7];
void randomize(char_data *ch)
{
for(x = 0 ; x<=6 ; x++)
ch->random[x] = get_random_room();
}
int get_random_room()
{
ROOM_WHATEVER_DATA *room;
for ( ; ; )
{
room = get_room_index( number_range( 1, MAX_VNUM ) );
if (room == NULL) continue;
break;
}
return room->vnum;
}
typedef struct ball BALL_DATA;
struct ball
{
int vnum;
};
struct dragon_data
{
DRAGON_DATA * next;
bool valid; /* new */
char * name;
int vnum;
int time;
BALL_DATA *location[MAX_BALL];
long flags;
};
DEDIT (dedit_location)
{
DRAGON_DATA *dragon;
char arg1[MIL];
char arg2[MIL];
int x, y;
EDIT_DRAGON (ch, dragon);
argument = one_argument(argument, arg1);
argument = one_argument(argument, arg2);
if (!IS_NULLSTR (argument) || !is_number (arg1)
|| !is_number (arg2))
{
sendch ("Syntax: location <#> <vnum>\n\r", ch);
return FALSE;
}
x = atoi(arg1);
y = atoi(arg2);
if (x < 0 || x >= MAX_BALL)
{
sendch ("Value must be 0 through 6\n\r", ch);
return FALSE;
}
dragon->location[x]->vnum = y;
sendch ("Dragon location set.\n\r", ch);
return TRUE;
}
x->location[i]->vnumwork. Dont want any other way but this, is it possible to make
location[i]a pointer which is in a dynamic structure, not a table so then I can point to ->vnum.
So if I want to I can do dragon->location[i] = or do dragon->location[i]->vnum =.All I need is a structure setup in merc.h that will make it work. I have 4 void functions, 2 load and save functions, 2 online editors and 2 do_functions all using this setup which is why I meant I have 3k lines of code in one file.
dedit create shenron
Dragon created.
Name: [shenron]
Time: [0]
Vnum: [0]
Location[0] [0] [0]
Location[1] [0] [0]
Location[2] [0] [0]
Location[3] [0] [0]
Location[4] [0] [0]
Location[5] [0] [0]
Location[6] [0] [0]
TICK!
Name: [shenron]
Time: [1251170370]
Vnum: [30]
Location[0] [3993] [1632]
Location[1] [3994] [1180]
Location[2] [3995] [1140]
Location[3] [3996] [1750]
Location[4] [3997] [1204]
Location[5] [3998] [968]
Location[6] [3999] [1786]
Something like this:
Of course it will be in a loop. My problem is im not sure how to set the pointer within merc.h in the actual data structure itself. Any ideas?
Edit - damn italic.