Clarify action id
This commit is contained in:
@ -269,7 +269,7 @@ final class OldTable {
|
||||
func perform(action: PlayerAction, forPlayer player: PlayerName) -> PlayerActionResult {
|
||||
let player = select(player: player)!
|
||||
guard player.canPerform(action) else {
|
||||
print("Player \(player) wants to \(action.path), but only allowed: \(player.actions)")
|
||||
print("Player \(player) wants to \(action.id), but only allowed: \(player.actions)")
|
||||
return .tableStateInvalid
|
||||
}
|
||||
defer { sendUpdateToAllPlayers() }
|
||||
|
@ -1,5 +1,7 @@
|
||||
import Foundation
|
||||
|
||||
typealias ActionId = String
|
||||
|
||||
enum PlayerAction: String, Codable {
|
||||
/// The player can request cards to be dealt
|
||||
case deal = "deal"
|
||||
@ -24,9 +26,9 @@ enum PlayerAction: String, Codable {
|
||||
|
||||
/// The player claims to win and doubles the game cost ("schießen")
|
||||
case doubleDuringGame = "raise"
|
||||
|
||||
|
||||
/// The url path for the client to call (e.g. /player/deal)
|
||||
var path: String {
|
||||
var id: ActionId {
|
||||
rawValue
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user