Hey, I'm having a problem with the following code:
//Include DarkGDK :)
#include "DarkGDK.h"
//Structs
struct _Ability
{
//Assign the ability callback function
int(*Ability_CallBack)(int ID, int Ability_Level);
int cost_MP, cost_HP, cost_CD, ID, Ability_Level;
int Pull(int ID)
{
return Ability_CallBack(ID, Ability_Level);
}
};
struct _Character
{
int HP_Base, MP_Base, HP_pl, MP_pl;
_Ability Ability1, Ability2, Ability3, Ability4;
int ModelID;
};
struct _Player
{
int HP_Bonus, MP_Bonus, HP_Curr, MP_Curr;
int x, y, TeamID;
_Character &Character;
};
//Globals
/*Characters*/
_Character* Steph = new _Character;
/*Players*/
_Player* Player1;
//Function Prototypes
/*World*/
void MakeWorld();
/*Abilities*/
int Abilities(int ID, int Ability_Level);
/*Net*/
int Connect();
int UpdatePlayers();
int GetServerMessages();
/*Make Chars*/
void MakeCharacters()
{
dbMakeObjectSphere(1, 5, 4, 4);
Steph->HP_Base = 400;
Steph->MP_Base = 250;
Steph->HP_pl = 75;
Steph->MP_pl = 50;
Steph->ModelID = 1;
Steph->Ability1.ID = 1;
Steph->Ability2.ID = 2;
Steph->Ability3.ID = 3;
Steph->Ability3.ID = 4;
Steph->Ability1.cost_CD = 10;
Steph->Ability2.cost_CD = 20;
Steph->Ability3.cost_CD = 30;
Steph->Ability4.cost_CD = 40;
Steph->Ability1.cost_HP = 0;
Steph->Ability2.cost_HP = 0;
Steph->Ability3.cost_HP = 0;
Steph->Ability4.cost_HP = 0;
Steph->Ability1.cost_MP = 10;
Steph->Ability2.cost_MP = 20;
Steph->Ability3.cost_MP = 30;
Steph->Ability4.cost_MP = 40;
Steph->Ability1.Ability_Level = 1;
Steph->Ability2.Ability_Level = 2;
Steph->Ability3.Ability_Level = 3;
Steph->Ability4.Ability_Level = 4;
Steph->Ability1.Ability_CallBack = &Abilities;
Steph->Ability2.Ability_CallBack = &Abilities;
Steph->Ability3.Ability_CallBack = &Abilities;
Steph->Ability4.Ability_CallBack = &Abilities;
}
//Entry point
void DarkGDK(void)
{
Player1->Character=*Steph;
Player1->TeamID = 1;
dbPrint(dbStr(Player1->Character.Ability1.Ability_Level));
dbWaitKey();
}
int Abilities(int ID, int Ability_Level)
{
dbPrint(dbStr(ID));
dbPrint(dbStr(Ability_Level));
return 0;
}
It compiles fine but I get an unhandled exception error whenever I run the exe (debug or release) without giving me any useful information back. The problem seems to be this line:
Quote: "Player1->Character=*Steph;"
I honestly have no idea what I'm doing wrong as it compiles 100% fine.
I'm using visual studio 8 (2005) and the commercial version of darkGDK.
thanks in advance for any replies.
BASIC programmers never die, they GOSUB and don't RETURN.