Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7719483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:25:39+00:00 2026-06-01T03:25:39+00:00

Maybe seeing the issue would help you all a little: https://ws.onehub.com/files/nzvrbj4s Screen Shots: https://ws.onehub.com/files/9rw3li12

  • 0

Maybe seeing the issue would help you all a little:

https://ws.onehub.com/files/nzvrbj4s

Screen Shots:
https://ws.onehub.com/files/9rw3li12
https://ws.onehub.com/files/37ggbfio

This is the demo exe file.

WASD to move the player around
mouse to aim
mouse left click to fire
R to Reload
M to Create a monster (I have one spawn point in the game that spits out 5 monsters 3 alive at a time max on the spawn point)

I am loading monster data in from a file which contains the following:


Spider_Walk/

12

Spider_Attack/

1

Spider_Die/

9

3

17 32 5  2

28 32 8  1

48 32 15 1

I check the file every time I spawn a spider for the data of the hit zones and file paths for the animations. I do not reload the animations every time due to the resource manager class which prevents multiple animations from being double loaded. Currently I can spawn many many monsters, but then out of the blue ifstream sets the fail bit on me and I crash. I am trying to understand why my fail bit is being set.

My output is:


(1)LOAD FILE IS BAD! FLAGS SET

EOF: 0
BAD: 0
FAIL: 1
FILENAME.c_str(): gfx/Spider/Spider.txt

Any advice would be helpful at the moment I am thinking about making a monster info class and putting it in with the resource manager to only load monster data one time. I just fear this failure is the tip of the iceberg and something much bigger is lurking.

Smallest code chunk that would probably eventually reproduce the issue.

ifstream load_file;

load_file.open(filename.c_str());

if(!load_file.good())allegro_message("(1) LOAD FILE IS BAD! FLAGS SET\n EOF: %i \n BAD: %i \n FAIL: %i \n FILENAME.c_str(): %s", load_file.eof(), load_file.bad(), load_file.fail(), filename.c_str());

FULL CONSTRUCTOR CODE FOLLOWS:


Monster::Monster(string filename,Resource_Manager *nrm)

{

    rm = nrm;
    //Class initalizations
    Draw_Hit_Zones = true;
    Draw_Health_Bar = true;
    last_zone_hit = -1;
    Dieing = false;
    Time_Of_Death = 0;

    cur_state = 0;
    MAGIC = NULL;
    delay = 100;
    cur_frame = 0;
    dr = 0;
    r = 0;
    Move_Speed = 10;
    timer = clock();

    Max_Hit_Points = 50;
    Cur_Hit_Points = Max_Hit_Points;
    //end class initalizations

    stringstream ss;
    string root_path = filename.substr(0,filename.find_last_of("/\\")+1);     // /gfx/Spider/

    string load_image_path;
    string load_mask_path;

    string temp;

    ifstream load_file;
    load_file.open(filename.c_str());
    if(!load_file.good())allegro_message("(1) LOAD FILE IS BAD! FLAGS SET\n EOF: %i \n BAD: %i \n FAIL: %i \n FILENAME.c_str(): %s", load_file.eof(),load_file.bad(),load_file.fail(),filename.c_str());
    load_file>>temp>>W_num_frames;
    W_ANI.assign(root_path);
    W_ANI.append(temp);

    load_file>>temp>>A_num_frames;
    A_ANI.assign(root_path);
    A_ANI.append(temp);

    load_file>>temp>>D_num_frames;
    D_ANI.assign(root_path);
    D_ANI.append(temp);

    if(!load_file.good())allegro_message("(2)LOAD FILE IS BAD! FLAGS SET\n EOF: %i \n BAD: %i \n FAIL: %i", load_file.eof(),load_file.bad(),load_file.fail());

    rm->Load_Sprite(W_ANI,W_ANI);
    rm->Load_Sprite(A_ANI,A_ANI);
    rm->Load_Sprite(D_ANI,D_ANI);

    magic_number = (int)ceil(sqrt(rm->Get_Sprite(W_ANI,0)->w*rm->Get_Sprite(W_ANI,0)->w + rm->Get_Sprite(W_ANI,0)->h*rm->Get_Sprite(W_ANI,0)->h));

    load_file>>num_col;

    Hit_Zones = new C_Circ*[num_col];
    multipliers = new int[num_col];
    int cx,cy,cr;
    for(int lcv = 0;lcv < num_col;lcv++)
    {
        load_file>>cx>>cy>>cr>>multipliers[lcv];
        Hit_Zones[lcv] = new C_Circ(cx+(magic_number-rm->Get_Sprite(W_ANI,0)->w)/2,cy+(magic_number-rm->Get_Sprite(W_ANI,0)->h)/2,cr);
    }
    Master_Hit_Zone = new C_Rect(x - (rm->Get_Sprite(W_ANI,0)->w/2),y - (rm->Get_Sprite(W_ANI,0)->h/2),rm->Get_Sprite(W_ANI,0)->w,rm->Get_Sprite(W_ANI,0)->h);
    load_file.close();
}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:25:40+00:00Added an answer on June 1, 2026 at 3:25 am

    It’s failing at the open. When you say spawn, I’m assuming you mean different threads, not new processes. I suspect you are running out of file descriptors, as there is a limit to the number of open files a given process may have.

    When an open fails it sets the global value ERRNO. You can either get C++ fancy with it (using strerror(errno)) , or just use perror() to see whether this was the issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe world peace would be easier, but I have a problem with the widths
Maybe this cannot be done, but please help or suggest how this can be
We are seeing an issue where the Session isn't being abandoned in DNN. I'm
EDIT My issue was related to snippet syntax all along... The configuration below totally
I am very confused by an issue I am seeing on my production site.
I'm seeing something that's got me stumped. Maybe you folks can advise. What appears
THE EXAMPLE First and foremost, here's my code and problem: http://www.nathanstpierre.com/MBX/showoff.html THE ISSUE So
Is any one seeing the issue I m facing. I am trying to upgrade
Maybe I just don't know .NET well enough yet, but I have yet to
Maybe the need to do this is a 'design smell' but thinking about another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.