diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-12-02 23:09:40 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-12-02 23:09:40 +0100 |
commit | f7ae05d029d7faa14707966d6ad6e03d73a332f6 (patch) | |
tree | 1c61c3dce3dad528d831ae306ac5cbe53a9ffded | |
parent | 464e9d0e9b45b2505d252284207c3aee83f719b9 (diff) |
Added player_num_ok_chk()
-rw-r--r-- | FICS/playerdb.c | 7 | ||||
-rw-r--r-- | FICS/playerdb.h | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c index d2c27ec..0bcbcaa 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -63,6 +63,13 @@ PUBLIC player parray[PARRAY_SIZE]; PUBLIC int p_num = 0; +PUBLIC bool +player_num_ok_chk(const int num) +{ + return (num >= 0 && num <= p_num && + num < (int)ARRAY_SIZE(parray)); +} + PRIVATE int get_empty_slot(void) { diff --git a/FICS/playerdb.h b/FICS/playerdb.h index de2fe5d..dc5d6cc 100644 --- a/FICS/playerdb.h +++ b/FICS/playerdb.h @@ -29,6 +29,8 @@ #ifndef _PLAYERDB_H #define _PLAYERDB_H +#include <stdbool.h> + #define PLAYER_VERSION 1 #define MAX_ALIASES 30 @@ -201,6 +203,8 @@ typedef struct _textlist { extern player parray[PARRAY_SIZE]; extern int p_num; +extern bool player_num_ok_chk(const int); + extern int ClearMsgsBySender(int, param_list); extern int ClrMsgRange(int, int, int); extern int ShowMsgRange(int, int, int); |