In my most recent game, China is my vassal, and they are shown as voting for me, yet they voted for Justinian I to win Diplomatic Victory -- and they were at war! Of course, I DoWed on Justinian I, and Qin had never been angry with him until the war, but that makes no sense. I thought the code posted above says that an AI will always vote for its master.
Do you have the save from the turn before that? For some reason when I run that autosave, the breakpoint I set at the start of CvPlayerAI::AI_diploVote() never gets tripped so the AIs must have voted before the Autosave happened.
Anyhow, I believe the reason Qin votes for Justinian is because Justinian is the only actual candidate. He'd be forced to vote for EF if EF was running, but the only choices were Justinian or Abstain and so his vassalage makes no difference. As long as his hidden modifiers put him up to +7 or more then Justinian would get the vote.
So we're back to the question of how exactly the candidates are chosen and I guess we need to revisit that.
OK, that's it then. Qin's true attitude towards Justinian is 8 and so since he's not forced to vote for you (as you aren't a candidate), he winds up voting for Justinian.
Going over the way voting is handled in the SDK, a better way of determining candidates might be the following:
Code:
# determine the two candidates, add to header
lCandidates = []
for j in range(gc.getMAX_TEAMS()):
pTeam = gc.getTeam(j)
if pTeam.isAlive() and gc.getGame().isTeamVoteEligible(j,i):
lCandidates.append(j)
iCandidate1 = -1
iCandidate2 = -1
if (len(lCandidates) > 0):
iCandidate1 = lCandidates[0]
if (len(lCandidates) > 1):
iCandidate2 = lCandidates[1]
I expect there are probably better ways to do the second half of that (following the loop) but that hack works in very brief testing. We (i.e. Ruff ) would then have to change self.getCandStatusandName to use the passed argument as a teamID instead of a player ID. And then handle -1 gracefully as a placeholder for a missing candidate wherever necessary.
The candidate issue is still wrong in the current version of BUG. I was playing a game the other day - I had built the AP and was Pope when I swapped to 'free religion'. This triggered an election between me and ?? (Hannibal I think). However, going to F8 after Hannibal won showed Hannibal and someone else - based on population and AP religion status.
Q: Who are the candidates for Pope? A (AFAIK): The builder of the AP and the player with the most votes. But what about member status - do they both have to be members?
Q: Who are the candidates for Diplo-victory? A (AFAIK): The Pope v the builder (if that player isn't the pope) or the Pope v the player with the most votes. But what about member status - do they both have to be members?
Does anyone know the real answers to these questions?
I pretty much ignore the AP except for the +2 it offers for SR buildings, so I cannot answer most of those questions. I would expect that you'd have to be a full member to be eligible for Pope or Diplomatic Victory, and I thought FR dropped you to voting member status, but I guess not.
However, AFAIK everyone is a member of the UN, so there are always two possible candidates: the builder and the person with the highest (or 2nd highest) population (# of votes).
I don't understand exactly how the candidates are chosen, but I've come to believe that it doesn't matter because we can make the game tell us the candidates through using CyGame.isTeamVoteEligible(). I think an algorithm similar to the one I posted above is the best way to go.
I've just done an almost complete re-write of the members tab. There are now two toggles; one that swap between the UN and the AP (only if both active at the same time) on the bottom left of the screen; the other swaps between Pope and Diplo victory vote (bottom right of the screen).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.