#6724 closed defect (fixed)
Requirement tooltip errors for Ptolemaic barracks
Reported by: | Langbart | Owned by: | Freagarach |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 27 |
Component: | Core engine | Keywords: | |
Cc: | Patch: |
Description
to reproduce
- start map with
ptol
- build && select a
Barrack
- errors
- the
Royal Guard Infantry
has two requirementsphase_city
andunlock_champion_infantry
errors
ERROR: JavaScript error: gui/common/l10n.js line 69 Script value conversion check failed: v.isString() || v.isNumber() || v.isBoolean() (got type undefined) translate@gui/common/l10n.js:69:36 getRequirementsTooltip@gui/common/tooltips.js:975:23 setupButton@gui/session/selection_panels.js:1051:4 setupUnitPanel@gui/session/unit_commands.js:94:35 updateUnitCommands@gui/session/unit_commands.js:152:18 updateSelectionDetails@gui/session/selection_details.js:537:20 updateGUIObjects@gui/session/session.js:730:2 onSimulationUpdate@gui/session/session.js:680:2 __eventhandler6 (SimulationUpdate)@session SimulationUpdate:1:1 ERROR: Errors executing script event "SimulationUpdate"
bisect
likley [27245]
possible solution
-
binaries/data/mods/public/simulation/templates/units/ptol/champion_infantry_pikeman.xml
a b 8 8 <Icon>units/ptol/champion_infantry.png</Icon> 9 9 <Requirements> 10 10 <Techs datatype="tokens">unlock_champion_infantry</Techs> 11 <Tooltip>Ask Freagarach</Tooltip> 11 12 </Requirements> 12 13 </Identity> 13 14 <VisualActor>
related ticket to requirement feature
Change History (7)
comment:1 by , 15 months ago
comment:3 by , 15 months ago
okay, this works. other templates do it like this:
sele/champion_infantry_swordsman.xml
Line | |
---|---|
7 | <SpecificName>Thorakitès Rhomaïkós</SpecificName> |
8 | <Icon>units/sele/champion_swordsman.png</Icon> |
9 | <Requirements> |
10 | <Techs datatype="tokens">-phase_city reformed_army_sele</Techs> |
11 | </Requirements> |
12 | </Identity> |
13 | <VisualActor> |
I'm more concerned about how to spot this issue before it's released, I just happened to stumble across it, it severely affects gameplay, even partially prevents the production of new units in completely different buildings.
comment:4 by , 15 months ago
Yeah, we can either remove the datatype (so it doesn't merge the tokens) or remove the earlier tech. The latter might be better.
It is indeed hard to spot, I've manually checked the templates before [27505], but playing reveals them more easily.
comment:5 by , 15 months ago
If you play latest delenda est
it suffers from the same problem. Simply selecting the soldier disables the game.
- fresh commit ~13hrs ago JustusAvramenko/delenda_est - Requirement fixes - e65aa59
warning ?
-
binaries/data/mods/public/gui/common/tooltips.js
a b function getRequirementsTooltip(enabled, requirements, civ) 972 972 return objectionFont(sprintf(translate("Requires %(technology)s"), { 973 973 "technology": getEntityNames(GetTechnologyData(requirements.Techs._string, civ)) 974 974 })); 975 return objectionFont(translate(requirements.Tooltip)); 975 if ("Tooltip" in requirements) 976 return objectionFont(translate(requirements.Tooltip)); 977 return warn(`Multiple Tech requirements found - ${requirements.Techs._string.replace(/\s/,",")}, but no "<Tooltip>...</Tooltip>" specified`) 976 978 } 977 979 978 980 /**
EDIT:
- at least check for
undefined
Always check for undefined properties and/or invalid object references, if it's possible they could occur.
[27505] I'll commit the proposed fix. ;P
Hmm maybe not.