Add is_friend template to util.c
This commit is contained in:
parent
4e3d1ce996
commit
9743b58ae4
|
@ -26,6 +26,7 @@ typedef struct {
|
|||
cl_entity_t* get_player(int ent_idx);
|
||||
bool is_alive(cl_entity_t* ent);
|
||||
bool valid_player(cl_entity_t* ent);
|
||||
bool is_friend(cl_entity_t* ent);
|
||||
char* get_name(int ent_idx);
|
||||
vec3_t vec3(float x, float y, float z);
|
||||
bool vec_is_zero(vec3_t v);
|
||||
|
|
18
src/util.c
18
src/util.c
|
@ -1,14 +1,14 @@
|
|||
|
||||
|
||||
#include "include/util.h"
|
||||
#include "include/sdk.h"
|
||||
#include "include/globals.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <GL/gl.h>
|
||||
#include <unistd.h> /* getpagesize */
|
||||
#include <sys/mman.h> /* mprotect */
|
||||
|
||||
#include "include/util.h"
|
||||
#include "include/sdk.h"
|
||||
#include "include/globals.h"
|
||||
|
||||
cl_entity_t* get_player(int ent_idx) {
|
||||
if (ent_idx < 0 || ent_idx > 32)
|
||||
return NULL;
|
||||
|
@ -22,6 +22,7 @@ cl_entity_t* get_player(int ent_idx) {
|
|||
}
|
||||
|
||||
bool is_alive(cl_entity_t* ent) {
|
||||
/* TODO */
|
||||
return ent && ent->curstate.movetype != 6 && ent->curstate.movetype != 0;
|
||||
}
|
||||
|
||||
|
@ -30,6 +31,13 @@ bool valid_player(cl_entity_t* ent) {
|
|||
ent->curstate.messagenum >= localplayer->curstate.messagenum;
|
||||
}
|
||||
|
||||
bool is_friend(cl_entity_t* ent) {
|
||||
/* TODO */
|
||||
|
||||
(void)ent;
|
||||
return false;
|
||||
}
|
||||
|
||||
char* get_name(int ent_idx) {
|
||||
hud_player_info_t info;
|
||||
i_engine->pfnGetPlayerInfo(ent_idx, &info);
|
||||
|
|
Loading…
Reference in New Issue