protoverse

A metaverse protocol
git clone git://jb55.com/protoverse
Log | Files | Refs | README | LICENSE

entity.h (483B)


      1 
      2 #ifndef PROTOVERSE_ENTITY_H
      3 #define PROTOVERSE_ENTITY_H
      4 
      5 #include "resource.h"
      6 
      7 typedef struct resource_id entity_id;
      8 
      9 enum entity_type {
     10 	ENT_AVATAR,
     11 	ENT_OBJECT,
     12 };
     13 
     14 struct entity {
     15 	const char *name;
     16 	enum entity_type type;
     17 	int cell;
     18 	double pos[3];
     19 };
     20 
     21 static inline const char *entity_name(struct env *env, entity_id *id)
     22 {
     23 	struct entity *ent;
     24 
     25 	if (!(ent = get_resource(&env->entities, id))) {
     26 		return "unknown";
     27 	}
     28 
     29 	return ent->name;
     30 }
     31 
     32 
     33 #endif /* PROTOVERSE_ENTITY_H */