view_hand being sent and panicking causes logged_out or something else to fail?
This commit is contained in:
parent
baab16144b
commit
c68af245af
3 changed files with 6 additions and 4 deletions
|
|
@ -139,8 +139,9 @@ pub struct HandView {
|
||||||
|
|
||||||
#[view(accessor = view_closed_hands, public)]
|
#[view(accessor = view_closed_hands, public)]
|
||||||
fn view_closed_hands(ctx: &ViewContext) -> Vec<HandView> {
|
fn view_closed_hands(ctx: &ViewContext) -> Vec<HandView> {
|
||||||
let this_player = ctx.db.player().identity().find(ctx.sender()).unwrap();
|
if let Some(this_player) = ctx.db.player().identity().find(ctx.sender())
|
||||||
if let Some(lobby) = ctx.db.lobby().id().find(this_player.lobby_id) {
|
&& let Some(lobby) = ctx.db.lobby().id().find(this_player.lobby_id)
|
||||||
|
{
|
||||||
lobby
|
lobby
|
||||||
.players
|
.players
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
||||||
|
|
@ -226,12 +226,13 @@ fn on_player_insert_update(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
|
||||||
main_player: Option<Single<&MainPlayer>>,
|
main_player: Option<Single<&MainPlayer>>,
|
||||||
other_players: Query<&Player>,
|
other_players: Query<&Player, Without<MainPlayer>>,
|
||||||
|
|
||||||
mut next_turnstate: ResMut<NextState<jong_types::states::TurnState>>,
|
mut next_turnstate: ResMut<NextState<jong_types::states::TurnState>>,
|
||||||
) {
|
) {
|
||||||
for msg in messages.read() {
|
for msg in messages.read() {
|
||||||
debug!("on_player_insert_update: {:?}", msg.new);
|
debug!("on_player_insert_update: {:?}", msg.new);
|
||||||
|
assert_eq!(msg.new.identity, stdb.identity());
|
||||||
if main_player.is_none() && msg.new.identity == stdb.identity() {
|
if main_player.is_none() && msg.new.identity == stdb.identity() {
|
||||||
// trace!("spawn_main_player");
|
// trace!("spawn_main_player");
|
||||||
spawn_main_player(&stdb, &mut commands, &mut next_turnstate, &msg.new);
|
spawn_main_player(&stdb, &mut commands, &mut next_turnstate, &msg.new);
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ pub(crate) fn render_main_hand(
|
||||||
let hand: Vec<_> = hand
|
let hand: Vec<_> = hand
|
||||||
.iter()
|
.iter()
|
||||||
.find_map(|(c, e)| {
|
.find_map(|(c, e)| {
|
||||||
debug!("main_player children: {:?}", *main_player);
|
// debug!("main_player children: {:?}", *main_player);
|
||||||
if main_player.contains(&e) {
|
if main_player.contains(&e) {
|
||||||
Some(c)
|
Some(c)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue