- Online Community Forums » Programming Questions » datafile blues part2

This thread is locked; no one can reply to it. rss feed Print
datafile blues part2
Member #3,572
June 2003

So I figured that you use "/" to seperate out nested datafiles when I use find_datafile_object. But now when I get that datafile, I want to loop through it and load all bitmaps in that datafile. My code doesn't seem to be doing that.

1AnimationDirection::AnimationDirection(DATAFILE* animation, string animName, string direction)
3 BITMAP* temp;
4 int i;
5 string finalPath;
7 finalPath = animName + "/" + direction;
8 //find the datafile direction object and loop through all it's bitmaps
9 m_direction = find_datafile_object( animation, finalPath.c_str() );
10 if(m_direction != NULL)
11 {
12 for(i=0;m_direction<i>.type != DAT_END;i++)
13 {
14 temp = (BITMAP*)m_direction<i>.dat;
15 m_frame.push_back( temp );
16 }
17 }

temp = (BITMAP*)m_direction(i).dat; is not a bitmap. The width and height are not what the bitmap w and h are. I think I'm missing something.

Actually I think I'm a tad ugly, but some women disagree, mostly Asians for some reason.

January 2001

Check the type of the object before casting. It is possible you have some object that is not a bitmap, or that it is using a wide search instead of a deep search.

Mitsuko's last words, Battle Royale

Member #3,572
June 2003

m_direction(i).type is type DAT_FILE, but I don't understand why. m_direction should be the datafile, where m_direction(i).dat should be the first bitmap inside this nested datafile.


        finalPath = get_datafile_property(m_direction,

That comes back with WEST, which is the right datafile. hmmm

        finalPath = get_datafile_property((DATAFILE*)m_direction<i>.dat,

Gives me the name of the first bitmap. But yet when I do:

temp = (BITMAP*)m_direction<i>.dat;

the width is like 21963458, where the real image width is 128


for(i=0;m_direction<i>.type != DAT_END;i++)

That is looping through the outer datafile. It's looping through each direction datafile, not inside the direction datafile. I know this cause if I start to load the last direction in the datafile it iterates once and exits loop, and if I start at the first direction it loops however many direction there are. Since m_direction is the direction datafile, I need to loop through that datafile.

    --Stand.dat  "STAND"
        -West.dat   "WEST"    (=m_direction)

So if West.dat is m_direction wouldn't m_direction(i).dat be 00.bmp?

Actually I think I'm a tad ugly, but some women disagree, mostly Asians for some reason.

Go to: