Skip to content
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

After reloading a previous save, Bulletin Board is empty #5886

Open
lolo101 opened this issue Aug 6, 2024 · 8 comments
Open

After reloading a previous save, Bulletin Board is empty #5886

lolo101 opened this issue Aug 6, 2024 · 8 comments

Comments

@lolo101
Copy link
Contributor

lolo101 commented Aug 6, 2024

Observed behaviour

After landing at a station, I reloaded a save where I was in another system. Then I fly to the same station again and this time the Bulletin Board is empty
image

Expected behaviour

The Bulletin Board should show some missions, ads and so on

Steps to reproduce

Load the attached savegame and open the station's BB

My pioneer version (and OS):

20240710 (e123a3f) (Linux)

My output.txt (required) and game save (optional, but recommended)

output.txt
lolo1.gz

@lolo101
Copy link
Contributor Author

lolo101 commented Aug 6, 2024

Might be related to #899 but not sure since the fix was delivered more than a decade ago 🙂

@impaktor
Copy link
Member

impaktor commented Aug 8, 2024

Strange / new one.
I'd be surprised if it has anything to do with an issue as old as 899, since populating the BBS adverts was re-written just 1-2 years ago, and the UI has been completely re-written since then as well - twice I think, since that must be OldUI (-> NewUI -> PiGui).

@zonkmachine
Copy link
Member

I've seen this before and I assumed it was related to #5305 which I was testing at the time . When I load the save in lolo1.gz and let it run for a while, the ship market is updated as it should but there are no new ads in the BBS ever so it's properly crashed.

Since the ship market is updated and updateShipsOnSale(station) and updateAdverts(station) are called at the same time we know that call is made.

I checked the Lua console and this logwarning is firing:
"SpaceStation.lua: updateAdverts called for station that hasn't been visited"

When I comment out all lines except Event.Queue("onUpdateBB", station) in updateAdverts(), the BBS starts to repopulate itself.

local function updateAdverts (station)
if not SpaceStation.adverts[station] then
logWarning("SpaceStation.lua: updateAdverts called for station that hasn't been visited")
else
Event.Queue("onUpdateBB", station)
end
end

@zonkmachine
Copy link
Member

Maybe updateAdverts() should look something like:

local function updateAdverts (station)
	if not SpaceStation.adverts[station] then
		logWarning("SpaceStation.lua: updateAdverts called for station that hasn't been visited")
	end
	Event.Queue("onUpdateBB", station)
end

@Web-eWorks
Copy link
Member

If there isn't a SpaceStation.adverts[station] then the station's cached data needs to be re-created and new BBS adverts generated, yes. This is an edge-case scenario which suggests there is a deeper bug causing the station to be in an invalid / partially-valid state.

zonkmachine added a commit to zonkmachine/pioneer that referenced this issue Aug 20, 2024
There is an infrequent issue where the BBS will show up empty on a
game reload as SpaceStation.adverts[station] is missing.
This fix will cause the BBS to repopulate itself but only from
those modules that impements onUpdateBB(). It will not solve the
underlying cause.

Addresses pioneerspacesim#5886
Web-eWorks pushed a commit that referenced this issue Aug 23, 2024
There is an infrequent issue where the BBS will show up empty on a
game reload as SpaceStation.adverts[station] is missing.
This fix will cause the BBS to repopulate itself but only from
those modules that impements onUpdateBB(). It will not solve the
underlying cause.

Addresses #5886
@zonkmachine
Copy link
Member

About my fix above, From #5894,

This fix will cause the BBS to repopulate itself but only from those modules that impements onUpdateBB().

Right. If we can repopulate the BBS with onUpdateBB, can't we as well recreate it completely with onCreateBB?

 local function updateAdverts (station) 
 	if not SpaceStation.adverts[station] then 
 		logWarning("SpaceStation.lua: updateAdverts called for station that hasn't been visited") 
 		Event.Queue("onCreateBB", station) 
 	else 
 		Event.Queue("onUpdateBB", station) 
 	end 
 end

@Web-eWorks

@Web-eWorks
Copy link
Member

Web-eWorks commented Aug 30, 2024

Yes, onCreateBB should be the correct function to use if there is no bulletin board data.

@zonkmachine
Copy link
Member

Yes, onCreateBB should be the correct function to use if there is no bulletin board data.

OK, fixed in: #5912

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants