Hey everyone, I was hoping someone with experience using mappy could help me out. I'm using multithreading. In my main thread I'm displaying the map and doing normal logic stuff. I'm using another thread to load maps. By using another thread to load maps I've needed change mappy's draw code to convert memory bitmaps to video bitmaps.
I did made this change in the MapDrawBG() function. with this code:
Thanks to "kazzmir" for this.
However the program crashes when the MapFreeMem() function is called in my second thread.
1. Initial map loads (in my main thread)
2. walk into a new area
3. new map loads (in the second thread)
4. walk back to the previous area
5. Crash (in the second thread)
Specifically at this part:
4 if (
i = 0;
8 while (
10 al_destroy_bitmap (
i]); //Crash Happens Here
13 free (
I'm hoping some with a lot of experience with mappy can help me out. I've uploaded the complete source for mappy (my modified version) for anyone who needs/wants to look at it.
The mappy source code, with the addition of mulithreading, is kind of difficult for me to understand. One of these days I'll need to re-write it to be 100% C++. But in the mean time if someone could help me tackle this problem that be great.