This commit is contained in:
jsalmon3 2003-02-24 00:40:23 +00:00
parent 2826dae999
commit 9da87a3d35

View file

@ -140,39 +140,39 @@ global void CommandQuit(int player)
int i;
int j;
if (Players[player].TotalNumUnits != 0) {
if( Players[player].TotalNumUnits!=0 ) {
// Set player to neutral, remove allied/enemy/shared vision status
Players[player].Type = PlayerNeutral;
for (i = 0; i < NumPlayers; ++i) {
if (i == player) {
Players[player].Type=PlayerNeutral;
for( i=0; i<NumPlayers; ++i) {
if( i==player ) {
continue;
}
Players[i].Allied &= ~(1 << player);
Players[i].Enemy &= ~(1 << 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;
// 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);
Players[player].SharedVision &= ~(1 << i);
Players[i].SharedVision&=~(1<<player);
Players[player].Allied&=~(1<<i);
Players[player].Enemy&=~(1<<i);
Players[player].SharedVision&=~(1<<i);
}
SetMessage("Player \"%s\" has left the game", Players[player].Name);
SetMessage("Player \"%s\" has left the game",Players[player].Name);
} else {
SetMessage("Player \"%s\" has been killed", Players[player].Name);
SetMessage("Player \"%s\" has been killed",Players[player].Name);
}
}
@ -196,7 +196,7 @@ global void CommandStopUnit(Unit* unit)
ReleaseOrder(&unit->SavedOrder);
ReleaseOrder(&unit->NewOrder);
#ifdef HIERARCHIC_PATHFINDER
PfHierReleaseData (unit);
PfHierReleaseData(unit);
#endif
unit->SavedOrder=unit->NewOrder=*order;
}
@ -1406,16 +1406,16 @@ global void CommandSharedVision(int player,int state,int opponent)
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]) {
// 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]) {
if( TheMap.Fields[i].Visible[player]
&& !TheMap.Fields[i].Visible[opponent] ) {
TheMap.Fields[i].Visible[opponent]=1;
}
}
@ -1425,14 +1425,15 @@ global void CommandSharedVision(int player,int state,int 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)) {
// 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) {
for( i=0; i<TheMap.Width; ++i) {
for( y=0; y<TheMap.Height; ++y) {
if( IsMapFieldVisible(ThisPlayer,i,y) ) {
MapMarkSeenTile(i,y);
UnitsMarkSeen(i,y);
}
@ -1442,8 +1443,8 @@ global void CommandSharedVision(int player,int state,int opponent)
#endif
}
// MUST update seen buildings when vision is shared or unshared
for( i=0; i<NumUnits; ++i) {
unit = Units[i];
for( i=0; i<NumUnits; ++i ) {
unit=Units[i];
UnitMarkSeen(unit);
}