Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv21032/src
Modified Files:
enter.c local.c mswindow.c
Log Message:
Fix 2 problems found by profiling, both repeated strcmp calls, one in the hockey_mode check
and one in the SDB lookup function. Added new set of flags to window structure, sdb_flags,
that are set on window creation to flag a window as "local" or "map", rather than having to
string compare the name.
A few changes in compiler settings from moving to VS 2005 PE, also some flags that were changed
to work for profiling.
Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- mswindow.c 23 Jan 2007 11:12:04 -0000 1.42
+++ mswindow.c 27 Feb 2007 08:37:07 -0000 1.43
@@ -5609,6 +5609,10 @@
if (win->hwnd == NULL)
return NULL;
+ if (strcmpi (win->name, "local") == 0)
+ win->sdb_flags = SDB_FLAG_LOCAL;
+ else if (strcmpi (win->name, "map") == 0)
+ win->sdb_flags = SDB_FLAG_MAP;
sdb = (SDBUFFER *) malloc (sizeof (SDBUFFER));
sdb->window = (W_Window) malloc (sizeof (Window));
@@ -5643,9 +5647,9 @@
if (win->hwnd == NULL)
return NULL;
- if (strcmpi (win->name, "local") == 0)
+ if (win->sdb_flags == SDB_FLAG_LOCAL)
return localSDB;
- else if (strcmpi (win->name, "map") == 0)
+ else if (win->sdb_flags == SDB_FLAG_MAP)
return mapSDB;
else
return NULL;
Index: enter.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/enter.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- enter.c 25 Feb 2007 00:19:00 -0000 1.5
+++ enter.c 27 Feb 2007 08:37:07 -0000 1.6
@@ -215,6 +215,7 @@
static int first_run = 1;
if (first_run)
+ {
for (i = 0; i < MAXPLAYER; i++)
{
if (strcmp(players[i].p_name, "Puck") == 0 &&
@@ -223,9 +224,10 @@
players[i].p_ship.s_type == SCOUT)
{
playing_hockey = 1;
- first_run = 0;
}
}
+ first_run = 0;
+ }
return playing_hockey;
}
Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- local.c 26 Feb 2007 06:54:49 -0000 1.60
+++ local.c 27 Feb 2007 08:37:07 -0000 1.61
@@ -1215,7 +1215,7 @@
}
#ifdef HOCKEY_LINES
/* Puck circle */
- if (puckCircle && hockey_mode)
+ if (puckCircle && hockey_mode ())
{
if (myPlayer(j) || isObsLockPlayer(j))
{