Resultjson

This commit is contained in:
jl777
2019-02-20 23:32:23 -11:00
parent 13ba8a70ca
commit 89e375e95d
2 changed files with 5 additions and 5 deletions

View File

@@ -148,7 +148,7 @@ cJSON *cclib_reparse(int32_t *nump,char *jsonstr) // assumes origparams will be
}
newstr[j] = 0;
params = cJSON_Parse(newstr);
if ( 1 && params != 0 )
if ( 0 && params != 0 )
printf("new.(%s) -> %s\n",newstr,jprint(params,0));
free(newstr);
*nump = cJSON_GetArraySize(params);

View File

@@ -727,7 +727,7 @@ void rogue_progress(struct rogue_state *rs,uint64_t seed,char *keystrokes,int32_
int32_t rogue_setplayerdata(struct rogue_state *rs,char *gametxidstr)
{
char cmd[32768]; int32_t i,n,retval=-1; char params[1024],*filestr=0,*pname,*statusstr,*datastr,fname[128]; long allocsize; cJSON *retjson,*array,*item;
char cmd[32768]; int32_t i,n,retval=-1; char params[1024],*filestr=0,*pname,*statusstr,*datastr,fname[128]; long allocsize; cJSON *retjson,*array,*item,*resultjson;
if ( rs->guiflag == 0 )
return(-1);
if ( gametxidstr == 0 || *gametxidstr == 0 )
@@ -747,10 +747,10 @@ int32_t rogue_setplayerdata(struct rogue_state *rs,char *gametxidstr)
}
if ( filestr != 0 )
{
fprintf(stderr,"gameinfo.(%s)\n",filestr);
if ( (retjson= cJSON_Parse(filestr)) != 0 )
if ( (retjson= cJSON_Parse(filestr)) != 0 && (resultjson= jitem(retjson,"result")) != 0 )
{
if ( (array= jarray(&n,retjson,"players")) != 0 )
fprintf(stderr,"gameinfo.(%s)\n",jprint(resultjson,0));
if ( (array= jarray(&n,resultjson,"players")) != 0 )
{
for (i=0; i<n; i++)
{