Opened 8 years ago

Closed 7 years ago

#4217 closed defect (fixed)

[PATCH] Structure tree shows wrong specific tech names

Reported by: elexis Owned by: s0600204
Priority: Must Have Milestone: Alpha 22
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by Vladislav Belov)

If one opens the tech tree and looks at the name of a tech that has a specific name, change to a civ that has a different (or no) specific name for that tech and then change back, then that tech will display the second civ's specific name (or in the case where the second civ doesn't have one, no specific name at all). F.e. the "Steel Working" upgrade at the blacksmith for iber and maur, or the "Sentries" upgrade belonging to the wooden and stone towers when switching from a hellenic civ to a non-hellenic civ and back again. Bug reported by WarBeast.

Attachments (1)

specificNames.patch (10.4 KB ) - added by s0600204 8 years ago.
Proposed patch

Download all attachments as: .zip

Change History (9)

by s0600204, 8 years ago

Attachment: specificNames.patch added

Proposed patch

comment:1 by s0600204, 8 years ago

Cc: s0600204 removed
Description: modified (diff)
Keywords: patch rfc added
Milestone: BacklogAlpha 21
Owner: set to s0600204
Status: newassigned

comment:2 by elexis, 8 years ago

Milestone: Alpha 21Alpha 22

Feature freeze in 2 days.

comment:3 by elexis, 7 years ago

Milestone: Alpha 22Work In Progress

Moving to the new WIP milestone.

comment:4 by Vladislav Belov, 7 years ago

Description: modified (diff)

Few notes: 1.

if (template.name.specific != template.name.generic)
    return template.name.specific;
else
    return false;

Could be written shorter:

return template.name.specific != template.name.generic ? template.name.specific : false;

2.

if (template.name.specific.generic)
    return template.name.specific.generic;
return false;

The same:

return template.name.specific.generic || false;

comment:5 by Vladislav Belov, 7 years ago

Summary: Structure tree shows wrong specific tech names[PATCH] Structure tree shows wrong specific tech names

comment:6 by elexis, 7 years ago

a ? b : false is equal to a && b.

To also post something about the approach of the patch: Passing a second argument to the tooltip functions, when almost all of them only take one argument (extendedEntityState from GUIInterface that must have the same format as the TemplateData) seems ugly. If some other tooltip function also needs an argument, it would collide. I didn't investigate the bug, but isn't it only in the structure tree? Could we get away with reloading some data when switching the civ in the structure tree?

comment:7 by elexis, 7 years ago

Keywords: rfc removed
Milestone: Work In ProgressAlpha 22

In r19120 by fatherbushido:

Merge different logics of technology requirements and fix the related bugs. Create a global script which derive the technology requirements objects in a form usable for structure tree, gui, simulation and AI. Reviewed by mimo (for AI) and fatherbushido. Fixes #3993, #1646, #4263, #4217. Refs #4108.

In r19121 by fatherbushido:

Add a simulation test to the previous commit of s0600204's patch. Refs #4263.

comment:8 by elexis, 7 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.