Ok so at a specific point in my game, the game just shuts down. I am not sure what the problem is so I am going to throw all the source code up. Any Help is appreciated.
#include <iostream>
#include <windows.h>
#include <fstream>
using namespace std;
string location = "Amasi Village";
string inventory1 = "Empty Slot";
string inventory2 = "Empty Slot";
string inventory3 = "Rmpty Slot";
string inventory4 = "Empty Slot";
string inventory5 = "Empty Slot";
string inventory6 = "Empty Slot";
int gold = 0;
string weapon = "Training Sword";
string helmet = "No Helmet";
string chest = "Bronze Chest Piece";
string legs = "Bronze Leggings";
string gloves = "Leather Gloves";
string boots = "Metal Boots";
string pet = "No Pet";
int abilitypower = 8;
int armor = 45;
int stamina = 55;
int health = 80;
int experience = 0;
int level = 1;
string name;
void NewCharacter();
void LoadCharacter();
void CharacterOptions();
void SaveGame();
void AmasiVillage();
void Koru();
void Reya();
void City();
void CollectQuests();
void ReturnQuests();
int main()
{
system ("TITLE Might and Power");
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " Sector 2 Entertainment";
Sleep(3000);
system("cls");
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " Presents";
Sleep(2000);
system("cls");
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " Might and Power";
Sleep(3000);
cout << "\n";
cout << "\n 1) New Character";
cout << "\n 2) Load Character";
cout << "\n 3) Exit Game";
cout << "\n";
cout << "\n Enter an Option: ";
int choice;
cin >> choice;
if (choice == 1)
NewCharacter();
if (choice == 2)
LoadCharacter();
;
}
void NewCharacter()
{
system("cls");
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " Hello there,";
Sleep(1000);
cout << " may I ask your name?";
cout << "\n";
cout << "\n Enter Name here: ";
cin.get();
getline (cin, name);
ofstream data ("Character Name.txt");
data << name;
data.close();
ofstream data1 ("Character Level.txt");
data1 << level;
data1.close();
ofstream data2 ("Character Experience.txt");
data2 << experience;
data2.close();
ofstream data3 ("Character Health.txt");
data3 << health;
data3.close();
ofstream data4 ("Character Stamina.txt");
data4 << stamina;
data4.close();
ofstream data5 ("Character Armor.txt");
data5 << armor;
data5.close();
ofstream data6 ("Character Ability Power.txt");
data6 << abilitypower;
data6.close();
ofstream data7 ("Character Pet.txt");
data7 << pet;
data7.close();
ofstream data8 ("Character Helmet.txt");
data8 << helmet;
data8.close();
ofstream data9 ("Character Chest Piece.txt");
data9 << chest;
data9.close();
ofstream data10 ("Character Leggings.txt");
data10 << legs;
data10.close();
ofstream data11 ("Character Gloves.txt");
data11 << gloves;
data11.close();
ofstream data12 ("Character Boots.txt");
data12 << boots;
data12.close();
ofstream data13 ("Character Weapon.txt");
data13 << weapon;
data13.close();
ofstream data14 ("Character Gold.txt");
data14 << gold;
data14.close();
ofstream data15 ("Character Inventory1.txt");
data15 << inventory1;
data15.close();
ofstream data16 ("Character Inventory2.txt");
data16 << inventory2;
data16.close();
ofstream data17 ("Character Inventory3.txt");
data17 << inventory3;
data17.close();
ofstream data18 ("Character Inventory4.txt");
data18 << inventory4;
data18.close();
ofstream data19 ("Character Inventory5.txt");
data19 << inventory5;
data19.close();
ofstream data20 ("Character Inventory6.txt");
data20 << inventory6;
data20.close();
ofstream data21 ("Character Location.txt");
data21 << location;
data21.close();
system("cls");
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " Welcome to Amasi Village ";
ifstream file("Character Name.txt");
getline(file, name);
cout << name;
Sleep(3000);
system("cls");
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " This village is a safe point between the two lands of Koru and Reya";
Sleep(3500);
system("cls");
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " You can travel to Koru and Reya from here\n or simply get a ride to the City";
Sleep(6000);
system("cls");
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " This is also where you can aquire and return quests";
Sleep(4000);
AmasiVillage();
}
void LoadCharacter()
{
ifstream data("Character Name.txt");
getline(data, name);
data.close();
ifstream data1 ("Character Level.txt");
data1 >> level;
data1.close();
ifstream data2 ("Character Experience.txt");
data2 >> experience;
data2.close();
ifstream data3 ("Character Health.txt");
data3 >> health;
data3.close();
ifstream data4 ("Character Stamina.txt");
data4 >> stamina;
data4.close();
ifstream data5 ("Character Armor.txt");
data5 >> armor;
data5.close();
ifstream data6 ("Character Ability Power.txt");
data6 >> abilitypower;
data6.close();
ifstream data7 ("Character Pet.txt");
data7 >> pet;
data7.close();
ifstream data8 ("Character Helmet.txt");
data8 >> helmet;
data8.close();
ifstream data9 ("Character Chest Piece.txt");
data9 >> chest;
data9.close();
ifstream data10 ("Character Leggings.txt");
data10 >> legs;
data10.close();
ifstream data11 ("Character Gloves.txt");
data11 >> gloves;
data11.close();
ifstream data12 ("Character Boots.txt");
data12 >> boots;
data12.close();
ifstream data13 ("Character Weapon.txt");
data13 >> weapon;
data13.close();
ifstream data14 ("Character Gold.txt");
data14 >> gold;
data14.close();
ifstream data15 ("Character Inventory1.txt");
data15 >> inventory1;
data15.close();
ifstream data16 ("Character Inventory2.txt");
data16 >> inventory2;
data16.close();
ifstream data17 ("Character Inventory3.txt");
data17 >> inventory3;
data17.close();
ifstream data18 ("Character Inventory4.txt");
data18 >> inventory4;
data18.close();
ifstream data19 ("Character Inventory5.txt");
data19 >> inventory5;
data19.close();
ifstream data20 ("Character Inventory6.txt");
data20 >> inventory6;
data20.close();
ifstream data21 ("Character Location.txt");
data21 >> location;
data21.close();
system("cls");
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " Welcome back ";
cout << name;
Sleep(2000);
if (location == "Amasi Village") RIGHT HERE IS WHERE IT SHUTS OFF!
AmasiVillage();
if (location == "Reya")
Reya();
}
void AmasiVillage()
{
location = "Amasi Village";
system("cls");
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " Amasi Village\n";
cout << "\n";
cout << " 1)Collect Quests\n";
cout << " 2)Return Quests\n";
cout << " 3)Walk to Koru\n";
cout << " 4)Walk to Reya\n";
cout << " 5)Maktor Ride to the City\n";
cout << " 6)Character Options\n";
cout << " 7)Save Game\n";
cout << " 8)Exit Game\n";
cout << "\n";
cout << " Enter an Option: ";
int choice;
cin >> choice;
if (choice == 6)
CharacterOptions();
if (choice == 7)
SaveGame();
AmasiVillage();
if (choice == 4)
Reya();
}
void Reya()
{
location = "Reya";
system("cls");
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " Reya\n";
cout << "\n";
cout << " 1)Walk to Amasi Village\n";
cout << " 2)Battle\n";
cout << " 3)Quest Options\n";
cout << " 4)Character Options\n";
cout << " 5)Save Game\n";
cout << " 6)Exit Game\n";
cout << "\n";
cout << " Enter an Option: ";
int choice;
cin >> choice;
if (choice == 5)
SaveGame();
Reya();
}
void SaveGame()
{
ofstream data ("Character Name.txt");
data << name;
data.close();
ofstream data1 ("Character Level.txt");
data1 << level;
data1.close();
ofstream data2 ("Character Experience.txt");
data2 << experience;
data2.close();
ofstream data3 ("Character Health.txt");
data3 << health;
data3.close();
ofstream data4 ("Character Stamina.txt");
data4 << stamina;
data4.close();
ofstream data5 ("Character Armor.txt");
data5 << armor;
data5.close();
ofstream data6 ("Character Ability Power.txt");
data6 << abilitypower;
data6.close();
ofstream data7 ("Character Pet.txt");
data7 << pet;
data7.close();
ofstream data8 ("Character Helmet.txt");
data8 << helmet;
data8.close();
ofstream data9 ("Character Chest Piece.txt");
data9 << chest;
data9.close();
ofstream data10 ("Character Leggings.txt");
data10 << legs;
data10.close();
ofstream data11 ("Character Gloves.txt");
data11 << gloves;
data11.close();
ofstream data12 ("Character Boots.txt");
data12 << boots;
data12.close();
ofstream data13 ("Character Weapon.txt");
data13 << weapon;
data13.close();
ofstream data14 ("Character Gold.txt");
data14 << gold;
data14.close();
ofstream data15 ("Character Inventory1.txt");
data15 << inventory1;
data15.close();
ofstream data16 ("Character Inventory2.txt");
data16 << inventory2;
data16.close();
ofstream data17 ("Character Inventory3.txt");
data17 << inventory3;
data17.close();
ofstream data18 ("Character Inventory4.txt");
data18 << inventory4;
data18.close();
ofstream data19 ("Character Inventory5.txt");
data19 << inventory5;
data19.close();
ofstream data20 ("Character Inventory6.txt");
data20 << inventory6;
data20.close();
cout << "\n";
cout << "\n";
cout << " Save Complete";
Sleep(1500);
}