render pond

This commit is contained in:
Tao Tien 2026-02-19 00:37:12 -08:00
parent 875c3fb5bb
commit 1d9577ba42
5 changed files with 76 additions and 7 deletions

View file

@ -49,6 +49,7 @@ pub fn discard_tile(ctx: &ReducerContext, tile_id: u32) -> Result<(), String> {
let dealt_tile = if let Some(dealt) = ctx.db.tile().id().find(tile_id) {
if let Some(drawn) = player.drawn_tile {
if drawn.id == dealt.id {
// dealt from drawn tile
dealt
} else if let Some((i, _)) = player
.hand
@ -56,6 +57,7 @@ pub fn discard_tile(ctx: &ReducerContext, tile_id: u32) -> Result<(), String> {
.enumerate()
.find(|(_, t)| t.id == tile_id)
{
// dealt from hand
let dealt = player.hand.remove(i);
player.hand.push(drawn);
player.hand.sort_by_key(|t| t.tile);