#ifndef TC_WORLD_UPDATER_INTERNAL_H #define TC_WORLD_UPDATER_INTERNAL_H #include #include #include typedef struct tc_world_updater_queue tc_world_updater_queue_s; typedef struct tc_world_updater_command tc_world_updater_command_s; typedef enum { TC_WORLD_UPDATER_COMMAND_UNKNOWN, TC_WORLD_UPDATER_COMMAND_MOVE_CHUNKLOADER, TC_WORLD_UPDATER_COMMAND_PLACE_BLOCK, TC_WORLD_UPDATER_COMMAND_STOP, TC_WORLD_UPDATER_COMMAND_ADD_WORLD, TC_WORLD_UPDATER_COMMAND_ADD_CHUNKLOADER, TC_WORLD_UPDATER_COMMAND_DELETE_CHUNKLOADER, TC_WORLD_UPDATER_COMMAND_GET_WORLD, TC_WORLD_UPDATER_COMMAND_GET_CHUNKLOADER, TC_WORLD_UPDATER_COMMAND_GET_CHUNKLIST } tc_world_update_command_e; struct tc_world_updater_command { tc_world_updater_command_s *next; tc_world_updater_command_s *previous; tc_world_update_command_e type; union command { struct move_chunkloader_command { u32_t loader_id; tc_chunk_location_s new_location; } move_chunkloader; struct place_block_command { tc_block_s block; tc_block_location_s location; } place_block; struct get_item { u32_t index; u32_t promise; } get_item; } specific; bool_t is_used; }; struct tc_world_updater_queue { tc_world_updater_command_s *first; tc_world_updater_command_s *last; bool_t in_action; u32_t capacity; tc_world_updater_command_s *commands; }; void tc_worldupdate_initialize_promises (); tc_world_updater_queue_s tc_new_world_updater_queue (u32_t capacity); bool_t tc_issue_world_updater_command ( tc_world_updater_queue_s *queue, tc_world_updater_command_s command ); tc_world_updater_command_s tc_world_updater_query_next_command (tc_world_updater_queue_s *queue); tc_promise_s tc_worldupdate_reserve_world_promise (); tc_promise_s tc_worldupdate_reserve_chunkloader_promise (); tc_promise_s tc_worldupdate_reserve_chunklist_promise (); void tc_worldupate_set_world_promise (u32_t identifier, tc_world_s *world); void tc_worldupate_set_chunkloader_promise (u32_t identifier, tc_chunkloader_s *chunkloader); void tc_worldupate_set_chunklist_promise (u32_t identifier, tc_chunklist_s *chunklist); tc_world_updater_queue_s tc_new_world_updater_queue (u32_t capacity); void tc_worldupdater_execute_move_chunkloader (tc_world_updater_command_s command); void tc_worldupdater_execute_place_block (tc_world_updater_command_s command); void tc_worldupdater_execute_stop (tc_world_updater_command_s command); void tc_worldupdater_execute_add_world (tc_world_updater_command_s command); void tc_worldupdater_execute_add_chunkloader (tc_world_updater_command_s command); void tc_worldupdater_execute_delete_chunkloader (tc_world_updater_command_s command); void tc_worldupdater_execute_get_world (tc_world_updater_command_s command); void tc_worldupdater_execute_get_chunkloader (tc_world_updater_command_s command); void tc_worldupdater_execute_get_chunklist (tc_world_updater_command_s command); #endif // TC_WORLD_UPDATER_INTERNAL_H