aboutsummaryrefslogtreecommitdiff
path: root/plugins/game/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/game/game.c')
-rw-r--r--plugins/game/game.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/game/game.c b/plugins/game/game.c
index 3b2ad4b..6f91ca2 100644
--- a/plugins/game/game.c
+++ b/plugins/game/game.c
@@ -190,6 +190,11 @@ void dir_to_xy(int dir, int *x, int *y)
}
}
+int clamp(int v, int min, int max)
+{
+ return v < min ? min : v > max ? max : v;
+}
+
/* Player */
static void player_death(struct entity *self)