Fixed bug #690843: Shared vision tiles aren't explored
Fixed bug #691057: Shared vision and destroyed buildings Fixed bug when shared vision didn't update seen tiles when sharing vision
This commit is contained in:
parent
8d8cb95bca
commit
2826dae999
4 changed files with 58 additions and 2 deletions
|
@ -1082,6 +1082,12 @@
|
|||
<LI>Fixed bug #690171: Crash building oil platform with UNITS_ON_MAP
|
||||
(from Jimmy Salmon).
|
||||
<LI>Fixed bug #690232: AI can't pass walls (from Jimmy Salmon).
|
||||
<LI>Fixed bug #690843: Shared vision tiles aren't explored (from Russell
|
||||
Smith).
|
||||
<LI>Fixed bug #691057: Shared vision and destroyed buildings (from
|
||||
Russell Smith).
|
||||
<LI>Fixed bug when shared vision didn't update seen tiles when sharing
|
||||
vision (from Russell Smith).
|
||||
<LI>+++
|
||||
</UL>
|
||||
</UL>
|
||||
|
|
|
@ -138,6 +138,7 @@ local void ClearSavedAction(Unit* unit)
|
|||
global void CommandQuit(int player)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
if (Players[player].TotalNumUnits != 0) {
|
||||
// Set player to neutral, remove allied/enemy/shared vision status
|
||||
|
@ -148,6 +149,22 @@ global void CommandQuit(int player)
|
|||
}
|
||||
Players[i].Allied &= ~(1 << player);
|
||||
Players[i].Enemy &= ~(1 << player);
|
||||
#ifdef NEW_FOW
|
||||
// Check All tiles and mark unseen ones as explored.
|
||||
if (Players[player].SharedVision&(1<<i) &&
|
||||
(Players[i].SharedVision&(1<<player))) {
|
||||
for(j=0;j<TheMap.Width*TheMap.Height;j++) {
|
||||
if (TheMap.Fields[j].Visible[i] &&
|
||||
!TheMap.Fields[j].Visible[player]) {
|
||||
TheMap.Fields[j].Visible[player]=1;
|
||||
}
|
||||
if (TheMap.Fields[j].Visible[player] &&
|
||||
!TheMap.Fields[j].Visible[i]) {
|
||||
TheMap.Fields[j].Visible[i]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Players[i].SharedVision &= ~(1 << player);
|
||||
Players[player].Allied &= ~(1 << i);
|
||||
Players[player].Enemy &= ~(1 << i);
|
||||
|
@ -1388,9 +1405,41 @@ global void CommandSharedVision(int player,int state,int opponent)
|
|||
Unit* unit;
|
||||
|
||||
if( state==0 ) {
|
||||
#ifdef NEW_FOW
|
||||
// Check All tiles and mark unseen ones as explored.
|
||||
if (Players[player].SharedVision&(1<<opponent) &&
|
||||
(Players[opponent].SharedVision&(1<<player))) {
|
||||
for(i=0;i<TheMap.Width*TheMap.Height;i++) {
|
||||
if (TheMap.Fields[i].Visible[opponent] &&
|
||||
!TheMap.Fields[i].Visible[player]) {
|
||||
TheMap.Fields[i].Visible[player]=1;
|
||||
}
|
||||
if (TheMap.Fields[i].Visible[player] &&
|
||||
!TheMap.Fields[i].Visible[opponent]) {
|
||||
TheMap.Fields[i].Visible[opponent]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Players[player].SharedVision&=~(1<<opponent);
|
||||
} else {
|
||||
Players[player].SharedVision|=(1<<opponent);
|
||||
#ifdef NEW_FOW
|
||||
// Check All tiles and mark SeenTiles for wood
|
||||
if (Players[player].SharedVision&(1<<opponent) &&
|
||||
(Players[opponent].SharedVision&(1<<player))
|
||||
&& (player==ThisPlayer->Player || opponent==ThisPlayer->Player)) {
|
||||
int y;
|
||||
for(i=0;i<TheMap.Width;i++) {
|
||||
for(y=0;y<TheMap.Height;y++) {
|
||||
if( IsTileVisible(ThisPlayer,i,y) > 1) {
|
||||
MapMarkSeenTile(i,y);
|
||||
UnitsMarkSeen(i,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// MUST update seen buildings when vision is shared or unshared
|
||||
for( i=0; i<NumUnits; ++i) {
|
||||
|
@ -1398,7 +1447,6 @@ global void CommandSharedVision(int player,int state,int opponent)
|
|||
UnitMarkSeen(unit);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//@}
|
||||
|
|
|
@ -184,6 +184,7 @@ global void ReleaseUnit(Unit* unit)
|
|||
for( ; h-->0; ) {
|
||||
for( w=w0; w-->0; ) {
|
||||
if( !IsMapFieldVisible(&Players[i],x+w,y+h)
|
||||
&& IsMapFieldExplored(&Players[i],x+w,y+h)
|
||||
&& Players[i].Type == PlayerPerson ) {
|
||||
unit->Visible |= (1 << i);
|
||||
}
|
||||
|
|
|
@ -1912,7 +1912,8 @@ global void DrawUnits(const void* v)
|
|||
//
|
||||
corpses = &DestroyedBuildings;
|
||||
while( *corpses ) {
|
||||
if( UnitVisibleInViewport(vp,*corpses) && !(*corpses)->SeenDestroyed ) {
|
||||
if( UnitVisibleInViewport(vp,*corpses) && !(*corpses)->SeenDestroyed
|
||||
&& ((*corpses)->Visible & 1<<ThisPlayer->Player)) {
|
||||
DrawBuilding(*corpses);
|
||||
}
|
||||
corpses=&(*corpses)->Next;
|
||||
|
|
Loading…
Add table
Reference in a new issue