Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv11850/src
Modified Files:
distress.c newwin.c short.c
Log Message:
Team select screen no longer uses 99% cpu power (credit to Gregory Hermann for the solution)
Planet kill messages now show armies dooshed (if any), thanks to server short packet change.
Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- newwin.c 24 May 2006 01:14:39 -0000 1.30
+++ newwin.c 26 May 2006 05:58:08 -0000 1.31
@@ -1400,30 +1400,12 @@
while (!W_EventsPending ())
{
time_t elapsed;
- fd_set rfds;
- struct timeval tv;
me->p_ghostbuster = 0;
- /* Since we don't have a socket to check on Win32
- for windowing system events, we set the timeout to zero and
- effectively poll. Yes, I could do the correct thing
- and call WaitForMultipleObjects() etc. but I don't feel like it */
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- FD_ZERO (&rfds);
- FD_SET (sock, &rfds);
- if (udpSock >= 0)
- FD_SET (udpSock, &rfds);
- // For replacing select to cut down on cpu usage, but not working yet
- // HANDLE handles[FD_SETSIZE];
- // WaitForMultipleObjects(32, handles, TRUE, INFINITE);
- select (32, &rfds, 0, 0, &tv); /* hmm, 32 might be too small */
-
- if (FD_ISSET (sock, &rfds) ||
- (udpSock >= 0 && FD_ISSET (udpSock, &rfds)))
- {
- readFromServer (&rfds);
- }
+ /* Select() causes infinite CPU usage, can't use WaitForMultipleObjects
+ due to UI working on same thread (no blocking), so a simple Sleep
+ is the best solution. */
+ Sleep(10);
elapsed = time (0) - startTime;
if (elapsed > (time_t)(autoQuit))
{
Index: short.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/short.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- short.c 24 May 2006 09:10:08 -0000 1.8
+++ short.c 26 May 2006 05:58:08 -0000 1.9
@@ -1289,7 +1289,7 @@
static int arg3, arg4; /* Here are the arguments
* for warnings with more
* than 2 arguments */
- static int karg3, karg4, karg5 = 0;
+ static int karg3, karg4, karg5, karg6 = 0;
#ifndef RCM
char killmess[20];
#endif
@@ -1544,6 +1544,7 @@
break;
case KILLARGS2:
karg5 = (unsigned char) packet->argument;
+ karg6 = (unsigned char) packet->argument2;
break;
case DMKILLP:
@@ -1553,12 +1554,14 @@
{
struct mesg_spacket msg;
+ unsigned char victim;
+ victim = (unsigned char) (((unsigned char) packet->argument) & 0x3f);
#ifdef RCM
dist.distype = rcm;
- dist.sender = packet->argument;
- dist.tclose_j = packet->argument;
- dist.arms = '\0';
+ dist.sender = victim;
+ dist.tclose_j = victim;
+ dist.arms = karg6;
dist.dam = '\0';
dist.shld = '\0';
dist.tclose_pl = packet->argument2;
@@ -1566,9 +1569,9 @@
makedistress (&dist, msg.mesg, rcm_msg[2].macro);
#else
(void) sprintf (msg.mesg, "GOD->ALL %s (%c%c) killed by %s (%c)",
- players[packet->argument].p_name,
- teamlet[players[packet->argument].p_team],
- shipnos[packet->argument],
+ players[victim].p_name,
+ teamlet[players[victim].p_team],
+ shipnos[victim],
planets[(unsigned char) packet->argument2].
pl_name,
teamlet[planets
Index: distress.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/distress.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- distress.c 7 May 2006 16:59:27 -0000 1.3
+++ distress.c 26 May 2006 05:58:08 -0000 1.4
@@ -869,7 +869,7 @@
break;
#endif
- case '*': /* push %} into buf */
+ case '*': /* push %* into buf */
case '}': /* push %} into buf */
case '{': /* push %{ into buf */
case '!': /* push %! into buf */