Commit 9d1811c4 authored by a-j.towse's avatar a-j.towse

need to create pokedex of type pokedex

parent 56d543e5
...@@ -9,11 +9,9 @@ A-J Towse ...@@ -9,11 +9,9 @@ A-J Towse
*/ */
//Create struct Pokedex with a pointer to head of Pokemon and head of Player //Create struct Pokedex with a pointer to head of Pokemon and head of Player
//Create variable of type Pokedex called pokedex.
typedef struct Pokedex { typedef struct Pokedex {
struct Pokemon *Pokemonhead; struct PokemonNode * ptrToPokemonhead;
struct Player *Playerhead; struct PlayerNode * ptrToPlayerhead;
struct Pokedex *pokedex;
}Pokedex; }Pokedex;
//Create struct PokemonNode with name,type,ability variables //Create struct PokemonNode with name,type,ability variables
...@@ -38,9 +36,14 @@ typedef struct PlayerNode { ...@@ -38,9 +36,14 @@ typedef struct PlayerNode {
struct PokemonNode pokemonList[]; struct PokemonNode pokemonList[];
}PlayerNode; }PlayerNode;
PokemonNode *head = NULL; //Create head for DLL of pokemon
PlayerNode *head = NULL; //Create head for DLL of players
//NEED TO CREATE VARIABLE OF TYPE POKEDEX
//Define functions for PokemonNode struct //Define functions for PokemonNode struct
struct PokemonNode * NewPokemonNode(char name[], char type[], char ability[] ); struct PokemonNode * NewPokemonNode(char name[], char type[], char ability[] );
void AddPokemonToList(struct Pokedex *pokedex,char name, char type, char ability); void AddPokemonToList(struct Pokedex *pokedex,char name[], char type[], char ability[]);
struct PokemonNode * FindPokemon(struct Pokedex pokedex, char name); struct PokemonNode * FindPokemon(struct Pokedex pokedex, char name);
//Define functions for PlayerNode struct //Define functions for PlayerNode struct
...@@ -72,11 +75,25 @@ struct PokemonNode * NewPokemonNode(char name[], char type[], char ability[] ) { ...@@ -72,11 +75,25 @@ struct PokemonNode * NewPokemonNode(char name[], char type[], char ability[] ) {
return newNode; return newNode;
} }
//Create AddPokemonToList function - returns void
void AddPokemonToList(struct Pokedex *pokedex,char name[], char type[], char ability[]){
NewPokemonNode(name,type,ability);
}
int main (void) { int main (void) {
NewPokemonNode("Charmander","Fire","FireBallz");
//NewPokemonNode("Charmander","Fire","FireBallz");
AddPokemonToList(pokedex,"Charmander","Fire","FireBallz");
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment