Posts: 0
Threads: 0
Joined: Mar 2022
Reputation:
0
Level: inf []
Total Points: inf
Rank nan / 1
100% to upload Level
Activity inf / 1
99% to upload your Rank
Experience nan
100% to upload Experience
Points: 50
|
Recently I've been a bit burned out, and I can't seem to figure out this problem I have. It's for a game I had been working on for a side project when I'm bored. The code I'll be showing below is for an infection chance menu. It'll basically just shuffle the integers in the first vector, and then print them to the first if statement. When the integers are first printed it then pushes them into the second vector. It does this so the infection chance isn't selected until a week has passed (In game time). Which means it shouldn't push back new integers to that second vector until the boolean scavengeOpened, is equal to false.
I couldn't post the code in a code box because it destroys the formatting.
[ Redacted my code ]
Sorry if this is a little bit confusing but I couldn't find any help for this specific problem anywhere else.
|
Posts: 0
Threads: 0
Joined: May 2023
Reputation:
0
Level: inf []
Total Points: inf
Rank nan / 1
100% to upload Level
Activity inf / 1
99% to upload your Rank
Experience nan
100% to upload Experience
Points: 50
|
I need to bump this because I can't do anything until this is resolved.
|
Posts: 0
Threads: 0
Joined: Jun 2017
Reputation:
0
Level: inf []
Total Points: inf
Rank nan / 1
100% to upload Level
Activity inf / 1
99% to upload your Rank
Experience nan
100% to upload Experience
Points: 50
|
Sorry for the shit thread. I figured out my problem on my own, I just needed some sleep I guess.
|
Posts: 0
Threads: 0
Joined: Jan 2021
Reputation:
0
Level: inf []
Total Points: inf
Rank nan / 1
100% to upload Level
Activity inf / 1
99% to upload your Rank
Experience nan
100% to upload Experience
Points: 50
|
Quote:(07-17-2019, 05:30 PM)phyrrus9 Wrote: [To see links please register here] 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'll upload it again later. I ended up breaking the code again.
|
Posts: 0
Threads: 0
Joined: Feb 2020
Reputation:
0
Level: inf []
Total Points: inf
Rank nan / 1
100% to upload Level
Activity inf / 1
99% to upload your Rank
Experience nan
100% to upload Experience
Points: 50
|
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?
|
Posts: 0
Threads: 0
Joined: Jun 2021
Reputation:
0
Level: inf []
Total Points: inf
Rank nan / 1
100% to upload Level
Activity inf / 1
99% to upload your Rank
Experience nan
100% to upload Experience
Points: 50
|
Quote:(08-07-2019, 08:01 PM)phyrrus9 Wrote: [To see links please register here]
Quote: (08-07-2019, 07:59 PM)Drako Wrote: [To see links please register here]
Quote: (07-17-2019, 05:30 PM)phyrrus9 Wrote: [To see links please register here] 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.)
Hidden Content
You must [To see links please register here] or [To see links please register here] to view this content.
well that took forever :tongue:
out of curiosity, since you're going the inefficient route of using cout, why are you streaming in a newline character instead of just using endl?
I started doing that a while back when I read that endl was actually inefficient. What I read, and also heard from a lot of people was that it flushes and creates a newline. Which is unnecessary.
|
Posts: 0
Threads: 0
Joined: May 2021
Reputation:
0
Level: inf []
Total Points: inf
Rank nan / 1
100% to upload Level
Activity inf / 1
99% to upload your Rank
Experience nan
100% to upload Experience
Points: 50
|
Quote:(08-07-2019, 07:59 PM)Drako Wrote: [To see links please register here]
Quote: (07-17-2019, 05:30 PM)phyrrus9 Wrote: [To see links please register here] 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.)
Hidden Content
You must [To see links please register here] or [To see links please register here] to view this content.
well that took forever :tongue:
out of curiosity, since you're going the inefficient route of using cout, why are you streaming in a newline character instead of just using endl?
|
Posts: 0
Threads: 0
Joined: Feb 2021
Reputation:
0
Level: inf []
Total Points: inf
Rank nan / 1
100% to upload Level
Activity inf / 1
99% to upload your Rank
Experience nan
100% to upload Experience
Points: 50
|
Quote:(07-17-2019, 05:30 PM)phyrrus9 Wrote: [To see links please register here] 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.)
Hidden Content
You must [To see links please register here] or [To see links please register here] to view this content.
|
Posts: 0
Threads: 0
Joined: Jun 2016
Reputation:
0
Level: inf []
Total Points: inf
Rank nan / 1
100% to upload Level
Activity inf / 1
99% to upload your Rank
Experience nan
100% to upload Experience
Points: 50
|
Quote:(08-07-2019, 08:02 PM)Drako Wrote: [To see links please register here]
Quote: (08-07-2019, 08:01 PM)phyrrus9 Wrote: [To see links please register here]
Quote: (08-07-2019, 07:59 PM)Drako Wrote: [To see links please register here] 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.)
Hidden Content
You must [To see links please register here] or [To see links please register here] to view this content.
well that took forever :tongue:
out of curiosity, since you're going the inefficient route of using cout, why are you streaming in a newline character instead of just using endl?
I started doing that a while back when I read that endl was actually inefficient. What I read, and also heard from a lot of people was that it flushes and creates a newline. Which is unnecessary.
You'd be correct on it being inefficient, but the entirety of cout is that way. As for flushing the stream though, that's what std::flush is for.
|
Posts: 0
Threads: 0
Joined: Sep 2020
Reputation:
0
Level: inf []
Total Points: inf
Rank nan / 1
100% to upload Level
Activity inf / 1
99% to upload your Rank
Experience nan
100% to upload Experience
Points: 50
|
Quote:(08-08-2019, 04:02 AM)phyrrus9 Wrote: [To see links please register here]
Quote: (08-07-2019, 08:02 PM)Drako Wrote: [To see links please register here]
Quote: (08-07-2019, 08:01 PM)phyrrus9 Wrote: [To see links please register here] well that took forever :tongue:
out of curiosity, since you're going the inefficient route of using cout, why are you streaming in a newline character instead of just using endl?
I started doing that a while back when I read that endl was actually inefficient. What I read, and also heard from a lot of people was that it flushes and creates a newline. Which is unnecessary.
You'd be correct on it being inefficient, but the entirety of cout is that way. As for flushing the stream though, that's what std::flush is for.
I had already built the entire program with cout so I didn't want to try and use printf. Printf is a lot faster. As for my problem, any solutions?
|
|