Hi,
I am working on a "daily lottery" system and wanted people to be
able to buy more than one ticket. (So I opted not to use the pfiles)
Right now Im saving the data in a file in this
format...(playerlottery.txt)
2
Thalor~
1 1 1 <--- for testing purposes I have the lotto always
generate 1 1 1 for now.
Grok~
9 6 7
(maxlottery)
(Name)~
(slot1) (slot2) (slot3)
(Name)~
(slot1) (slot2) (slot3)
I can load, save and add new ones to this file using a structure:
struct lottery_type
{
char * name;
int slot1;
int slot2;
int slot3;
};
The problem comes when I generate the lottery, somewhere in between the
loading of the lottery tickets and the comparison the array goes all
hooey....what am I doing wrong?
void do_generate(CHAR_DATA *ch)
{
int num1, num2, num3;
int pnum1, pnum2, pnum3;
int i;
LOTTERY_DATA *lottery;
num1 = dice(1,1);
num2 = dice(1,1); //Testing all will be 0,9
num3 = dice(1,1);
for (i=0;i<maxLottery;i++)
{
pnum1 = lottery[i].slot1;
pnum2 = lottery[i].slot2;
pnum3 = lottery[i].slot3;
if (pnum1 == num1 && pnum2 == num2 && pnum3 == num3)
{
info (ch,0,"We have a winner!\n\r");
}
}
}
Using GDB I look at pnum1 pnum2 and pnum3 and they turn into something
like 824193073
Any help would be ...well...helpful!
Thanks!
-K