Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 483 Vote(s) - 3.52 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I Need Help With This Vector Problem

#1
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.
Reply

#2
I need to bump this because I can't do anything until this is resolved.
Reply

#3
Sorry for the shit thread. I figured out my problem on my own, I just needed some sleep I guess.
Reply

#4
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.
Reply

#5
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?
Reply

#6
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.
Reply

#7
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?
Reply

#8
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.

Reply

#9
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.
Reply

#10
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?
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through