I am doing a simple RPG game, but everytime I compile it it gives me this strange error:
RPG fatal error LNK1201: error writing to program database 'c:\Carlos Documents and Settings\Carlos Documents\Visual Studio Projects\RPG\Debug\RPG.pdb'; check for insufficient disk space, invalid path, or insufficient privilege
I have about 1 GB of free space in my hard disk, it is the right path, but I dont know what it means by insufficient privilage...
Anyways, here is my code:
Code:
#include <ctime>
#include <iostream>
#include <conio.h>
using namespace std;
struct ENTITY
{
int HP;
int DEF;
int ATTCK;
int SPEED;
int EXP;
};
int PlayerLVL = 1;
int MonsterLVL = 1;
ENTITY Player;
ENTITY Monster;
void DisplayStats(ENTITY Player, ENTITY Monster, int PlayerLVL, int MonsterLVL); // to check variables are set right
void PlayerR(ENTITY &Player, int PlayerLVL);
void MonsterR(ENTITY &Monster, int MonsterLVL);
int RollDice(int DiceSides);
void Battle(ENTITY &Player, ENTITY &Monster, int PlayerLVL, int MonsterLVL);
int main()
{
float round = 0;
char Option = ' ';
Player.EXP = 0;
Monster.EXP = 0;
while (1)
{
PlayerR(Player, PlayerLVL);
MonsterR(Monster, MonsterLVL);
Battle(Player, Monster, PlayerLVL, MonsterLVL);
cout << "Press \"q\" to quit. Any other key to continue." << endl;
Option = getch();
if (Option == 'q' || Option == 'Q')
break;
if (Player.EXP > (20 * round/3))
{
PlayerLVL++;
Player.EXP = 0;
cout << "You grew a level! You are now at level " << PlayerLVL << "!" << endl;
getch();
}
round++;
}
return 0;
}
void DisplayStats(ENTITY Player, ENTITY Monster, int PlayerLVL, int MonsterLVL)
{
cout << "Player: " << PlayerLVL << endl;
cout << "HP: " << Player.HP << endl;
cout << "DEF: " << Player.DEF << endl;
cout << "ATTCK: " << Player.ATTCK << endl;
cout << "SPEED: " << Player.SPEED << endl;
cout << endl;
cout << "Monster: " << MonsterLVL << endl;
cout << "HP: " << Monster.HP << endl;
cout << "DEF: " << Monster.DEF << endl;
cout << "ATTCK: " << Monster.ATTCK << endl;
cout << "SPEED: " << Monster.SPEED << endl;
cout << endl;
}
void PlayerR(ENTITY &Player, int PlayerLVL)
{
Player.HP = 20 * PlayerLVL;
Player.DEF = 3 * PlayerLVL;
Player.ATTCK = 5 * PlayerLVL;
Player.SPEED = 5 * PlayerLVL;
}
void MonsterR(ENTITY &Monster, int MonsterLVL)
{
Monster.HP = 25 * MonsterLVL;
Monster.DEF = 1 * MonsterLVL;
Monster.ATTCK = 5 * MonsterLVL;
Monster.SPEED = 6 * MonsterLVL;
}
int RollDice(int DiceSides)
{
srand((unsigned) time(NULL));
int Roll = rand() % (DiceSides + 1);
return Roll;
}
void Battle(ENTITY &Player, ENTITY &Monster, int PlayerLVL, int MonsterLVL)
{
bool PFirst = true;
int Roll1 = 0;
int Roll2 = 0;
Roll1 = RollDice(10);
Roll2 = RollDice(10);
if ((Player.SPEED + Roll1) > (Monster.SPEED + Roll2))
PFirst = true;
else
PFirst = false;
do
{
if (PFirst)
{
system("cls");
DisplayStats(Player, Monster, PlayerLVL, MonsterLVL);
cout << "You have attacked the monster!" << endl;
Monster.HP -= (Player.ATTCK - Monster.DEF);
PFirst = false;
getch();
}
else
{
system("cls");
DisplayStats(Player, Monster, PlayerLVL, MonsterLVL);
cout << "You have been attacked by the monster!" << endl;
Player.HP -= (Monster.ATTCK - Player.DEF);
PFirst = true;
getch();
}
} while (Player.HP > 0 && Monster.HP > 0);
if (Player.HP > 0)
{
cout << "You killed the monster!" << endl;
Player.EXP += 10 * MonsterLVL;
}
else
cout << "The battle is over... " << endl;
}
Thanks in advance.