[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/map map_fog.c
From: |
Jimmy Salmon |
Subject: |
[Stratagus-CVS] stratagus/src/map map_fog.c |
Date: |
Mon, 20 Oct 2003 13:56:35 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Jimmy Salmon <address@hidden> 03/10/20 13:56:35
Modified files:
src/map : map_fog.c
Log message:
Fixed no fog of war, more speedup
Patches:
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.109 stratagus/src/map/map_fog.c:1.110
--- stratagus/src/map/map_fog.c:1.109 Sun Oct 19 02:00:19 2003
+++ stratagus/src/map/map_fog.c Mon Oct 20 13:56:34 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_fog.c,v 1.109 2003/10/19 06:00:19 mr-russ Exp $
+// $Id: map_fog.c,v 1.110 2003/10/20 17:56:34 jsalmon3 Exp $
//@{
@@ -190,33 +190,33 @@
** @param x X tile to check.
** @param y Y tile to check.
**
-** @return 0 unexplored, 1 explored, >1 visible.
+** @return 0 unexplored, 1 explored, > 1 visible.
*/
global int IsTileVisible(const Player* player, int x, int y)
{
- int visiontype;
int i;
+ unsigned char visiontype;
+ unsigned char* visible;
- visiontype = TheMap.Fields[y * TheMap.Width + x].Visible[player->Player];
+ visible = TheMap.Fields[y * TheMap.Width + x].Visible;
+ visiontype = visible[player->Player];
- if (visiontype > 1 || !player->SharedVision) {
+ if (visiontype != 1) {
return visiontype;
}
- if (visiontype == 0) {
- return 0;
+ if (!player->SharedVision) {
+ return visiontype + TheMap.NoFogOfWar;
}
+
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 (visible[i] > 1) {
+ return 2;
}
}
- if (visiontype > 1 || TheMap.NoFogOfWar) {
- return 2;
- }
}
- return visiontype;
+ return visiontype + TheMap.NoFogOfWar;
}
/**