Expedition tab in Port window messed up some times

Bug #1658489 reported by Klaus Halfmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Undecided
Unassigned

Bug Description

Firt auktionadmin alone, then together with Worlsavior found this bug:

... in unserem gestrigen Spiel auf fjord islands, habe ich gestern im Spiel mit WorldSavior herausgefunden was der "Bug" mit dem Hafenfenster war: Wenn Baustoffe dem Hafen zugeführt werden, klappt das Expedition Fenster zu und dann steht da plötzlich wieder "Expedition starten", obwohl die Expedition ja schon gestartet ist und deshalb dachte ich gestern, dass ein Expeditions Schiff bereits fertig sein müsste. Du wolltest es ja herausfinden gestern. Aber nur mit meiner Erklärung, kannst du glaube ich das verifizieren. Das Fenster ist der Bug.

This should translate to "... When the port gets new wares the expedition window (tab?) closes and the 'Start Expedition' Button reappears, this is inonsitent has No expedition Ship was equipped menawhile, lokks like there is a Bug in that Port Windows/Expedition tab."

Ill try to approve this now with r19 and then trunk.

Related branches

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Mhh, was not able to reproduce this after this description,
must ask auktionamdin for more details

GunChleoc (gunchleoc)
tags: added: economy seafaring ui
Revision history for this message
auktionadmin (auktionadmin) wrote :

