Hello, I am writing a small text-based rpg. The issue I'm having is I instantiate a spell in the main function but in a different function in a different .cpp file that has the combat code it says the spell if undefined.
Here is the code snippets
First the spell header
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
//Spell.h
#ifndef SPELL_H
#define SPELL_H
#include <string>
#include "Range.h"
struct Spell
{
std::string mName;
Range mDamageRange;
int mMagicPointsRequired;
};
#endif
int main()
{
//Seed random number generator
srand(time(0));
//Instantiate a game map
Map gameMap;
//Instantiate the main player
Player mainPlayer;
//Go to create a class for main player
mainPlayer.createClass();
//Instantiate fireball spell
Spell fireBall;
fireBall.mName = "FireBall";
fireBall.mDamageRange.mLow = 5;
fireBall.mDamageRange.mHigh = 10;
fireBall.mMagicPointsRequired = 10;
and lastly the combat code where I'm getting the error