Don't drop "action" keys in network

This commit is contained in:
Stefan Bühler 2009-08-28 21:50:52 +02:00
parent 7db7728f3b
commit fe507df7f0
2 changed files with 21 additions and 22 deletions

View File

@ -9,7 +9,6 @@ extern int xcolors[256];
#define IXSIZE 640 #define IXSIZE 640
#define IYSIZE 480 #define IYSIZE 480
#define MYF1 0x180 #define MYF1 0x180
#define MYF2 0x181 #define MYF2 0x181
#define MYF3 0x182 #define MYF3 0x182
@ -36,9 +35,7 @@ extern int xcolors[256];
#define MYSHIFTED 0x40 #define MYSHIFTED 0x40
#define MYALTED 0x200 #define MYALTED 0x200
typedef struct gfxset {
typedef struct gfxset
{
uchar gs_colormap[768]; uchar gs_colormap[768];
uchar gs_inout[256]; uchar gs_inout[256];
uchar *gs_pic; uchar *gs_pic;
@ -46,15 +43,13 @@ typedef struct gfxset
int gs_ysize; int gs_ysize;
} gfxset; } gfxset;
typedef struct figure typedef struct figure {
{
int xsize,ysize; int xsize,ysize;
int xdelta,ydelta; int xdelta,ydelta;
uchar *graphics; uchar *graphics;
} figure; } figure;
typedef struct solid typedef struct solid {
{
int xsize,ysize; int xsize,ysize;
uchar *graphics; uchar *graphics;
} solid; } solid;
@ -179,7 +174,7 @@ enum tile_types {
}; };
#define ACT_INVALID 0x88 // #define ACT_INVALID 0x88
#define ACT_NONE 0 #define ACT_NONE 0
#define ACT_UP 1 #define ACT_UP 1
#define ACT_DOWN 2 #define ACT_DOWN 2

View File

@ -297,6 +297,10 @@ int networktraffic(void) {
actions[i] = ACT_QUIT; actions[i] = ACT_QUIT;
} }
} else { } else {
for (i = 1; i < MAXNETNODES; ++i) {
if (netnodes[i].used)
actions[i] &= ACT_MASK; /* only keep direction */
}
now = gtime(); now = gtime();
for (;;) { for (;;) {
if (gtime() - now > 15) break; if (gtime() - now > 15) break;
@ -312,7 +316,7 @@ int networktraffic(void) {
count = readuint32(mesg+5); count = readuint32(mesg+5);
if (count > latestcounts[whosent]) { if (count > latestcounts[whosent]) {
latestcounts[whosent] = count; latestcounts[whosent] = count;
actions[whosent] = mesg[9]; actions[whosent] = (actions[whosent] & ~ACT_MASK) | mesg[9]; /* don't drop "action" keys */
} }
} }
} }