RE: I Need Help With This Vector Problem 08-07-2019, 07:59 PM
#6
(07-17-2019, 05:30 PM)phyrrus9 Wrote: I realize I'm a bit late to the party here. Happy that you figured it out, but were you planning on posting your solution and thought process?
I forgot about this entire thread so I'm sorry for the late response. I'll try and explain what the code is supposed to do, and what the issue is as best as I can.
This code is for a function in my game where a player can scavenge for items in certain locations. And these locations have infection chances. There is also a function that moves the game into a new week (in game week). Once a new week has occurred, I want the infection chances to change. And in my original solution, it doesn't work.
(I modified the code a bit from my original solution so you could understand it better. If you want me to explain my original solution just ask.)
Code:
std::vector<int> infectChance = {5, 10, 15, 20, 25, 30, 35, 40, 45}; //List of possible infection chances
std::cout << " 1 > Kin | Location Size: Large | Infection Chance: " << infectChance[0] << "%" << '\n' //Prints everything
<< " Location Description - Kin is the largest location in the region, you'll" << '\n'
<< " probably find lots of loot, but just as many bad guys.\n" << '\n'
<< " 2 > Military Outpost | Location Size: Large | Infection Chance: " << infectChance[1] << "%" << '\n'
<< " Location Description - The government let us down. So does that mean" << '\n'
<< " you can take their stuff now? Hell yes!\n" << '\n'
<< " 3 > Vernal | Location Size: Medium | Infection Chance: " << infectChance[2] << "%" << '\n'
<< " Location Description - A pretty under-developed, rundown town." << '\n'
<< " It's still got stuff though. Maybe.\n" << '\n'
<< " 4 > Mason | Location Size: Medium | Infection Chance: " << infectChance[3] << "%" << '\n'
<< " Location Description - A better more developed Vernal. Go check it" << '\n'
<< " out.\n" << '\n'
<< " 5 > Mavren | Location Size: Small | Infection Chance: " << infectChance[4] << "%" << '\n'
<< " Location Description - OK, lets just make this short and sweet. it's" << '\n'
<< " trailer park. Don't expect a thing.\n" << '\n'
<< " 6 > Return To Bunker\n" << '\n';