stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src/map map_fog.c


From: Russell Smith
Subject: [Stratagus-CVS] stratagus/src/map map_fog.c
Date: Sun, 19 Oct 2003 02:00:20 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Russell Smith <address@hidden>  03/10/19 02:00:19

Modified files:
        src/map        : map_fog.c 

Log message:
        Speed Improvements to IsTileVisible

Patches:
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.108 stratagus/src/map/map_fog.c:1.109
--- stratagus/src/map/map_fog.c:1.108   Tue Oct  7 20:06:43 2003
+++ stratagus/src/map/map_fog.c Sun Oct 19 02:00:19 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: map_fog.c,v 1.108 2003/10/08 00:06:43 jsalmon3 Exp $
+//     $Id: map_fog.c,v 1.109 2003/10/19 06:00:19 mr-russ Exp $
 
 //@{
 
@@ -197,23 +197,24 @@
     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;
+    }
+    if (visiontype == 0) {
+       return 0;
     }
-    visiontype=TheMap.Fields[y * TheMap.Width + x].Visible[player->Player];
-    for (i = 0; i < PlayerMax && visiontype < 2; ++i) {
+    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;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]