Pārlūkot izejas kodu

Put config in game directory, fix logging

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
TheoryOfNekomata pirms 1 gada
vecāks
revīzija
9eae630cdf
5 mainītis faili ar 12 papildinājumiem un 12 dzēšanām
  1. +1
    -0
      src/packages/game/IZ_app.c
  2. +4
    -4
      src/packages/game/IZ_app_config.c
  3. +1
    -1
      src/packages/game/output/video/IZ_video.c
  4. +2
    -3
      src/packages/net/IZ_net_client.c
  5. +4
    -4
      src/packages/server/IZ_app_config.c

+ 1
- 0
src/packages/game/IZ_app.c Parādīt failu

@@ -68,6 +68,7 @@ IZ_AppInitializeResult IZ_AppInitialize(struct IZ_App* app, u8 argc, const char*
}

void IZ_AppTeardown(struct IZ_App* app) {
IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Shutting down networking...");
IZ_NetClientDisconnect(&app->net_state);
IZ_PoolTeardown(&app->pool);
IZ_InputTeardown(&app->input_state);


+ 4
- 4
src/packages/game/IZ_app_config.c Parādīt failu

@@ -1,11 +1,11 @@
#include "IZ_app_config.h"

void IZ_ConfigGetDefaultPath(char* config_path, size_t string_size) {
#ifdef IZ_DEBUG
//#ifdef IZ_DEBUG
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_strcat(config_path, string_size, IZ_CONFIG_GAME_PATH);


+ 1
- 1
src/packages/game/output/video/IZ_video.c Parādīt failu

@@ -84,7 +84,7 @@ IZ_ProcedureResult IZ_VideoInitialize(IZ_VideoState* state, void* user_data, con
SDL_WINDOW_SHOWN
);
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;
}
state->window = window;


+ 2
- 3
src/packages/net/IZ_net_client.c Parādīt failu

@@ -12,7 +12,7 @@ bool IZ_NetClientIsValidReconnectIntervalSeconds(long reconnect_interval_secs) {
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[]) {
config_items[0] = (IZ_ConfigItem) {
@@ -146,12 +146,11 @@ void IZ_NetClientConnect(IZ_NetClientState* state, IZ_WSClientInitializeParams p
}

void IZ_NetClientDisconnect(IZ_NetClientState* state) {
IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Shutting down networking...");
if (state->status == IZ_NET_CLIENT_STATUS_PRISTINE) {
return;
}
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_protocol(state->binding.connection)
);


+ 4
- 4
src/packages/server/IZ_app_config.c Parādīt failu

@@ -1,11 +1,11 @@
#include "IZ_app_config.h"

void IZ_ConfigGetDefaultPath(char* config_path, size_t string_size) {
#ifdef IZ_DEBUG
//#ifdef IZ_DEBUG
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_strcat(config_path, string_size, IZ_CONFIG_SERVER_PATH);


Notiek ielāde…
Atcelt
Saglabāt