I'm doing a simplified Pokémon-style game, but it's stopped responding when I call InitializePokemon a second time, I'm not finding the problem because it works normally with the first one and it locks in the second.
Theprintofthevaluesisjusttotestifeverythingisbeingpassedcorrectly.
Codesnippets:
Main:
intmain(intargc,char**argv){TipoMoveflamethrower;TipoMovefire_blast;TipoMovefly;TipoMoveearthquake;TipoMovequick_attack;TipoMovethunderbolt;TipoMovethunder;TipoMoveskull_bash;InicializaMove(&flamethrower,"Flamethrower", 1, 'e', 95);
InicializaMove(&fire_blast, "Fire Blast", 2, 'e', 120);
InicializaMove(&fly, "Fly", 3, 'f', 70);
InicializaMove(&earthquake, "Earthquake", 4, 'f', 100);
InicializaMove(&quick_attack, "Quick Attack", 5, 'f', 40);
InicializaMove(&thunderbolt, "Thunderbolt", 6, 'e', 95);
InicializaMove(&thunder, "Thunder", 7, 'e', 120);
InicializaMove(&skull_bash, "Skull Bash", 8, 'f', 100);
TipoPokemon charizard;
TipoPokemon pikachu;
InicializaPokemon(&charizard, 2, "Charizard", 293, 280, 360, 328, 348, 295, flamethrower, fire_blast, fly, earthquake);
ImprimePokemon(&charizard);
InicializaPokemon(&pikachu, 1, "pikachu", 229, 196, 274, 306, 218, 218, quick_attack, thunderbolt, thunder, skull_bash);
ImprimePokemon(&pikachu);
return 0;
}
InitializesPokemon:
void InicializaPokemon(TipoPokemon *poke, int id, string nome, float ataque, float defesa, float vida, float velocidade, float spAtk, float spDef, TipoMove mov0, TipoMove mov1, TipoMove mov2, TipoMove mov3){
poke->id = id;
poke->nome = nome;
poke->atk = ataque;
poke->def = defesa;
poke->hp = vida;
poke->speed = velocidade;
poke->sp_atk = spAtk;
poke->sp_def = spDef;
poke->moves[0]= mov0;
poke->moves[1] = mov1;
poke->moves[2] = mov2;
poke->moves[3] = mov3;
}
InitializeMove:
void InicializaMove(TipoMove *mov, string n, int id, char t, float pw){
mov->nome = n;
mov->id = id;
mov->tipo = t;
mov->power = pw;
cout << "move " << mov->nome << " inicializado " << endl;
}