17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 13:19:20 +02:00

multiplayer: fix the black screen - a cab and is_ready waiting on each other

The renderer draws nothing at all while simulation::is_ready is false, and that
flag only goes up once the local player's cab is built.

The previous commit made walking into a cab a crew request, so the cab of a
claimed vehicle is created by Crews::reconcile() rather than by the command
itself. reconcile() runs from the network housekeeping, which was gated on
simulation::is_ready - so a host started with -v had its entervehicle turned
into a claim, and then the cab waited for is_ready while is_ready waited for
the cab. Black screen on both ends, since a client whose server never gets
going has nothing to show either.

- the housekeeping now waits for Global.simulation_loaded, which says the world
  exists, instead of simulation::is_ready, which says the player has a cab
- in a session, a player with no cab counts as ready: they are an observer in
  the lobby, not a game still loading, and the world has to be drawn for them
- entervehicle is only taken as a crew request when the session actually lists
  that vehicle; anything else stays an ordinary command, so a scenario that
  starts its host in something the roster does not cover still works
This commit is contained in:
2026-09-06 22:54:48 +00:00
parent 9dc78a65dc
commit a72c3292ad
5 changed files with 21 additions and 4 deletions

View File

@@ -29,6 +29,7 @@ http://mozilla.org/MPL/2.0/.
#include "utilities/Timer.h"
#include "rendering/renderer.h"
#include "utilities/Logs.h"
#include "network/entities.h"
/*
namespace input {
@@ -454,7 +455,11 @@ bool driver_mode::update()
GfxRenderer->Update(deltarealtime);
simulation::is_ready = simulation::is_ready || (simulation::Train != nullptr && simulation::Train->is_cab_initialized) || Global.local_start_vehicle == "ghostview";
simulation::is_ready = simulation::is_ready || (simulation::Train != nullptr && simulation::Train->is_cab_initialized) || Global.local_start_vehicle == "ghostview"
// in a session a player with no cab is an observer waiting in the
// lobby, not a game still loading: the world has to be drawn for
// them, or they are left staring at a black screen
|| (network::is_multiplayer() && simulation::Train == nullptr);
return true;
}