commit f7ae05d029d7faa14707966d6ad6e03d73a332f6 from: Markus Uhlin date: Mon Dec 2 22:09:40 2024 UTC Added player_num_ok_chk() commit - 464e9d0e9b45b2505d252284207c3aee83f719b9 commit + f7ae05d029d7faa14707966d6ad6e03d73a332f6 blob - d2c27ec0a3d1d68bd42240268ef5f2a5f56ba10f blob + 0bcbcaa700f20e103dc1dae85f20254150ba7eda --- FICS/playerdb.c +++ 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) { blob - de2fe5dd8bbb47ea1df310e6dd9fbd3856e9b45c blob + dc5d6cc88b8a828c7e2f0b96095a0fb98f306c05 --- FICS/playerdb.h +++ FICS/playerdb.h @@ -29,6 +29,8 @@ #ifndef _PLAYERDB_H #define _PLAYERDB_H +#include + #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);