Problems redrawing the military advisor minimap

NotSoGood

Emperor
Joined
Jan 25, 2009
Messages
1,077
Location
Finland
I had an idea about adding a new screen to military advisor where you could hire new units if running a precise civic. I got the screen work like the victory screen, but the problem is the minimap in military advisor. For some reason when I change back to military advisor page, the minimap is just a blue screen. :confused:
I should be drawn again when the page is redrawn but there's only a blue panel.
So, does the map work differently that it can be drawn only when opening the screen first time? I tested it by chaging the hire units page to default screen and then switching to military advisor, the map worked fine. Does anyone know what might be the problem?
 
Ruff and I had to futz with this when adding the two new tabs to the BUG-MA. It took some playing around with it, but we got it to work. This was two years ago or so and I don't remember exactly what we had to do, but it boiled down to calling a couple APIs under the right circumstances.

If you look at BUG's MA screen you can probably figure it out. All the tab-switching code is pretty well organized IIRC. Start with handleInput().
 
Hmm, I somehow managed to display the minimap after checking the other page. But for some reason it draws the panels on top of the panels from previous page. I took a screenshot of it. (Notice the wierd block on top of the minimap.)
Is there anyway to remove the previous panels before drawing the new ones?
 
It's possible that we added deleteAllWidgets() to the MA to get this to work, but I honestly don't remember. You'll see many of the advisors have this function. As each widget is drawn, it is given a name generated from an incrementing counter. Then deleteAllWidgets() loops over the count and removes them.
 
I took a look at BUG's MA and noticed that it just adds a big panel that can hide everything from the first page, including the minimap -> no need to redraw it, just remove the big panel when you want to view other page. That's a great idea and works fine. But I still wonder why the minimap doesn't want to be redrawn...
 
There are some APIs specifically to handle the minimap in Python so you might scan the list for any that seem to relate to drawing it. Some are to control how it's drawn, but I'm not familiar with them all.

I didn't realize BUG was just hiding it with a panel. :lol: Ruff figured out how to do it when he added the SIT REP page.
 
Back
Top Bottom