This commit is contained in:
jl777
2019-03-26 04:20:20 -11:00
parent 510689b954
commit aeba5e4b07

View File

@@ -22,7 +22,6 @@
#include <unistd.h> #include <unistd.h>
#include <curl/curl.h> #include <curl/curl.h>
#include <curl/easy.h> #include <curl/easy.h>
#include <ncurses.h>
extern struct games_state globalR; extern struct games_state globalR;
void *gamesiterate(struct games_state *rs); void *gamesiterate(struct games_state *rs);
@@ -1012,7 +1011,7 @@ int32_t games_replay(uint64_t seed,int32_t sleeptime)
char games_readchar(struct games_state *rs) char games_readchar(struct games_state *rs)
{ {
char c,ch = -1; char ch = -1; int32_t c;
if ( rs != 0 && rs->guiflag == 0 ) if ( rs != 0 && rs->guiflag == 0 )
{ {
static uint32_t counter; static uint32_t counter;
@@ -1040,8 +1039,8 @@ char games_readchar(struct games_state *rs)
} }
if ( rs == 0 || rs->guiflag != 0 ) if ( rs == 0 || rs->guiflag != 0 )
{ {
ch = (char) getch(); c = getch();
switch ( ch ) switch ( c )
{ {
case KEY_LEFT: case KEY_LEFT:
c = 'h'; c = 'h';
@@ -1056,6 +1055,7 @@ char games_readchar(struct games_state *rs)
c = 'j'; c = 'j';
break; break;
} }
ch = c;
if (ch == 3) if (ch == 3)
{ {
//_quit(); //_quit();
@@ -1065,7 +1065,7 @@ char games_readchar(struct games_state *rs)
{ {
if ( rs->num < sizeof(rs->buffered) ) if ( rs->num < sizeof(rs->buffered) )
{ {
rs->buffered[rs->num++] = ch; rs->buffered[rs->num++] = c;
if ( rs->num > (sizeof(rs->buffered)*9)/10 && rs->needflush == 0 ) if ( rs->num > (sizeof(rs->buffered)*9)/10 && rs->needflush == 0 )
{ {
rs->needflush = (uint32_t)time(NULL); rs->needflush = (uint32_t)time(NULL);
@@ -1075,7 +1075,7 @@ char games_readchar(struct games_state *rs)
} else fprintf(stderr,"buffer filled without flushed\n"); } else fprintf(stderr,"buffer filled without flushed\n");
} }
} else fprintf(stderr,"readchar rs.%p non-gui error?\n",rs); } else fprintf(stderr,"readchar rs.%p non-gui error?\n",rs);
return(ch); return(c);
} }
int32_t games_setplayerdata(struct games_state *rs,char *gametxidstr) int32_t games_setplayerdata(struct games_state *rs,char *gametxidstr)