private bool GetPermissionToRetryTradeRequest(int currentTurn, TradeOffer trade) { bool permission = false; String key = trade.GenerateTradeKey(); int lastRequestTurn = 0; recentTradeRequests.TryGetValue(key, out lastRequestTurn); // replaces lastRequestTurn w/ value found in dictionary, untouched if key not found if (debugMessages) { GameEngine.print("REQUEST KEY: " + key + "$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$"); GameEngine.print("TURN LAST REQUESTED: " + lastRequestTurn); } if (lastRequestTurn < currentTurn) // request not yet made this turn { if (debugMessages) { GameEngine.print("OVERWRITE KEY; FORMERLY " + lastRequestTurn + ", NOW: " + currentTurn); } if (lastRequestTurn != 0) { recentTradeRequests.Remove(key); } recentTradeRequests.Add(key, currentTurn); permission = true; } else { if (trade.TotalGetResources() > 1) { trade.dropGetCard(); trade.EqualizeTrade(); if (debugMessages) { GameEngine.print("{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{-- REATTEMPT WITH FEWER CARDS REQUESTED --}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"); } permission = GetPermissionToRetryTradeRequest(currentTurn, trade); } } return(permission); }
private bool GetPermissionToRetryTradeRequest(int currentTurn, TradeOffer trade) { bool permission = false; String key = trade.GenerateTradeKey (); int lastRequestTurn = 0; recentTradeRequests.TryGetValue (key, out lastRequestTurn); // replaces lastRequestTurn w/ value found in dictionary, untouched if key not found if(debugMessages) { GameEngine.print ("REQUEST KEY: " + key + "$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$_$"); GameEngine.print ("TURN LAST REQUESTED: " + lastRequestTurn); } if(lastRequestTurn < currentTurn) // request not yet made this turn { if(debugMessages) { GameEngine.print("OVERWRITE KEY; FORMERLY " + lastRequestTurn + ", NOW: " + currentTurn); } if(lastRequestTurn != 0) { recentTradeRequests.Remove(key); } recentTradeRequests.Add(key, currentTurn); permission = true; } else { if(trade.TotalGetResources() > 1) { trade.dropGetCard(); trade.EqualizeTrade(); if(debugMessages) { GameEngine.print ("{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{-- REATTEMPT WITH FEWER CARDS REQUESTED --}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"); } permission = GetPermissionToRetryTradeRequest(currentTurn, trade); } } return permission; }