Ignore:
Timestamp:
01/30/20 16:52:38 (4 years ago)
Author:
bart
Message:

Tournament overview table, few bug fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocol/src/main/java/geniusweb/protocol/session/shaop/SHAOPState.java

    r10 r11  
    4141                        @JsonProperty("settings") SHAOPSettings settings,
    4242                        @JsonProperty("error") ProtocolException e,
    43                         @JsonProperty("actorNr") int actorNr,
     43                        @JsonProperty("teamNr") int teamNr,
    4444                        @JsonProperty("partyNumbers") Map<PartyId, Integer> partytNumbers,
    4545                        @JsonProperty("totalSpent") Map<PartyId, Double> spent) {
    46                 super(actions, conns, progress, settings, e, actorNr, partytNumbers,
     46                super(actions, conns, progress, settings, e, teamNr, partytNumbers,
    4747                                spent);
    4848        }
     
    7373         */
    7474        public boolean isShaopParty(PartyId party) {
    75                 return settings.isShaopParty(partyNumbers.get(party));
     75                return (partyNumbers.get(party) & 1) == 0;
    7676        }
    7777
     
    7979         *
    8080         * @param party a Party Id
    81          * @return the PartyId of the party
     81         * @return the PartyId of the party (COB and SHAOP are partners)
    8282         */
    8383        public PartyId getPartner(PartyId party) {
     
    132132                newNumbers.put(connection.getParty(), connections.size());
    133133                return new SHAOPState(actions, newconns, progress, settings, null,
    134                                 actorNr, newNumbers, totalSpent);
     134                                teamNr, newNumbers, totalSpent);
    135135        }
    136136
     
    144144        public SHAOPState with(ProtocolException e) {
    145145                return new SHAOPState(actions, connections, progress, settings, e,
    146                                 actorNr, partyNumbers, totalSpent);
     146                                teamNr, partyNumbers, totalSpent);
    147147        }
    148148
     
    162162                }
    163163                return new SHAOPState(actions, connections, newprogress, settings,
    164                                 error, actorNr, partyNumbers, totalSpent);
     164                                error, teamNr, partyNumbers, totalSpent);
    165165        }
    166166
     
    259259                List<Action> newactions = new LinkedList<>(getActions());
    260260                newactions.add(action);
    261                 int newActor = actorNr;
     261                int newTeam = teamNr;
    262262                if (action instanceof ElicitComparison) {
    263263                        Object cost = getPartyProfile(partyid).getParty().getParameters()
     
    276276                } else {
    277277                        // shaop party does real action, move to next SHAOP party.
    278                         newActor = (actorNr + 2) % settings.getTeams().size();
     278                        newTeam = (teamNr + 1) % settings.getTeams().size();
    279279                        if (newprogress instanceof ProgressRounds) {
    280280                                newprogress = ((ProgressRounds) newprogress).advance();
     
    282282                }
    283283                return new SHAOPState(newactions, connections, newprogress, settings,
    284                                 null, newActor, partyNumbers, newSpent);
     284                                null, newTeam, partyNumbers, newSpent);
    285285
    286286        }
     
    298298                if (!isShaopParty(actor))
    299299                        throw new IllegalArgumentException(
    300                                         "Illegal action for COB party" + action);
     300                                        "Only SHAOP party can execute " + action);
    301301                // real action only allowed if party has the turn.
    302                 if (!actor.equals(connections.get(actorNr).getParty())) {
     302                if (!actor.equals(connections.get(2 * teamNr).getParty())) {
    303303                        throw new IllegalArgumentException("Party does not have the turn ");
    304304                }
Note: See TracChangeset for help on using the changeset viewer.