summaryrefslogtreecommitdiff
path: root/src/storage.h
diff options
context:
space:
mode:
authorAndrew Guschin <saintruler@gmail.com>2021-09-12 20:21:28 +0400
committerAndrew Guschin <saintruler@gmail.com>2021-09-12 20:21:28 +0400
commit5438fe938f6a15f4eadcc0bb2fd09a02130aafb4 (patch)
treef05d70112e40c255c225cb29d0d08853df633ae2 /src/storage.h
parent259c4e23a136d2077c4083c4bbbad55a2a31bcef (diff)
Renamed most of structs and changed allocation strategy for storage
Diffstat (limited to 'src/storage.h')
-rw-r--r--src/storage.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/storage.h b/src/storage.h
index 44fe5fb..3989c4a 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -16,38 +16,39 @@
#define REGISTER_COMPONENT(storage, componentType) internal_registerComponent(storage, #componentType, sizeof(componentType))
#define ADD_COMPONENT(storage, idx, componentType) internal_addComponent(storage, idx, #componentType)
-typedef unsigned int Entity;
+typedef unsigned int entity_t;
typedef struct
{
- char *name;
+ const char *name;
size_t objectSize;
- void **objects;
-} component_pair;
+ char *objects;
+} component_pair_t;
typedef struct
{
unsigned int componentsStored;
unsigned int objectsStored;
- component_pair *objects;
-} storage;
+ component_pair_t *objects;
+} storage_t;
-component_pair * // NULL if pair is not found
-findPair(storage *this, const char *name);
+component_pair_t * // NULL if pair is not found
+findPair(storage_t *this, const char *name);
-Entity
-createEntity(storage *this);
+entity_t
+createEntity(storage_t *this);
// Not intended for use outside of macros
void
-internal_registerComponent(storage *storage, char *name, size_t size);
+internal_registerComponent(storage_t *storage, const char *name, size_t size);
+// Not intended for use outside of macros
void * // NULL if component with such name is not found
-internal_addComponent(storage *this, Entity idx, const char *name);
+internal_addComponent(storage_t *this, entity_t idx, const char *name);
// Not intended for use outside of macros
void * // NULL if component is not found
-internal_getComponent(storage *this, Entity idx, const char *name);
+internal_getComponent(storage_t *this, entity_t idx, const char *name);
#endif // storage_h_INCLUDED