Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f896534845
  1. 1
      iguana/SuperNET.c
  2. 2
      iguana/SuperNET_category.c
  3. 1
      iguana/pangea777.h
  4. 5
      iguana/pangea_api.c
  5. 9
      iguana/pangea_json.c

1
iguana/SuperNET.c

@ -31,6 +31,7 @@ cJSON *SuperNET_argjson(cJSON *json)
jdelete(argjson,"check");
jdelete(argjson,"yourip");
jdelete(argjson,"myip");
jdelete(argjson,"myipaddr");
return(argjson);
}

2
iguana/SuperNET_category.c

@ -165,7 +165,7 @@ char *SuperNET_categorymulticast(struct supernet_info *myinfo,int32_t surveyflag
{
char *hexmsg,*retstr; int32_t len;
len = (int32_t)strlen(message);
char str[65]; printf("multicast.(%s)\n",bits256_str(str,categoryhash));
//char str[65]; printf("multicast.(%s)\n",bits256_str(str,categoryhash));
if ( is_hexstr(message,len) == 0 )
{
hexmsg = malloc((len << 1) + 1);

1
iguana/pangea777.h

@ -163,6 +163,7 @@ void pangea_gamecreate(struct game_info *gp,uint32_t timestamp,bits256 tablehash
int32_t pangea_playerparse(struct player_info *p,cJSON *json);
int32_t pangea_newdeck(struct supernet_info *myinfo,struct table_info *tp);
int32_t pangea_tableismine(struct supernet_info *myinfo,struct table_info *tp);
void pangea_playeradd(struct supernet_info *myinfo,struct table_info *tp,struct player_info *p,cJSON *json);
void pangea_checkantes(struct supernet_info *myinfo,struct table_info *tp);
int32_t pangea_bet(struct supernet_info *myinfo,struct table_info *tp,struct player_info *player,int64_t bet,int32_t action);

5
iguana/pangea_api.c

@ -145,12 +145,15 @@ char *pangea_jsondatacmd(struct supernet_info *myinfo,bits256 tablehash,struct p
jaddstr(argjson,"myipaddr",myinfo->ipaddr);
jaddbits256(argjson,"categoryhash",pangeahash);
jaddbits256(argjson,"subhash",tablehash);
jaddbits256(argjson,"playerpub",myinfo->myaddr.persistent);
jaddstr(argjson,"handle",jstr(json,"handle"));
reqstr = jprint(argjson,1);
datalen = (int32_t)(strlen(reqstr) + 1);
memcpy(pm->serialized,reqstr,datalen);
free(reqstr);
if ( pangea_msgcreate(myinfo,tablehash,pm,datalen) != 0 )
{
printf("pangea send.(%s)\n",cmdstr);
init_hexbytes_noT(hexstr,(uint8_t *)pm,pm->sig.allocsize);
return(SuperNET_categorymulticast(myinfo,0,pangeahash,tablehash,hexstr,0,2,1));
} else return(clonestr("{\"error\":\"couldnt create pangea message\"}"));
@ -267,6 +270,8 @@ void pangea_tablejoin(PANGEA_HANDARGS)
break;
if ( i == tp->G.numactive )
{
pangea_playeradd(myinfo,tp,&tp->G.P[tp->G.numactive++],json);
printf("add player.%d\n",i);
pangea_jsondatacmd(myinfo,pm->tablehash,(struct pangea_msghdr *)space,json,"accept",myinfo->ipaddr);
} else printf("duplicate player.%llu\n",(long long)pm->sig.signer64bits);
printf("my table! ");

9
iguana/pangea_json.c

@ -15,6 +15,15 @@
#include "pangea777.h"
void pangea_playeradd(struct supernet_info *myinfo,struct table_info *tp,struct player_info *p,cJSON *json)
{
p->playerpub = jbits256(json,"playerpub");
p->ipbits = calc_ipbits(jstr(json,"myipaddr"));
safecopy(p->handle,jstr(json,"handle"),sizeof(p->handle));
p->balance = 100 * SATOSHIDEN;
p->nxt64bits = acct777_nxt64bits(p->playerpub);
}
cJSON *pangea_tablejson(struct game_info *gp)
{
char ipaddr[64],str[64]; struct tai t; int32_t seconds; cJSON *json = cJSON_CreateObject();

Loading…
Cancel
Save