Skip to content

Commit

Permalink
code: cpp casting/type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
inlife committed Apr 20, 2021
1 parent 072d48a commit a62979c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions code/header/general.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ LIBRG_API int8_t librg_config_chunkoffset_get(librg_world *world, int16_t *x, in
// !
// =======================================================================//

LIBRG_API int8_t librg_event_set(librg_world *world, librg_event_type, librg_event_fn);
LIBRG_API int8_t librg_event_remove(librg_world *world, librg_event_type);

LIBRG_API librg_event_type librg_event_type_get(librg_world *world, librg_event *event);
LIBRG_API int64_t librg_event_owner_get(librg_world *world, librg_event *event);
LIBRG_API int64_t librg_event_entity_get(librg_world *world, librg_event *event);
LIBRG_API char * librg_event_buffer_get(librg_world *world, librg_event *event);
LIBRG_API int32_t librg_event_size_get(librg_world *world, librg_event *event);
LIBRG_API void * librg_event_userdata_get(librg_world *world, librg_event *event);
LIBRG_API int8_t librg_event_set(librg_world *world, librg_event_type, librg_event_fn);
LIBRG_API int8_t librg_event_remove(librg_world *world, librg_event_type);

LIBRG_API int8_t librg_event_type_get(librg_world *world, librg_event *event);
LIBRG_API int64_t librg_event_owner_get(librg_world *world, librg_event *event);
LIBRG_API int64_t librg_event_entity_get(librg_world *world, librg_event *event);
LIBRG_API char * librg_event_buffer_get(librg_world *world, librg_event *event);
LIBRG_API int32_t librg_event_size_get(librg_world *world, librg_event *event);
LIBRG_API void * librg_event_userdata_get(librg_world *world, librg_event *event);

// =======================================================================//
// !
Expand Down
6 changes: 3 additions & 3 deletions code/source/general.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ uint32_t librg_version() {
}

librg_world *librg_world_create() {
librg_world_t *wld = LIBRG_MEM_ALLOC(sizeof(librg_world_t));
librg_world_t *wld = (librg_world_t *)LIBRG_MEM_ALLOC(sizeof(librg_world_t));
zpl_memset(wld, 0, sizeof(librg_world_t));

/* setup initials */
Expand Down Expand Up @@ -211,11 +211,11 @@ int8_t librg_event_remove(librg_world *world, librg_event_type id) {
return LIBRG_OK;
}

librg_event_type librg_event_type_get(librg_world *world, librg_event *event) {
int8_t librg_event_type_get(librg_world *world, librg_event *event) {
LIBRG_ASSERT(event); if (!event) return LIBRG_EVENT_INVALID;
zpl_unused(world);
librg_event_t *e = (librg_event_t*)event;
return e->type;
return (int8_t)e->type;
}

int64_t librg_event_owner_get(librg_world *world, librg_event *event) {
Expand Down
2 changes: 1 addition & 1 deletion code/source/packing.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int32_t librg_world_write(librg_world *world, int64_t owner_id, char *buffer, si
librg_table_i64 next_snapshot = {0};
librg_table_i64_init(&next_snapshot, wld->allocator);

int64_t *results = LIBRG_MEM_ALLOC(LIBRG_WORLDWRITE_MAXQUERY * sizeof(int64_t));
int64_t *results = (int64_t *)LIBRG_MEM_ALLOC(LIBRG_WORLDWRITE_MAXQUERY * sizeof(int64_t));
size_t total_amount = LIBRG_WORLDWRITE_MAXQUERY;
librg_world_query(world, owner_id, results, &total_amount);

Expand Down
4 changes: 2 additions & 2 deletions docs/defs/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ Usually this method is called within the event callback itself.

##### Signature
```c
librg_event_type librg_event_type_get(
int8_t librg_event_type_get(
librg_world *world,
librg_event *event
)
```

##### Returns

* In case of success: current event type
* In case of success: positive integer representing current event type (from `librg_event_type`enum)
* In case of invalid event: `LIBRG_EVENT_INVALID`

-------------------------------
Expand Down

0 comments on commit a62979c

Please sign in to comment.