Opened 5 years ago
Closed 4 years ago
#5625 closed defect (fixed)
Petra tribute & diplomacy request yields undefined evt.amounts[request.type]
Reported by: | elexis | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 24 |
Component: | AI | Keywords: | |
Cc: | Patch: | Phab:D2703 |
Description
In this very short replay for r23076, the following error occurred after spamming tributes and friend requests to the opposing AI:
Turn 192 (500)... WARNING: JavaScript warning: simulation/ai/petra/diplomacyManager.js line 136 reference to undefined property evt.amounts[request.type]
Adding the following debug print:
Index: binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js =================================================================== --- binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js (revision 23075) +++ binaries/data/mods/public/simulation/ai/petra/diplomacyManager.js (working copy) @@ -131,10 +131,12 @@ PETRA.DiplomacyManager.prototype.checkEv if (evt.to === PlayerID && !gameState.isPlayerAlly(evt.from) && this.receivedDiplomacyRequests.has(evt.from)) { let request = this.receivedDiplomacyRequests.get(evt.from); if (request.status === "waitingForTribute") { + warn(uneval(evt)); + warn(uneval(request)); request.wanted -= evt.amounts[request.type]; if (request.wanted <= 0) { if (this.Config.debug > 1)
yields:
WARNING: ({to:6, from:1, amounts:{food:500}}) WARNING: ({status:"waitingForTribute", wanted:1000, type:"wood", warnTime:152, sentWarning:false, requestType:"neutral"}) WARNING: JavaScript warning: simulation/ai/petra/diplomacyManager.js line 138 reference to undefined property evt.amounts[request.type] WARNING: ({to:6, from:1, amounts:{metal:500}}) WARNING: ({status:"waitingForTribute", wanted:NaN, type:"wood", warnTime:152, sentWarning:false, requestType:"neutral"})
Attachments (1)
Change History (6)
by , 5 years ago
Attachment: | commands.txt added |
---|
comment:1 by , 5 years ago
comment:4 by , 4 years ago
Milestone: | Backlog → Work In Progress |
---|---|
Patch: | → Phab:D2703 |
comment:5 by , 4 years ago
Milestone: | Work In Progress → Alpha 24 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
[PetraAI] - Only try to subtract resource gift from "waitingfortribute" if gift contains required resource.
Check for existance of requested type in event message, since rP23065 stoped sending resource codes with 0 tribute and that was not even guaranteed to get before through another options how to trigger tribute event.
Differential Revision: https://code.wildfiregames.com/D2703 Patch by: Freagarach Reviewed by: Angen Comments by: elexis
Note:
See TracTickets
for help on using tickets.
Refs: https://code.wildfiregames.com/rP22970