Speed Improvements to IsTileVisible

This commit is contained in:
mr-russ 2003-10-19 05:00:19 +00:00
parent 5cc217919a
commit 208054dea1

View file

@ -197,24 +197,25 @@ global int IsTileVisible(const Player* player, int x, int y)
int visiontype;
int i;
if (TheMap.Fields[y * TheMap.Width + x].Visible[player->Player]>1) {
return 2;
visiontype = TheMap.Fields[y * TheMap.Width + x].Visible[player->Player];
if (visiontype > 1 || !player->SharedVision) {
return visiontype;
}
visiontype=TheMap.Fields[y * TheMap.Width + x].Visible[player->Player];
for (i = 0; i < PlayerMax && visiontype < 2; ++i) {
if (visiontype == 0) {
return 0;
}
for (i = 0; i < PlayerMax ; ++i) {
if (player->SharedVision & (1 << i) &&
(Players[i].SharedVision & (1 << player->Player))) {
if (visiontype < TheMap.Fields[y * TheMap.Width + x].Visible[i]) {
visiontype = TheMap.Fields[y * TheMap.Width + x].Visible[i];
}
}
if (visiontype > 1) {
if (visiontype > 1 || TheMap.NoFogOfWar) {
return 2;
}
}
if (TheMap.NoFogOfWar == 1 && visiontype != 0) {
return 2;
}
return visiontype;
}