50 lines
1.3 KiB
Plaintext
50 lines
1.3 KiB
Plaintext
module horse/game-id
|
|
|
|
// Game ID for characters, cards, skills, races, &c.
|
|
// Values for different categories may overlap.
|
|
alias game-id = int
|
|
|
|
// Specific game ID types.
|
|
// I've already made mistakes with ID categories and I haven't even committed this file yet.
|
|
|
|
// Game ID for characters.
|
|
// Generally numbers in the range 1000-9999.
|
|
pub struct character-id
|
|
game-id: game-id
|
|
|
|
// Game ID for trainees, i.e. costume instances of characters.
|
|
// Generally a character ID with two digits appended.
|
|
pub struct trainee-id
|
|
game-id: game-id
|
|
|
|
// Game ID for skills.
|
|
pub struct skill-id
|
|
game-id: game-id
|
|
|
|
// Game ID for skill groups.
|
|
pub struct skill-group-id
|
|
game-id: game-id
|
|
|
|
// Game ID for skill icons.
|
|
pub struct skill-icon-id
|
|
game-id: game-id
|
|
|
|
// order2 comparison between any game ID types.
|
|
pub inline fun order2(x: a, y: a, ?a/game-id: (a) -> game-id): order2<a>
|
|
match x.game-id.cmp(y.game-id)
|
|
Lt -> Lt2(x, y)
|
|
Eq -> Eq2(x)
|
|
Gt -> Gt2(x, y)
|
|
|
|
// Comparison between any game ID types.
|
|
pub inline fun cmp(x: a, y: a, ?a/game-id: (a) -> game-id): order
|
|
x.game-id.cmp(y.game-id)
|
|
|
|
// Equality between any game ID types.
|
|
pub inline fun (==)(x: a, y: a, ?a/game-id: (a) -> game-id): bool
|
|
x.game-id == y.game-id
|
|
|
|
// Check whether a game ID is valid, i.e. nonzero.
|
|
pub inline fun is-valid(x: a, ?a/game-id: (a) -> game-id): bool
|
|
x.game-id != 0
|