From 125dee848047d36e26db49b74909637de1f9ad37 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 6 Feb 2019 03:00:52 -1100 Subject: [PATCH] Fixes --- src/cc/rogue/rogue.h | 5 ++++- src/cc/rogue_rpc.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/cc/rogue/rogue.h b/src/cc/rogue/rogue.h index 34df75058..189884f26 100644 --- a/src/cc/rogue/rogue.h +++ b/src/cc/rogue/rogue.h @@ -313,17 +313,20 @@ /* * Now we define the structures and types */ +#ifndef rogue_packitem struct rogue_packitem { int32_t type,launch,count,which,hplus,dplus,arm,flags,group; char damage[8],hurldmg[8]; }; - +#endif +#ifndef rogue_player struct rogue_player { int32_t gold,hitpoints,strength,level,experience,packsize,dungeonlevel,pad; struct rogue_packitem roguepack[MAXPACK]; }; +#endif struct rogue_state { diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index 823d374b5..28cdf7964 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -282,7 +282,7 @@ int32_t rogue_iterateplayer(uint256 firsttxid,uint256 lasttxid) // retrace p int32_t rogue_playerdata(struct CCcontract_info *cp,uint256 &origplayergame,CPubKey &pk,std::vector &playerdata,uint256 playertxid) { - uint256 origplayertxid,hashBlock,highlander,registertxid; CTransaction gametx,playertx,highlandertx; std::vector vopret; uint8_t *script,e,f; int32_t i,numvouts,maxplayers; int64_t buyin; + uint256 origplayertxid,hashBlock,highlander; CTransaction gametx,playertx,highlandertx; std::vector vopret; uint8_t *script,e,f; int32_t i,numvouts,maxplayers; int64_t buyin; if ( GetTransaction(playertxid,playertx,hashBlock,false) != 0 && (numvouts= playertx.vout.size()) > 0 ) { GetOpReturnData(playertx.vout[numvouts-1].scriptPubKey,vopret); @@ -296,7 +296,7 @@ int32_t rogue_playerdata(struct CCcontract_info *cp,uint256 &origplayergame,CPub { if ( GetTransaction(highlander,highlandertx,hashBlock,false) != 0 && (numvouts= highlandertx.vout.size()) > 0 ) { - if ( (f= rogue_highlanderopretdecode(origplayergame,registertxid,pk,playerdata,highlandertx.vout[numvouts-1].scriptPubKey)) == 'H' || f == 'Q' ) + if ( (f= rogue_highlanderopretdecode(origplayergame,pk,playerdata,highlandertx.vout[numvouts-1].scriptPubKey)) == 'H' || f == 'Q' ) { if ( highlandertx.vin[0].prevout.hash == origplayergame && highlandertx.vin[0].prevout.n == 0 && rogue_isvalidgame(cp,gametx,buyin,maxplayers,origplayergame) == 0 && maxplayers > 1 ) return(0); @@ -639,7 +639,7 @@ UniValue rogue_bailout(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) // vout0 -> 1% ingame gold // get any playerdata, get all keystrokes, replay game and compare final state CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); - UniValue result(UniValue::VOBJ); std::string rawtx; CTransaction gametx; int64_t buyin,batonvalue; int32_t i,n,num,numkeys,maxplayers,batonht,batonvout; char myrogueaddr[64],*keystrokes = 0; std::vector playerdata,newdata; uint256 batontxid,gametxid; CPubKey mypk,roguepk; uint8_t player[10000],mypriv[32]; + UniValue result(UniValue::VOBJ); std::string rawtx; CTransaction gametx; uint64_t seed; int64_t buyin,batonvalue; int32_t i,n,num,numkeys,maxplayers,batonht,batonvout; char destaddr[64],myrogueaddr[64],*keystrokes = 0; std::vector playerdata,newdata; uint256 batontxid,gametxid; CPubKey mypk,roguepk; uint8_t player[10000],mypriv[32]; if ( txfee == 0 ) txfee = 10000; mypk = pubkey2pk(Mypubkey()); @@ -678,7 +678,7 @@ UniValue rogue_bailout(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) newdata[i] = player[i]; ((uint8_t *)&P)[i] = player[i]; } - fprintf(stderr,"gold.%d hp.%d strength.%d level.%d exp.%d %d dl.%d\n",P.gold,P.hitpoints,P.strength,P.level,P.experience,P.dungeonlevel); + fprintf(stderr,"gold.%d hp.%d strength.%d level.%d exp.%d dl.%d\n",P.gold,P.hitpoints,P.strength,P.level,P.experience,P.dungeonlevel); mtx.vout.push_back(CTxOut(P.gold*1000000,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG)); //for (i=0; i_o._o_type,o->_o._o_packch,o->_o._o_packch);