ashn-dot-dev / natac

Networked implementation of the hexagonal settler game in Sunder
BSD Zero Clause License
4 stars 0 forks source link

Cannot Connect As Spectator #19

Closed frankobjank closed 7 months ago

frankobjank commented 7 months ago

I tried to join as a spectator while a game was in progress. A window opened up but then I got an assertion error:

$ ./natac -client=$(dig natac.net +short) [nbnet INFO] Registered driver (ID: 0, Name: UDP) [nbnet INFO] Started info: connected to server [client.sunder:719] assertion failure assert self.*.player.is_value();

frankobjank commented 7 months ago

I was able to open a client window as a spectator later while the same game was happening.

ashn-dot-dev commented 7 months ago

Issue occurred on commit 68bec721d8f425916854c441b753466d842bbbc8. Unknown what player action was occurring at the time.

ashn-dot-dev commented 7 months ago

This error appears to come from an assert statement in client_state::p_discarded where the case of a spectator client is not handled. This function could probably be removed and replaced with a call to client_state::p_info where the player passed into the function must be explicitly retrieved from the optional client state player before the function invocation.

ashn-dot-dev commented 7 months ago

Commit 55dd1ffc54c767b24a32e90ec7b7074fcdac05a1 should address some of these issues. It removes the implicit assumption that the client is acting on behalf of an in-game player. I'm going to close this issue, but will re-open if the problem rears its head again.