mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-02 12:49:13 +01: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:
@@ -372,6 +372,9 @@ struct global_settings {
|
||||
uint64_t network_session_token = 0;
|
||||
// how far the worst vehicle was out of place when the last correction arrived, metres
|
||||
float network_position_error = 0.0f;
|
||||
// the scenario has finished loading and the world can be worked with. this is not the
|
||||
// same as simulation::is_ready, which only goes up once the player has a cab
|
||||
bool simulation_loaded = false;
|
||||
|
||||
std::unordered_map<int, std::string> trainset_overrides;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user