Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4728 closed defect (fixed)

Typo in MaxDistance in BuildRestrictions

Reported by: PASilva Owned by: elexis
Priority: Should Have Milestone: Alpha 23
Component: UI & Simulation Keywords:
Cc: Patch:

Description

Hi, using the attached mod, where only the market template is changed by including the following BuildRestrictions:

<BuildRestrictions>
    <Category>Market</Category>
    <Distance>
      <FromClass>CivilCentre</FromClass>
      <MaxDistance>50</MaxDistance>
    </Distance>
  </BuildRestrictions>

it originates the following warning when placing the market:

JavaScript warning:simulation/components/BuildRestrictions.js line 302 reference to undefined property this.template.Distance.MinDistance

If, instead, we use <MinDistance>50</MinDistance> no warning is issued. Except for the warning, the simulation seems to run as expected on either way.

Don't know if this is related to #3529 .

Attachments (1)

strongholds_a22_teste.zip (1.9 KB ) - added by PASilva 7 years ago.
example mod

Download all attachments as: .zip

Change History (4)

by PASilva, 7 years ago

Attachment: strongholds_a22_teste.zip added

example mod

comment:1 by elexis, 7 years ago

Keywords: BuildRestrictions MaxDistance removed
Milestone: BacklogAlpha 23
Priority: Nice to HaveShould Have
Summary: MaxDistance in BuildRestrictions warnsTypo in MaxDistance in BuildRestrictions

Oh, are you kidding me, this is the bug Grugnas has discovered in march in Phab:D276, that I asked him to fix separately few days ago. Since it's a one-liner, going to commit that now.

MinDistance is optional de jure, but the typo in the code tries to read from it when it intended to read from MaxDistance.

Thanks for the ticket, that was missing (considering that the patch went nowhere).

comment:2 by elexis, 7 years ago

Owner: set to elexis
Resolution: fixed
Status: newclosed

In 19997:

Fix copy&paste typo in the BuildRestrictions introduced by rP17398.

Fixes #4728
Refs #3081, D276
Patch By: Grugnas

comment:3 by elexis, 7 years ago

Our templates are also correct and complete, because none use the MaxDistance. (If someone wants to improve it further, adding a test to catch this bug would have been the trve thing to do.)

Note: See TracTickets for help on using tickets.