Set visibility variables properly to remove random visibility bugs.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9547 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2010-01-28 15:56:17 +00:00 committed by Git SVN Gateway
parent 1da4d6e731
commit 46a987621e
3 changed files with 7 additions and 9 deletions

View File

@ -2534,6 +2534,7 @@ DROID* buildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y, UDWORD player,
psDroid->resistance = ACTION_START_TIME;
memset(psDroid->visible, 0, sizeof(psDroid->visible));
memset(psDroid->visible, 0, sizeof(psDroid->seenThisTick));
psDroid->visible[psDroid->player] = UBYTE_MAX;
psDroid->died = 0;
psDroid->inFire = false;

View File

@ -354,12 +354,10 @@ FEATURE * buildFeature(FEATURE_STATS *psStats, UDWORD x, UDWORD y,BOOL FromSave)
}
}
for(i=0; i<MAX_PLAYERS; i++)
{
psFeature->visible[i] = 0;//vis;
}
//load into the map data
memset(psFeature->seenThisTick, 0, sizeof(psFeature->seenThisTick));
memset(psFeature->visible, 0, sizeof(psFeature->visible));
//load into the map data
if(FromSave) {
mapX = map_coord(x) - psStats->baseWidth / 2;
mapY = map_coord(y) - psStats->baseBreadth / 2;
@ -523,10 +521,8 @@ bool removeFeature(FEATURE *psDel)
if (psDel->psStats->subType == FEAT_GEN_ARTE || psDel->psStats->subType == FEAT_OIL_RESOURCE)
{
// have to check all players cos if you cheat you'll get em.
for (player = 0; player < MAX_PLAYERS; player++)
{
//see if there is a proximity message FOR THE SELECTED PLAYER at this location
psMessage = findMessage((MSG_VIEWDATA *)psDel, MSG_PROXIMITY, player);
while (psMessage)
{

View File

@ -1783,8 +1783,9 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y, U
psBuilding->resistance = (UWORD)structureResistance(pStructureType, (UBYTE)player);
psBuilding->lastResistance = ACTION_START_TIME;
//do the visiblilty stiff before setFunctionality - so placement of DP's can work
memset(psBuilding->visible, 0, (sizeof(UBYTE) * MAX_PLAYERS) );
// Do the visibility stuff before setFunctionality - so placement of DP's can work
memset(psBuilding->visible, 0, sizeof(psBuilding->visible));
memset(psBuilding->seenThisTick, 0, sizeof(psBuilding->seenThisTick));
/* Structure is trivially visible to the builder (owner) */
psBuilding->visible[player] = UBYTE_MAX;