@ -927,7 +927,7 @@ int32_t games_findbaton(struct CCcontract_info *cp,uint256 &playertxid,gameseven
* keystrokesp = 0 ;
for ( i = 0 ; i < maxplayers ; i + + )
{
//fprintf(stderr,"findbaton.%d of %d\n",i,maxplayers);
fprintf ( stderr , " findbaton.%d of %d \n " , i , maxplayers ) ;
if ( myIsutxo_spent ( spenttxid , gametxid , i + 1 ) > = 0 )
{
if ( myGetTransaction ( spenttxid , spenttx , hashBlock ) ! = 0 & & spenttx . vout . size ( ) > 0 )
@ -946,17 +946,17 @@ int32_t games_findbaton(struct CCcontract_info *cp,uint256 &playertxid,gameseven
if ( matches = = 1 )
{
numvouts = matchtx . vout . size ( ) ;
//fprintf(stderr,"matchtxid.%s matches.%d numvouts.%d\n",matchtx.GetHash().GetHex().c_str(),matches,numvouts);
fprintf ( stderr , " matchtxid.%s matches.%d numvouts.%d \n " , matchtx . GetHash ( ) . GetHex ( ) . c_str ( ) , matches , numvouts ) ;
if ( games_registeropretdecode ( txid , tokenid , playertxid , matchtx . vout [ numvouts - 1 ] . scriptPubKey ) = = ' R ' ) //&& txid == gametxid )
{
//fprintf(stderr,"tokenid.%s txid.%s vs gametxid.%s player.%s\n",tokenid.GetHex().c_str(),txid.GetHex().c_str(),gametxid.GetHex().c_str(),playertxid.GetHex().c_str());
fprintf ( stderr , " tokenid.%s txid.%s vs gametxid.%s player.%s \n " , tokenid . GetHex ( ) . c_str ( ) , txid . GetHex ( ) . c_str ( ) , gametxid . GetHex ( ) . c_str ( ) , playertxid . GetHex ( ) . c_str ( ) ) ;
if ( tokenid ! = zeroid )
active = tokenid ;
else active = playertxid ;
if ( active = = zeroid | | games_playerdata ( cp , origplayergame , tid , pk , playerdata , symbol , pname , active ) = = 0 )
{
txid = matchtx . GetHash ( ) ;
//fprintf(stderr,"scan forward active.%s spenttxid.%s\n",active.GetHex().c_str(),txid.GetHex().c_str());
fprintf ( stderr , " scan forward active.%s spenttxid.%s \n " , active . GetHex ( ) . c_str ( ) , txid . GetHex ( ) . c_str ( ) ) ;
n = 0 ;
while ( CCgettxout ( txid , 0 , 1 , 0 ) < 0 )
{
@ -973,7 +973,7 @@ int32_t games_findbaton(struct CCcontract_info *cp,uint256 &playertxid,gameseven
}
}
txid = spenttxid ;
//fprintf(stderr,"n.%d next txid.%s/v%d\n",n,txid.GetHex().c_str(),spentvini);
fprintf ( stderr , " n.%d next txid.%s/v%d \n " , n , txid . GetHex ( ) . c_str ( ) , spentvini ) ;
if ( spentvini ! = 0 ) // game is over?
{
return ( 0 ) ;
@ -994,17 +994,17 @@ int32_t games_findbaton(struct CCcontract_info *cp,uint256 &playertxid,gameseven
}
numkeys + = ( int32_t ) k . size ( ) / sizeof ( gamesevent ) ;
( * keystrokesp ) = keystrokes ;
//fprintf(stderr,"updated keystrokes.%p[%d]\n",keystrokes,numkeys);
fprintf ( stderr , " updated keystrokes.%p[%d] \n " , keystrokes , numkeys ) ;
}
}
//fprintf(stderr,"n.%d txid.%s\n",n,txid.GetHex().c_str());
fprintf ( stderr , " n.%d txid.%s \n " , n , txid . GetHex ( ) . c_str ( ) ) ;
if ( + + n > = GAMES_MAXITERATIONS )
{
fprintf ( stderr , " games_findbaton n.%d, seems something is wrong \n " , n ) ;
return ( - 5 ) ;
}
}
//fprintf(stderr,"set baton %s\n",txid.GetHex().c_str());
fprintf ( stderr , " set baton %s \n " , txid . GetHex ( ) . c_str ( ) ) ;
batontxid = txid ;
batonvout = 0 ; // not vini
// how to detect timeout, bailedout, highlander
@ -1017,7 +1017,7 @@ int32_t games_findbaton(struct CCcontract_info *cp,uint256 &playertxid,gameseven
return ( - 4 ) ;
else batonht = pindex - > GetHeight ( ) ;
batonvalue = batontx . vout [ 0 ] . nValue ;
//printf("batonht.%d keystrokes[%d]\n",batonht,numkeys);
printf ( " batonht.%d keystrokes[%d] \n " , batonht , numkeys ) ;
return ( 0 ) ;
} else fprintf ( stderr , " couldnt find baton \n " ) ;
} else fprintf ( stderr , " error with playerdata \n " ) ;