From 81006ce271fc91f09abe725c580ea8d1acc030f5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 25 Mar 2019 11:50:08 -1100 Subject: [PATCH] Match rogue roc --- src/cc/gamescc.cpp | 6 +++--- src/cc/gamescc.h | 37 ++++++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/cc/gamescc.cpp b/src/cc/gamescc.cpp index b355584db..758d2fc78 100644 --- a/src/cc/gamescc.cpp +++ b/src/cc/gamescc.cpp @@ -964,7 +964,7 @@ void games_gameplayerinfo(struct CCcontract_info *cp,UniValue &obj,uint256 gamet } else fprintf(stderr,"findbaton err.%d\n",retval); } -UniValue games_create(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) +UniValue games_newgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) { CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); UniValue result(UniValue::VOBJ); std::string rawtx; CPubKey gamespk,mypk; char *jsonstr; uint64_t inputsum,change,required,buyin=0; int32_t i,n,maxplayers = 1; @@ -1030,7 +1030,7 @@ UniValue games_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) return(result); } -UniValue games_info(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) +UniValue games_gameinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) { UniValue result(UniValue::VOBJ),a(UniValue::VARR); int32_t i,n,gameheight,maxplayers,numvouts; uint256 txid; CTransaction tx; int64_t buyin; uint64_t seed; bits256 t; char myaddr[64],str[64]; CPubKey mypk,gamespk; result.push_back(Pair("name","games")); @@ -1599,7 +1599,7 @@ UniValue games_players(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) return(result); } -UniValue games_list(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) +UniValue games_games(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) { UniValue result(UniValue::VOBJ),a(UniValue::VARR),b(UniValue::VARR); uint256 txid,hashBlock,gametxid,tokenid,playertxid; int32_t vout,maxplayers,gameheight,numvouts; CPubKey gamespk,mypk; char coinaddr[64]; CTransaction tx,gametx; int64_t buyin; std::vector > addressIndex; diff --git a/src/cc/gamescc.h b/src/cc/gamescc.h index 034fee044..19e5f8d26 100644 --- a/src/cc/gamescc.h +++ b/src/cc/gamescc.h @@ -35,29 +35,28 @@ std::string Games_pname; { (char *)MYCCNAME, (char *)"rng", (char *)"hash,playerid", 1, 2, ' ', EVAL_GAMES }, \ { (char *)MYCCNAME, (char *)"rngnext", (char *)"seed", 1, 1, ' ', EVAL_GAMES }, \ { (char *)MYCCNAME, (char *)"players", (char *)"no params", 0, 0, ' ', EVAL_GAMES }, \ - { (char *)MYCCNAME, (char *)"list", (char *)"no params", 0, 0, ' ', EVAL_GAMES }, \ + { (char *)MYCCNAME, (char *)"games", (char *)"no params", 0, 0, ' ', EVAL_GAMES }, \ { (char *)MYCCNAME, (char *)"pending", (char *)"no params", 0, 0, ' ', EVAL_GAMES }, \ { (char *)MYCCNAME, (char *)"setname", (char *)"pname", 1, 1, ' ', EVAL_GAMES }, \ - { (char *)MYCCNAME, (char *)"create", (char *)"maxplayers,buyin", 2, 2, 'C', EVAL_GAMES }, \ + { (char *)MYCCNAME, (char *)"newgame", (char *)"maxplayers,buyin", 2, 2, 'C', EVAL_GAMES }, \ { (char *)MYCCNAME, (char *)"playerinfo", (char *)"playertxid", 1, 1, ' ', EVAL_GAMES }, \ - { (char *)MYCCNAME, (char *)"info", (char *)"gametxid", 1, 1, ' ', EVAL_GAMES }, \ + { (char *)MYCCNAME, (char *)"gameinfo", (char *)"gametxid", 1, 1, ' ', EVAL_GAMES }, \ { (char *)MYCCNAME, (char *)"keystrokes", (char *)"txid,hexstr", 2, 2, 'K', EVAL_GAMES }, \ { (char *)MYCCNAME, (char *)"finish", (char *)"gametxid", 1, 1, 'Q', EVAL_GAMES }, \ { (char *)MYCCNAME, (char *)"events", (char *)"eventshex [gametxid [eventid]]", 1, 3, ' ', EVAL_GAMES }, \ { (char *)MYCCNAME, (char *)"extract", (char *)"gametxid [pubkey]", 1, 2, ' ', EVAL_GAMES }, \ { (char *)MYCCNAME, (char *)"register", (char *)"gametxid [playertxid]", 1, 2, 'R', EVAL_GAMES }, - bool games_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx); UniValue games_rng(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); UniValue games_rngnext(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); UniValue games_players(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); -UniValue games_list(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); +UniValue games_games(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); UniValue games_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); UniValue games_setname(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); -UniValue games_create(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); +UniValue games_newgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); UniValue games_playerinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); -UniValue games_info(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); +UniValue games_gameinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); UniValue games_keystrokes(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); UniValue games_finish(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); UniValue games_events(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); @@ -71,14 +70,30 @@ if ( cp->evalcode == EVAL_GAMES ) \ return(games_rng(txfee,cp,params)); \ else if ( strcmp(method,"rngnext") == 0 ) \ return(games_rngnext(txfee,cp,params)); \ - else if ( strcmp(method,"create") == 0 ) \ - return(games_create(txfee,cp,params)); \ - else if ( strcmp(method,"info") == 0 ) \ - return(games_info(txfee,cp,params)); \ + else if ( strcmp(method,"newgame") == 0 ) \ + return(games_newgame(txfee,cp,params)); \ + else if ( strcmp(method,"gameinfo") == 0 ) \ + return(games_gameinfo(txfee,cp,params)); \ else if ( strcmp(method,"register") == 0 ) \ return(games_register(txfee,cp,params)); \ else if ( strcmp(method,"events") == 0 ) \ return(games_events(txfee,cp,params)); \ + else if ( strcmp(method,"players") == 0 ) \ + return(games_players(txfee,cp,params)); \ + else if ( strcmp(method,"games") == 0 ) \ + return(games_games(txfee,cp,params)); \ + else if ( strcmp(method,"pending") == 0 ) \ + return(games_pending(txfee,cp,params)); \ + else if ( strcmp(method,"setname") == 0 ) \ + return(games_setname(txfee,cp,params)); \ + else if ( strcmp(method,"playerinfo") == 0 ) \ + return(games_playerinfo(txfee,cp,params)); \ + else if ( strcmp(method,"keystrokes") == 0 ) \ + return(games_keystrokes(txfee,cp,params)); \ + else if ( strcmp(method,"extract") == 0 ) \ + return(games_extract(txfee,cp,params)); \ + else if ( strcmp(method,"finish") == 0 ) \ + return(games_finish(txfee,cp,params)); \ else \ { \ result.push_back(Pair("result","error")); \