Beispiel #1
0
static int validate_player_info(void *data, int size)
{
	NETOBJ_PLAYER_INFO *obj = (NETOBJ_PLAYER_INFO *)data;
	if(sizeof(*obj) != size) return -1;
	netobj_clamp_int("local", obj->local, 0, 1);
	netobj_clamp_int("cid", obj->cid, 0, MAX_CLIENTS-1);
	return 0;
}
Beispiel #2
0
static int validate_pickup(void *data, int size)
{
	NETOBJ_PICKUP *obj = (NETOBJ_PICKUP *)data;
	if(sizeof(*obj) != size) return -1;
	netobj_clamp_int("type", obj->type, 0, max_int);
	netobj_clamp_int("subtype", obj->subtype, 0, max_int);
	return 0;
}
Beispiel #3
0
static int validate_projectile(void *data, int size)
{
	NETOBJ_PROJECTILE *obj = (NETOBJ_PROJECTILE *)data;
	if(sizeof(*obj) != size) return -1;
	netobj_clamp_int("type", obj->type, 0, NUM_WEAPONS-1);
	netobj_clamp_int("start_tick", obj->start_tick, 0, max_int);
	return 0;
}
Beispiel #4
0
static int validate_flag(void *data, int size)
{
    NETOBJ_FLAG *obj = (NETOBJ_FLAG *)data;
    if(sizeof(*obj) != size) return -1;
    netobj_clamp_int("team", obj->team, 0, 1);
    netobj_clamp_int("carried_by", obj->carried_by, -2, MAX_CLIENTS-1);
    return 0;
}
Beispiel #5
0
static int validate_character_core(void *data, int size)
{
	NETOBJ_CHARACTER_CORE *obj = (NETOBJ_CHARACTER_CORE *)data;
	if(sizeof(*obj) != size) return -1;
	netobj_clamp_int("direction", obj->direction, -1, 1);
	netobj_clamp_int("jumped", obj->jumped, 0, 3);
	netobj_clamp_int("hooked_player", obj->hooked_player, 0, MAX_CLIENTS-1);
	netobj_clamp_int("hook_state", obj->hook_state, -1, 5);
	netobj_clamp_int("hook_tick", obj->hook_tick, 0, max_int);
	return 0;
}
Beispiel #6
0
static int validate_laser(void *data, int size)
{
	NETOBJ_LASER *obj = (NETOBJ_LASER *)data;
	if(sizeof(*obj) != size) return -1;
	netobj_clamp_int("start_tick", obj->start_tick, 0, max_int);
	return 0;
}
Beispiel #7
0
static int validate_player_input(void *data, int size)
{
	NETOBJ_PLAYER_INPUT *obj = (NETOBJ_PLAYER_INPUT *)data;
	if(sizeof(*obj) != size) return -1;
	netobj_clamp_int("player_state", obj->player_state, 0, 4);
	return 0;
}
Beispiel #8
0
static int validate_soundworld(void *data, int size)
{
	NETEVENT_SOUNDWORLD *obj = (NETEVENT_SOUNDWORLD *)data;
	if(sizeof(*obj) != size) return -1;
	netobj_clamp_int("soundid", obj->soundid, 0, NUM_SOUNDS-1);
	return 0;
}
Beispiel #9
0
static int validate_death(void *data, int size)
{
	NETEVENT_DEATH *obj = (NETEVENT_DEATH *)data;
	if(sizeof(*obj) != size) return -1;
	netobj_clamp_int("cid", obj->cid, 0, MAX_CLIENTS-1);
	return 0;
}
Beispiel #10
0
static int validate_client_info(void *data, int size)
{
	NETOBJ_CLIENT_INFO *obj = (NETOBJ_CLIENT_INFO *)data;
	if(sizeof(*obj) != size) return -1;
	netobj_clamp_int("use_custom_color", obj->use_custom_color, 0, 1);
	return 0;
}
Beispiel #11
0
static int validate_game(void *data, int size)
{
    NETOBJ_GAME *obj = (NETOBJ_GAME *)data;
    if(sizeof(*obj) != size) return -1;
    netobj_clamp_int("flags", obj->flags, 0, 256);
    netobj_clamp_int("round_start_tick", obj->round_start_tick, 0, max_int);
    netobj_clamp_int("game_over", obj->game_over, 0, 1);
    netobj_clamp_int("sudden_death", obj->sudden_death, 0, 1);
    netobj_clamp_int("paused", obj->paused, 0, 1);
    netobj_clamp_int("score_limit", obj->score_limit, 0, max_int);
    netobj_clamp_int("time_limit", obj->time_limit, 0, max_int);
    netobj_clamp_int("warmup", obj->warmup, 0, max_int);
    netobj_clamp_int("round_num", obj->round_num, 0, max_int);
    netobj_clamp_int("round_current", obj->round_current, 0, max_int);
    return 0;
}
Beispiel #12
0
static int validate_character(void *data, int size)
{
	NETOBJ_CHARACTER *obj = (NETOBJ_CHARACTER *)data;
	if(sizeof(*obj) != size) return -1;
	netobj_clamp_int("player_state", obj->player_state, 0, NUM_PLAYERSTATES-1);
	netobj_clamp_int("health", obj->health, 0, 10);
	netobj_clamp_int("armor", obj->armor, 0, 10);
	netobj_clamp_int("ammocount", obj->ammocount, 0, 10);
	netobj_clamp_int("weapon", obj->weapon, 0, NUM_WEAPONS-1);
	netobj_clamp_int("emote", obj->emote, 0, 6);
	netobj_clamp_int("attacktick", obj->attacktick, 0, max_int);
	return 0;
}