[URL=http://www.directupload.net][IMG]http://fs5.directupload.net/images/170122/7lewax6w.png[/IMG][/URL]

After I have opened the port window with the last expedition tab the second tab opened and the expedition seems finished because you can see the button to start a new expedition:

[URL=http://www.directupload.net][IMG]http://fs5.directupload.net/images/170122/ijiynnas.png[/IMG][/URL]

Revision history for this message
auktionadmin (auktionadmin) wrote :
Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Auktioandmin ist using Windows and playing Imperial.
I tried Atlanters. will try again, later.

Revision history for this message
auktionadmin (auktionadmin) wrote :
Revision history for this message
GunChleoc (gunchleoc) wrote :

The screenshots confirm it. Now we still need a way to reproduce this.

Changed in widelands:
status: New → Confirmed
milestone: none → build20-rc1
Revision history for this message
GunChleoc (gunchleoc) wrote :

Do you have a savegame? I don't have a good seafaring savegame at the moment.

Revision history for this message
auktionadmin (auktionadmin) wrote :
Revision history for this message
kaputtnik (franku) wrote :

Can't load the save game with current trunk, but with build19. With build19 i couldn't reproduce this. Opened the port window and the expedition tab. Some wares get added but the window still shows the expedition tab.

What version are you playing?

Changed in widelands:
status: Confirmed → Incomplete
Revision history for this message
kaputtnik (franku) wrote :

I can confirm this now with bzr8259. But i am not able to reproduce this bug.

Changed in widelands:
status: Incomplete → Confirmed
Revision history for this message
auktionadmin (auktionadmin) wrote :

First I played with Hasi50 Fjord Ilands with (please ask Hasi50 whe played, I think b19) when I had this phenomen that the expedition tab closed and it is was shown that I could start a new expedition so I thought one expedition ship is ready. While I played the map The Nile with WorldSaviour next day I realized that the window/tab could be the issue with b19. Yesterday I could load this savegame with Widelands-bzr8243 and b19. Today I tried the savegame with Widelands-bzr8262 but couldn't load.

I said Hasi50 the issue and perhaps he can remember which version we played because he wanted to reproduce.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Hasi50: We played R19, when the bug occured. Ill tried to reproduce with Atlanters on R19 but failed, will try with Imperials, next

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

I played this on that swamp Map as Empire for some two hours. The Portwindwow behaved correctly
all the Time (I normall do not keep those windows open). So I can only blame windows
as difference between us.

Will try that savegame next evening

Revision history for this message
kaputtnik (franku) wrote :

Sorry, my statement was not clear.

It happened to me when i was playing the Nile map. But it happened some times, and some times not, very rarely. It seems to me that it happened when wares are delivered (not all wares for an expedition are in the port stored). The bug never appears when a ready expedition is canceled and immediately started again.

The bug appears randomly, at least i couldn't find specific steps how to reproduce it. I could trigger the bug some times when an expedition is cancelled, wait a bit until some wares for a new expedition are left, start a new expedition.

I am on Linux, playing current trunk. So this is regardless of OS and widelands version.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

OK, I have a scrrenshot and a savegame, but this will not help.

So kaputtnik if you can reproduce this we must narrow down this:
* Is it some ware for the Expedition or something else?
* Is a ship nearby (if yes sink it and check if it still happens)
* Do you keep the window open on the same tab all the time,
  or switch between the otehr tabs, e.g. warehourse?

But we will need someone who knows the code:
* Where and when will this tab disappear?

I assume some condition misfires, maybe we could use a debugger
to put some breakpoint there.

Revision history for this message
kaputtnik (franku) wrote :

Klaus, this happens very rarely. When playing that game i tried to reproduce it often by clicking always 'Cancel expedition', wait, and 'Start new expedition'. But if you do that for about 10 times for one port and the bug does not happen, you get tired of clicking ;)

Revision history for this message
GunChleoc (gunchleoc) wrote :

Had a look at the code - BuildingWindow::create_capsbuttons is reacting on a Widelands::NoteExpeditionCanceled which then calls update_expedition_button(true);

BuildingWindow::create_capsbuttons is called in BuildingWindow::think.

The bug is probably somewhere in that area.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

That code is, hhm, difficult to read. So my fingers started itching to refactor this.
But I have no proper tooling at hand for this, yet. In can only guess ...

In February I have a week of vacation. So I will try to setup an Eclipse CC IDE again (I hope)
meanwhile I will try to reproduce this and maybe get some logs.

Revision history for this message
kaputtnik (franku) wrote :

I can reproduce this now by just waiting:

bzr8256
1. Open the game in #8
2. Go to the port
3. Open the port window and switch to the expedition tab
4. wait... in terminal you may see after a couple of time something like

> Message: adding warehouse for player 7 at (72, 60)
> [...]
> Message: adding warehouse for player 8 at (30, 79)
> 8: Sapphire at 56x 62: explore uphold, visited first time
> 8: Sapphire: new island exploration - direction: 0

With the last message(s) the port shows the described behavior. Additionally, when switching to the wares tab, it looks a bit messed up, because the wares for the expedition are also shown (see attachement).

I tried also to disconnect the port from economy by removing the roads to see if delivering of wares is the culprit, but the bug is also shown then.

summary: - Expedition tab in Port window closes on devlivery of new wares
+ Expedition tab in Port window messed up some times
Revision history for this message
kaputtnik (franku) wrote :

Tested on a different Computer and the output in terminal is different than in my previous post, so the messages in terminal are not related, i think. But the change of the window appears around Gametime 1:17

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

kaputtnick: thanks for your inpout.
I tried to reproduce this now three times on bzr8266[trunk], without success.
Some notes:
 * there are some week AIs
 * Looks like this is a "trading outpost" starting condition.

Ideas:
 * the adding of wares via that lua "trading outpost" logic hits the Port and causes this confusion?
 * The code cofuses some AI Port?

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

kaputtnick: GOT IT! Around that 1:17 gametime!, thanks for you patience.
Last ware delivered was a pillar. I will try to narrow dow this later today

Last logs here:

2: 5 types of ware added to warehouse 1 of 3 (cheating mode)
3: 1 types of ware added to warehouse 2 of 2 (cheating mode)
4: 1 types of ware added to warehouse 2 of 2 (cheating mode)
5: 8 types of ware added to warehouse 2 of 2 (cheating mode)
6: 1 types of ware added to warehouse 1 of 2 (cheating mode)
7: 8 types of ware added to warehouse 2 of 3 (cheating mode)
8: 8 types of ware added to warehouse 2 of 3 (cheating mode)
8: ( 59x 19) expedition spot scoring, colony_scan_area == 34
8: Sunstone at 60x 23: PORTSPACE found, we valued it: 0
8: Sunstone at 60x 23: explore uphold, visited first time

So some other players ship may cause this.
8: Sunstone: continue island circumvention, dir=0
5: King Askandor at 201x198: explore uphold, visited first time
5: King Askandor: new island exploration - direction: 1

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Ahh, there is a much simpler way to provoke this bug.
The attached savegame is from bzr8270[trunk].

* Open the port left of the HQ, start Expedition there, leave Port Window open.
* Open the port righ of the HQ, stop Expedition there, Port window of "left" window changes as described in the Bug.
* When on Pasue this will only happen when game is running again

OK, I now mus find a way to debug this as of Gun hints.
I would assumr the code ist not checking if some Event
actualy affects the currently displayed Port.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Here comes the matching screenshot.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Hello Gun, I made some progress using XCode as a Debugger.
I tracked down the Problem to be be somwhere in:

void ExpeditionBootstrap::cancel(Game& game)
    // TODO klaus.halfman either do this directly _or_ via an event, but not both?

    // Update the user interface
    if (upcast(InteractiveGameBase, igb, warehouse->owner().egbase().get_ibase())) {
 warehouse->refresh_options(*igb);
    }

    Notifications::publish(NoteExpeditionCanceled(this));

Widelands has a bad habit of recreating its UI Elemtens without need.
Xcode has quite some trouble to follow that call into Notifications::publish.

I created a branch at https://code.launchpad.net/~widelands-dev/widelands/bug-1658489-epedition-tab

I would drop the direct calls in favour of the Notifications,
but must fix the error in that ntotofication handler.

Is this as intended?

Revision history for this message
GunChleoc (gunchleoc) wrote :

Your idea in the linked branch looks like it should fix it. I think it doesn't compile because you're not passing the pd to the lambda function. Try this:

    Notifications::subscribe<Widelands::NoteExpeditionCanceled>([this, pd](

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Gun, I tried this but then i had to make some variables and functions const, resulting in a domino effect I cannot oversee, yet. I will try to extract a const Portdock* pd, like you sugeested.

Currently my Job is eating me (10 hours+ yesterday, same today). So I better get some rest tonight.

Revision history for this message
GunChleoc (gunchleoc) wrote :

You could try passing pd->expedition_bootstrap() to the lambda function.

And I hope you did get that rest!

GunChleoc (gunchleoc)
Changed in widelands:
status: Confirmed → Fix Committed
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build20-rc1

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.