New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[show_if] is not correctly evaluated when objectives are shown on start #3544

Closed
DisherProject opened this Issue Sep 12, 2018 · 7 comments

Comments

Projects
None yet
4 participants
@DisherProject
Contributor

DisherProject commented Sep 12, 2018

I'm playing Wesnoth 1.14.4 on Windows 10

To reproduce:

  1. Copy the following lines in any scenario (like the "Caves of the Basilisk")
  [event]
       name=prestart
       
       [objectives]
           side=1
           [objective]
               description="Say hello to my little friend"
               condition=win
               [show_if]
                   [have_unit]
                       id=LittleFriend
                   [/have_unit]
               [/show_if]
           [/objective]
           [objective]
               description="No little friend here"
               condition=win
               [show_if]
                   [not]
                       [have_unit]
                           id=LittleFriend
                       [/have_unit]
                   [/not]
               [/show_if]
           [/objective]
       [/objectives]
   [/event]
   
   [event]
       name=start
       
       [unit]
           side=1
           placement=leader
           type=Fire Dragon
           id=LittleFriend
           name= _ "My little friend"
       [/unit]
   [/event]
  1. Start a game in the chosen scenario
  2. Pay attention to the objectives when they are shown for the first time

You'll see "No little friend here" even though the dragon is on the map. If you re-open the objectives dialog (ctrl + J or via the menu) you'll see the the correct sentence

@GregoryLundberg

This comment has been minimized.

Show comment
Hide comment
@GregoryLundberg

GregoryLundberg Sep 12, 2018

Contributor

The Wiki states "Scenario objectives are displayed on the player's first turn after the tag is used, or as part of the event if it triggers during that player's turn."

The prestart event and the start event are both prior to this.

The bug is that the objects [show_if] was evaluated at the time the [objectives] block appeared (in prestart), prior to conditions changing during the start event. So, when the display finally occurs (following the start event), the incorrect objectives appear.

Note that the [show_if] conditions are properly evaluated when [show_objectives] processes.

The fix would seem to be to do the full [show_objectives] processing at the time the objectives should first appear, just prior to the 'turn 1 begin' event,

Contributor

GregoryLundberg commented Sep 12, 2018

The Wiki states "Scenario objectives are displayed on the player's first turn after the tag is used, or as part of the event if it triggers during that player's turn."

The prestart event and the start event are both prior to this.

The bug is that the objects [show_if] was evaluated at the time the [objectives] block appeared (in prestart), prior to conditions changing during the start event. So, when the display finally occurs (following the start event), the incorrect objectives appear.

Note that the [show_if] conditions are properly evaluated when [show_objectives] processes.

The fix would seem to be to do the full [show_objectives] processing at the time the objectives should first appear, just prior to the 'turn 1 begin' event,

jostephd added a commit to jostephd/wesnoth that referenced this issue Sep 12, 2018

jostephd added a commit to jostephd/wesnoth that referenced this issue Sep 12, 2018

GregoryLundberg added a commit that referenced this issue Sep 13, 2018

@jostephd jostephd referenced this issue Sep 13, 2018

Open

Forward port #3514

6 of 15 tasks complete

@sevu sevu added Backport and removed Blocker labels Sep 14, 2018

@sevu sevu modified the milestones: 1.14.5, 1.15.0 Sep 14, 2018

@sevu sevu added Blocker Fwdport and removed Backport labels Sep 14, 2018

@sevu

This comment has been minimized.

Show comment
Hide comment
@sevu

sevu Sep 14, 2018

Member

Fix has been merged to 1.14, but can't directly be applied to master.

Member

sevu commented Sep 14, 2018

Fix has been merged to 1.14, but can't directly be applied to master.

jostephd added a commit to jostephd/wesnoth that referenced this issue Sep 14, 2018

@jostephd

This comment has been minimized.

Show comment
Hide comment
@jostephd

jostephd Sep 14, 2018

Member

Here you go - #3555

Member

jostephd commented Sep 14, 2018

Here you go - #3555

@sevu

This comment has been minimized.

Show comment
Hide comment
@sevu

sevu Sep 14, 2018

Member

Thanks

Member

sevu commented Sep 14, 2018

Thanks

@sevu sevu closed this Sep 14, 2018

@sevu sevu modified the milestones: 1.15.0, 1.14.5 Sep 14, 2018

@sevu

This comment has been minimized.

Show comment
Hide comment
@sevu

sevu Sep 15, 2018

Member

For completeness I would like to mention one thing:
It is in some situations possible to show the objectives earlier by pressing ctrl+j if there is a break in the start event, for example when scrolling to some position.

TSG S4 would be an example.

Member

sevu commented Sep 15, 2018

For completeness I would like to mention one thing:
It is in some situations possible to show the objectives earlier by pressing ctrl+j if there is a break in the start event, for example when scrolling to some position.

TSG S4 would be an example.

@jostephd

This comment has been minimized.

Show comment
Hide comment
@jostephd

jostephd Sep 16, 2018

Member

It is in some situations possible to show the objectives earlier by pressing ctrl+j if there is a break in the start event, for example when scrolling to some position.

This case should be handled correctly both before and after the patch.

Member

jostephd commented Sep 16, 2018

It is in some situations possible to show the objectives earlier by pressing ctrl+j if there is a break in the start event, for example when scrolling to some position.

This case should be handled correctly both before and after the patch.

@sevu

This comment has been minimized.

Show comment
Hide comment
@sevu

sevu Sep 16, 2018

Member

It is

Member

sevu commented Sep 16, 2018

It is

jostephd added a commit to jostephd/wesnoth that referenced this issue Oct 6, 2018

jostephd added a commit to jostephd/wesnoth that referenced this issue Oct 7, 2018

Reevaluate [show_if] conditions and delayed variable expansions befor…
…e displaying objectives at start.

Fixes wesnoth#3544.

(cherry-picked from commit d99f5b8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment