When on a mission, and the map size changes (*scroll limits change midgame*), we need to make sure that the radar buffer gets reset to the new size of the map.

Fixes ticket:479 (again) and also ticket:494 (which is basically a duplicate of ticket:479)

NOTE: need a Expand_Limbo mission savegame to more fully test this. See notes in structure.c


git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7442 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2009-05-16 03:33:49 +00:00 committed by Git SVN Gateway
parent 583ae5c048
commit a7e00ca81d
3 changed files with 46 additions and 27 deletions

View File

@ -111,7 +111,8 @@ void radarInitVars(void)
//called for when a new mission is started //called for when a new mission is started
void resetRadarRedraw() void resetRadarRedraw()
{ {
// nothing here now // make sure Radar buffer is correct
resizeRadar();
} }
BOOL InitRadar(void) BOOL InitRadar(void)

View File

@ -2655,9 +2655,12 @@ BOOL scrSetScrollParams(void)
// When the scroll limits change midgame - need to redo the lighting // When the scroll limits change midgame - need to redo the lighting
initLighting(prevMinX < scrollMinX ? prevMinX : scrollMinX, initLighting(prevMinX < scrollMinX ? prevMinX : scrollMinX,
prevMinY < scrollMinY ? prevMinY : scrollMinY, prevMinY < scrollMinY ? prevMinY : scrollMinY,
prevMaxX < scrollMaxX ? prevMaxX : scrollMaxX, prevMaxX < scrollMaxX ? prevMaxX : scrollMaxX,
prevMaxY < scrollMaxY ? prevMaxY : scrollMaxY); prevMaxY < scrollMaxY ? prevMaxY : scrollMaxY);
// need to reset radar to take into account of new size
resizeRadar();
return true; return true;
} }
@ -2680,15 +2683,18 @@ BOOL scrSetScrollMinX(void)
return false; return false;
} }
prevMinX = scrollMinX; prevMinX = scrollMinX;
scrollMinX = minX; scrollMinX = minX;
//when the scroll limits change midgame - need to redo the lighting //when the scroll limits change midgame - need to redo the lighting
initLighting(prevMinX < scrollMinX ? prevMinX : scrollMinX, initLighting(prevMinX < scrollMinX ? prevMinX : scrollMinX,
scrollMinY, scrollMaxX, scrollMaxY); scrollMinY, scrollMaxX, scrollMaxY);
return true; // need to reset radar to take into account of new size
resizeRadar();
return true;
} }
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
@ -2709,16 +2715,19 @@ BOOL scrSetScrollMinY(void)
return false; return false;
} }
prevMinY = scrollMinY; prevMinY = scrollMinY;
scrollMinY = minY; scrollMinY = minY;
//when the scroll limits change midgame - need to redo the lighting //when the scroll limits change midgame - need to redo the lighting
initLighting(scrollMinX, initLighting(scrollMinX,
prevMinY < scrollMinY ? prevMinY : scrollMinY, prevMinY < scrollMinY ? prevMinY : scrollMinY,
scrollMaxX, scrollMaxY); scrollMaxX, scrollMaxY);
return true; // need to reset radar to take into account of new size
resizeRadar();
return true;
} }
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
@ -2739,16 +2748,19 @@ BOOL scrSetScrollMaxX(void)
return false; return false;
} }
prevMaxX = scrollMaxX; prevMaxX = scrollMaxX;
scrollMaxX = maxX; scrollMaxX = maxX;
//when the scroll limits change midgame - need to redo the lighting //when the scroll limits change midgame - need to redo the lighting
initLighting(scrollMinX, scrollMinY, initLighting(scrollMinX, scrollMinY,
prevMaxX < scrollMaxX ? prevMaxX : scrollMaxX, prevMaxX < scrollMaxX ? prevMaxX : scrollMaxX,
scrollMaxY); scrollMaxY);
return true; // need to reset radar to take into account of new size
resizeRadar();
return true;
} }
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
@ -2769,15 +2781,18 @@ BOOL scrSetScrollMaxY(void)
return false; return false;
} }
prevMaxY = scrollMaxY; prevMaxY = scrollMaxY;
scrollMaxY = maxY; scrollMaxY = maxY;
//when the scroll limits change midgame - need to redo the lighting //when the scroll limits change midgame - need to redo the lighting
initLighting(scrollMinX, scrollMinY, scrollMaxX, initLighting(scrollMinX, scrollMinY, scrollMaxX,
prevMaxY < scrollMaxY ? prevMaxY : scrollMaxY); prevMaxY < scrollMaxY ? prevMaxY : scrollMaxY);
return true; // need to reset radar to take into account of new size
resizeRadar();
return true;
} }
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------

View File

@ -1815,6 +1815,7 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y, U
scrollMinY = 0; scrollMinY = 0;
scrollMaxX = mapWidth; scrollMaxX = mapWidth;
scrollMaxY = mapHeight; scrollMaxY = mapHeight;
// NOTE: resizeRadar() may be required here, since we change scroll limits?
} }
//set the functionality dependant on the type of structure //set the functionality dependant on the type of structure
if(!setFunctionality(psBuilding, pStructureType->type)) if(!setFunctionality(psBuilding, pStructureType->type))
@ -1829,6 +1830,7 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y, U
scrollMinY = preScrollMinY; scrollMinY = preScrollMinY;
scrollMaxX = preScrollMaxX; scrollMaxX = preScrollMaxX;
scrollMaxY = preScrollMaxY; scrollMaxY = preScrollMaxY;
// NOTE: resizeRadar() may be required here, since we change scroll limits?
} }
return NULL; return NULL;
} }
@ -1841,6 +1843,7 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y, U
scrollMinY = preScrollMinY; scrollMinY = preScrollMinY;
scrollMaxX = preScrollMaxX; scrollMaxX = preScrollMaxX;
scrollMaxY = preScrollMaxY; scrollMaxY = preScrollMaxY;
// NOTE: resizeRadar() may be required here, since we change scroll limits?
} }
psBuilding->body = (UWORD)structureBody(psBuilding); psBuilding->body = (UWORD)structureBody(psBuilding);