1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
void createPlayers(vector<player>& players, int numOfPlayers)
{
int p_ID = 0;
int curr_HP = 0, max_HP = 0, surge_value = 0, surges_left = 0;
int ac = 0, fort = 0, ref = 0, will = 0;
int init_bonus = 0;
string name, temp;
for(int i = 0;i < numOfPlayers;i++)
{
p_ID = i; // Player's ID number.
// Get the player's name.
cout << endl;
cout << "Enter player #" << (i + 1) << "\'s Name: ";
getline(cin, name);
cout << endl;
// Get the player's health information.
temp = "Enter " + name + "\s Current HP: ";
curr_HP = grab<int>(temp.c_str());
temp = "Enter " + name + "\'s Max HP: ";
max_HP = grab<int>(temp.c_str());
temp = "Enter " + name + "\'s Surge Value: ";
surge_value = grab<int>(temp.c_str());
temp = "Enter " + name + "\'s Surges Left: ";
surges_left = grab<int>(temp.c_str());
cout << endl;
// Get the player's defense information.
temp = "Enter " + name + "\'s AC: ";
ac = grab<int>(temp.c_str());
temp = "Enter " + name + "\'s Fortitude: ";
fort = grab<int>(temp.c_str());
temp = "Enter " + name + "\'s Reflex: ";
ref = grab<int>(temp.c_str());
temp = "Enter " + name + "\'s Will: ";
will = grab<int>(temp.c_str());
cout << endl;
// Get the player's initiative bonus.
temp = "Enter " + name + "\'s Initiative Bonus: ";
init_bonus = grab<int>(temp.c_str());
cout << endl;
players.push_back(player(p_ID, name, curr_HP, max_HP, surge_value, surges_left, ac, fort, ref, will, init_bonus));
cin.clear();
cout.flush();
}
}
|