Ensure game/server configs sit in game directory for easy editing and referencing. The logging for the network teardown has been put in the appropriate function.master
@@ -68,6 +68,7 @@ IZ_AppInitializeResult IZ_AppInitialize(struct IZ_App* app, u8 argc, const char* | |||||
} | } | ||||
void IZ_AppTeardown(struct IZ_App* app) { | void IZ_AppTeardown(struct IZ_App* app) { | ||||
IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Shutting down networking..."); | |||||
IZ_NetClientDisconnect(&app->net_state); | IZ_NetClientDisconnect(&app->net_state); | ||||
IZ_PoolTeardown(&app->pool); | IZ_PoolTeardown(&app->pool); | ||||
IZ_InputTeardown(&app->input_state); | IZ_InputTeardown(&app->input_state); | ||||
@@ -1,11 +1,11 @@ | |||||
#include "IZ_app_config.h" | #include "IZ_app_config.h" | ||||
void IZ_ConfigGetDefaultPath(char* config_path, size_t string_size) { | void IZ_ConfigGetDefaultPath(char* config_path, size_t string_size) { | ||||
#ifdef IZ_DEBUG | |||||
//#ifdef IZ_DEBUG | |||||
const char* config_path_dir = SDL_GetBasePath(); | const char* config_path_dir = SDL_GetBasePath(); | ||||
#else | |||||
const char* config_path_dir = SDL_GetPrefPath("Modal Studios", IZ_APP_NAME); | |||||
#endif | |||||
//#else | |||||
// const char* config_path_dir = SDL_GetPrefPath("Modal Studios", IZ_APP_NAME); | |||||
//#endif | |||||
IZ_memcpy(config_path, string_size, config_path_dir, 128); | IZ_memcpy(config_path, string_size, config_path_dir, 128); | ||||
IZ_strcat(config_path, string_size, IZ_CONFIG_GAME_PATH); | IZ_strcat(config_path, string_size, IZ_CONFIG_GAME_PATH); | ||||
@@ -84,7 +84,7 @@ IZ_ProcedureResult IZ_VideoInitialize(IZ_VideoState* state, void* user_data, con | |||||
SDL_WINDOW_SHOWN | SDL_WINDOW_SHOWN | ||||
); | ); | ||||
if (window == NULL) { | if (window == NULL) { | ||||
// fprintf_s(stderr, "Window could not be created! SDL_Error: %s\n", SDL_GetError()); | |||||
IZ_LogError("Window could not be created! Reason: %s", SDL_GetError()); | |||||
return -3; | return -3; | ||||
} | } | ||||
state->window = window; | state->window = window; | ||||
@@ -12,7 +12,7 @@ bool IZ_NetClientIsValidReconnectIntervalSeconds(long reconnect_interval_secs) { | |||||
return (3 <= reconnect_interval_secs && reconnect_interval_secs <= 10); | return (3 <= reconnect_interval_secs && reconnect_interval_secs <= 10); | ||||
} | } | ||||
static IZ_ConfigItem net_client_config_items[IZ_PLAYERS + 3]; | |||||
static IZ_ConfigItem net_client_config_items[IZ_PLAYERS + 3 + 1]; | |||||
void IZ_NetClientInitializeConfigItems(IZ_ConfigItem config_items[]) { | void IZ_NetClientInitializeConfigItems(IZ_ConfigItem config_items[]) { | ||||
config_items[0] = (IZ_ConfigItem) { | config_items[0] = (IZ_ConfigItem) { | ||||
@@ -146,12 +146,11 @@ void IZ_NetClientConnect(IZ_NetClientState* state, IZ_WSClientInitializeParams p | |||||
} | } | ||||
void IZ_NetClientDisconnect(IZ_NetClientState* state) { | void IZ_NetClientDisconnect(IZ_NetClientState* state) { | ||||
IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Shutting down networking..."); | |||||
if (state->status == IZ_NET_CLIENT_STATUS_PRISTINE) { | if (state->status == IZ_NET_CLIENT_STATUS_PRISTINE) { | ||||
return; | return; | ||||
} | } | ||||
if (state->binding.connection) { | if (state->binding.connection) { | ||||
IZ_WSClientVHostData *vhd = (IZ_WSClientVHostData *) lws_protocol_vh_priv_get( | |||||
IZ_WSClientVHostData* vhd = (IZ_WSClientVHostData*) lws_protocol_vh_priv_get( | |||||
lws_get_vhost(state->binding.connection), | lws_get_vhost(state->binding.connection), | ||||
lws_get_protocol(state->binding.connection) | lws_get_protocol(state->binding.connection) | ||||
); | ); | ||||
@@ -1,11 +1,11 @@ | |||||
#include "IZ_app_config.h" | #include "IZ_app_config.h" | ||||
void IZ_ConfigGetDefaultPath(char* config_path, size_t string_size) { | void IZ_ConfigGetDefaultPath(char* config_path, size_t string_size) { | ||||
#ifdef IZ_DEBUG | |||||
//#ifdef IZ_DEBUG | |||||
const char* config_path_dir = SDL_GetBasePath(); | const char* config_path_dir = SDL_GetBasePath(); | ||||
#else | |||||
const char* config_path_dir = SDL_GetPrefPath("Modal Studios", IZ_APP_NAME); | |||||
#endif | |||||
//#else | |||||
// const char* config_path_dir = SDL_GetPrefPath("Modal Studios", IZ_APP_NAME); | |||||
//#endif | |||||
IZ_memcpy(config_path, string_size, config_path_dir, 128); | IZ_memcpy(config_path, string_size, config_path_dir, 128); | ||||
IZ_strcat(config_path, string_size, IZ_CONFIG_SERVER_PATH); | IZ_strcat(config_path, string_size, IZ_CONFIG_SERVER_PATH); | ||||