Link errors
This commit is contained in:
116
src/cc/tetris.c
116
src/cc/tetris.c
@@ -634,64 +634,6 @@ void init_colors(void)
|
||||
init_pair(TC_CELLZ, COLOR_RED, COLOR_BLACK);
|
||||
}
|
||||
|
||||
#ifdef STANDALONE
|
||||
/*
|
||||
Main tetris game!
|
||||
*/
|
||||
#include "dapps/dappstd.c"
|
||||
|
||||
int32_t issue_games_events(struct games_state *rs,char *gametxidstr,uint32_t eventid,gamesevent c)
|
||||
{
|
||||
static FILE *fp;
|
||||
char params[512],*retstr; cJSON *retjson,*resobj; int32_t retval = -1;
|
||||
if ( fp == 0 )
|
||||
fp = fopen("events.log","wb");
|
||||
rs->buffered[rs->num++] = c;
|
||||
if ( sizeof(c) == 1 )
|
||||
sprintf(params,"[\"events\",\"17\",\"[%%22%02x%%22,%%22%s%%22,%u]\"]",c&0xff,gametxidstr,eventid);
|
||||
else if ( sizeof(c) == 2 )
|
||||
sprintf(params,"[\"events\",\"17\",\"[%%22%04x%%22,%%22%s%%22,%u]\"]",c&0xffff,gametxidstr,eventid);
|
||||
else if ( sizeof(c) == 4 )
|
||||
sprintf(params,"[\"events\",\"17\",\"[%%22%08x%%22,%%22%s%%22,%u]\"]",c&0xffffffff,gametxidstr,eventid);
|
||||
else if ( sizeof(c) == 8 )
|
||||
sprintf(params,"[\"events\",\"17\",\"[%%22%016llx%%22,%%22%s%%22,%u]\"]",(long long)c,gametxidstr,eventid);
|
||||
if ( (retstr= komodo_issuemethod(USERPASS,(char *)"cclib",params,GAMES_PORT)) != 0 )
|
||||
{
|
||||
if ( (retjson= cJSON_Parse(retstr)) != 0 )
|
||||
{
|
||||
if ( (resobj= jobj(retjson,(char *)"result")) != 0 )
|
||||
{
|
||||
retval = 0;
|
||||
if ( fp != 0 )
|
||||
{
|
||||
fprintf(fp,"%s\n",jprint(resobj,0));
|
||||
fflush(fp);
|
||||
}
|
||||
}
|
||||
free_json(retjson);
|
||||
} else fprintf(fp,"error parsing %s\n",retstr);
|
||||
free(retstr);
|
||||
} else fprintf(fp,"error issuing method %s\n",params);
|
||||
return(retval);
|
||||
}
|
||||
|
||||
char *clonestr(char *str)
|
||||
{
|
||||
char *clone; int32_t len;
|
||||
if ( str == 0 || str[0] == 0 )
|
||||
{
|
||||
printf("warning cloning nullstr.%p\n",str);
|
||||
#ifdef __APPLE__
|
||||
while ( 1 ) sleep(1);
|
||||
#endif
|
||||
str = (char *)"<nullstr>";
|
||||
}
|
||||
len = strlen(str);
|
||||
clone = (char *)calloc(1,len+16);
|
||||
strcpy(clone,str);
|
||||
return(clone);
|
||||
}
|
||||
|
||||
struct games_state globalR;
|
||||
|
||||
void *gamesiterate(struct games_state *rs)
|
||||
@@ -785,6 +727,64 @@ void *gamesiterate(struct games_state *rs)
|
||||
return(tg);
|
||||
}
|
||||
|
||||
#ifdef STANDALONE
|
||||
/*
|
||||
Main tetris game!
|
||||
*/
|
||||
#include "dapps/dappstd.c"
|
||||
|
||||
int32_t issue_games_events(struct games_state *rs,char *gametxidstr,uint32_t eventid,gamesevent c)
|
||||
{
|
||||
static FILE *fp;
|
||||
char params[512],*retstr; cJSON *retjson,*resobj; int32_t retval = -1;
|
||||
if ( fp == 0 )
|
||||
fp = fopen("events.log","wb");
|
||||
rs->buffered[rs->num++] = c;
|
||||
if ( sizeof(c) == 1 )
|
||||
sprintf(params,"[\"events\",\"17\",\"[%%22%02x%%22,%%22%s%%22,%u]\"]",c&0xff,gametxidstr,eventid);
|
||||
else if ( sizeof(c) == 2 )
|
||||
sprintf(params,"[\"events\",\"17\",\"[%%22%04x%%22,%%22%s%%22,%u]\"]",c&0xffff,gametxidstr,eventid);
|
||||
else if ( sizeof(c) == 4 )
|
||||
sprintf(params,"[\"events\",\"17\",\"[%%22%08x%%22,%%22%s%%22,%u]\"]",c&0xffffffff,gametxidstr,eventid);
|
||||
else if ( sizeof(c) == 8 )
|
||||
sprintf(params,"[\"events\",\"17\",\"[%%22%016llx%%22,%%22%s%%22,%u]\"]",(long long)c,gametxidstr,eventid);
|
||||
if ( (retstr= komodo_issuemethod(USERPASS,(char *)"cclib",params,GAMES_PORT)) != 0 )
|
||||
{
|
||||
if ( (retjson= cJSON_Parse(retstr)) != 0 )
|
||||
{
|
||||
if ( (resobj= jobj(retjson,(char *)"result")) != 0 )
|
||||
{
|
||||
retval = 0;
|
||||
if ( fp != 0 )
|
||||
{
|
||||
fprintf(fp,"%s\n",jprint(resobj,0));
|
||||
fflush(fp);
|
||||
}
|
||||
}
|
||||
free_json(retjson);
|
||||
} else fprintf(fp,"error parsing %s\n",retstr);
|
||||
free(retstr);
|
||||
} else fprintf(fp,"error issuing method %s\n",params);
|
||||
return(retval);
|
||||
}
|
||||
|
||||
char *clonestr(char *str)
|
||||
{
|
||||
char *clone; int32_t len;
|
||||
if ( str == 0 || str[0] == 0 )
|
||||
{
|
||||
printf("warning cloning nullstr.%p\n",str);
|
||||
#ifdef __APPLE__
|
||||
while ( 1 ) sleep(1);
|
||||
#endif
|
||||
str = (char *)"<nullstr>";
|
||||
}
|
||||
len = strlen(str);
|
||||
clone = (char *)calloc(1,len+16);
|
||||
strcpy(clone,str);
|
||||
return(clone);
|
||||
}
|
||||
|
||||
int tetris(int argc, char **argv)
|
||||
{
|
||||
struct games_state *rs = &globalR;
|
||||
|
||||
@@ -19,12 +19,12 @@ int32_t games_isvalidgame(struct CCcontract_info *cp,int32_t &gameheight,CTransa
|
||||
uint64_t games_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256 gametxid,char *mygamesaddr);
|
||||
|
||||
// game specific code for daemon
|
||||
|
||||
/*void games_packitemstr(char *packitemstr,struct games_packitem *item)
|
||||
void games_packitemstr(char *packitemstr,struct games_packitem *item)
|
||||
{
|
||||
sprintf(packitemstr,"not yet");
|
||||
}
|
||||
|
||||
/*
|
||||
int32_t games_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t num,struct games_player *player,int32_t sleepmillis) // replay in daemon
|
||||
{
|
||||
return(0);
|
||||
|
||||
Reference in New Issue
Block a user