Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30468/src
Modified Files:
dashboard.c defaults.c enter.c option.c socket.c
Log Message:
Add new dashboard timerType that displays info from generic 32 b packet in
order of importance (INL time > surrender time > sb reconstruct time > time since t mode started). Defaults to current time of day if server does not use generic 32 b.
Index: dashboard.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- dashboard.c 19 Apr 2008 20:03:00 -0000 1.28
+++ dashboard.c 16 Jul 2008 00:16:10 -0000 1.29
@@ -204,6 +204,19 @@
case T_USER:
s = "TMR";
break;
+ /* Variable game-related timers, display in order of importance */
+ case T_UTIL:
+ if (context->tournament_remain)
+ s = "INL";
+ else if (context->team_remain)
+ s = "SUR";
+ else if (context->starbase_remain)
+ s = "SB ";
+ else if (context->tournament_age)
+ s = "TMD";
+ else
+ s = "NOW";
+ break;
}
if(s)
{
@@ -222,7 +235,27 @@
get the timer string and start comparing it with the old one. Only
print the differences
*/
- timer = timeString(now - timeBank[timerType]);
+ switch (timerType)
+ {
+ case T_DAY:
+ case T_SERVER:
+ case T_SHIP:
+ case T_USER:
+ timer = timeString(now - timeBank[timerType]);
+ break;
+ case T_UTIL:
+ if (context->tournament_remain)
+ sprintf(timer, " %03d %c", context->tournament_remain, context->tournament_remain_units);
+ else if (context->team_remain)
+ sprintf(timer, " %03d s", context->team_remain);
+ else if (context->starbase_remain)
+ sprintf(timer, " %03d m", context->starbase_remain);
+ else if (context->tournament_age)
+ sprintf(timer, " %03d %c", context->tournament_age, context->tournament_age_units);
+ else
+ timer = timeString(now - timeBank[timerType]);
+ break;
+ }
x = xloc + 4 * W_Textwidth;
left = 0;
right = -1;
Index: enter.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/enter.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- enter.c 13 Jul 2008 03:56:46 -0000 1.18
+++ enter.c 16 Jul 2008 00:16:10 -0000 1.19
@@ -57,8 +57,8 @@
initialize_thingies();
status2 = (struct status2 *) malloc(sizeof(*status2));
status = (struct status *) malloc(sizeof(*status));
- context = (struct context *) malloc(sizeof(*context));
initialize_planets();
+ initialize_context();
mctl = (struct mctl *) malloc(sizeof(*mctl));
messages = (struct message *) malloc(sizeof(*messages) * MAXMESSAGE);
Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- option.c 19 Apr 2008 16:23:00 -0000 1.55
+++ option.c 16 Jul 2008 00:16:11 -0000 1.56
@@ -154,6 +154,7 @@
"Timer shows time on server",
"Timer shows time in ship",
"Timer shows user-set time",
+ "Timer shows game-related info",
""
};
Index: socket.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- socket.c 14 Jul 2008 01:52:48 -0000 1.51
+++ socket.c 16 Jul 2008 00:16:11 -0000 1.52
@@ -2975,6 +2975,21 @@
}
}
+void
+initialize_context(void)
+{
+ context = (struct context *) malloc(sizeof(*context));
+
+ context->gameup = 0;
+ context->tournament_teams = 0;
+ context->tournament_age = 0;
+ context->tournament_age_units = 0;
+ context->tournament_remain = 0;
+ context->tournament_remain_units = 0;
+ context->starbase_remain = 0;
+ context->team_remain = 0;
+}
+
/* Functions to handle the overloaded packet types 32 and 33 */
void handlePacket32 (unsigned char *sbuf)
{
Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- defaults.c 19 Apr 2008 16:22:59 -0000 1.92
+++ defaults.c 16 Jul 2008 00:16:10 -0000 1.93
@@ -837,6 +837,7 @@
"2 - show time on server",
"3 - show time in ship",
"4 - show user-set time",
+ "5 - show game-related timers",
NULL
}
},