X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=e750b78d365a39ebe8dbd4c2e45d9e51bb7d083e;hb=0ede483d20ce26c84087e9fe476debe277f4973a;hp=2f2150a78c6964d24a7ab105932127b080ece23e;hpb=b641818c787e48bbf03ce2a0cd5b542c4c21e523;p=rocksndiamonds.git diff --git a/src/libgame/system.c b/src/libgame/system.c index 2f2150a7..e750b78d 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -114,6 +114,9 @@ void InitNetworkInfo(boolean enabled, boolean connected, boolean serveronly, network.server_host = server_host; network.server_port = server_port; + + network.server_thread = NULL; + network.is_server_thread = FALSE; } void InitRuntimeInfo() @@ -137,14 +140,14 @@ void InitScoresInfo(void) { if (program.global_scores) { - Error(ERR_DEBUG, "Using global, multi-user scores directory '%s'.", + Debug("internal:path", "Using global, multi-user scores directory '%s'.", global_scores_dir); - Error(ERR_DEBUG, "Remove to enable single-user scores directory."); - Error(ERR_DEBUG, "(This enables multipe score entries per user.)"); + Debug("internal:path", "Remove to enable single-user scores directory."); + Debug("internal:path", "(This enables multipe score entries per user.)"); } else { - Error(ERR_DEBUG, "Using private, single-user scores directory."); + Debug("internal:path", "Using private, single-user scores directory."); } } #endif @@ -191,7 +194,7 @@ void InitPlatformDependentStuff(void) int sdl_init_flags = SDL_INIT_EVENTS | SDL_INIT_NOPARACHUTE; if (SDL_Init(sdl_init_flags) < 0) - Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError()); + Fail("SDL_Init() failed: %s", SDL_GetError()); SDLNet_Init(); } @@ -349,30 +352,35 @@ void InitTileCursorInfo(void) void InitOverlayInfo(void) { - int nr = GRID_ACTIVE_NR(); - int x, y; - overlay.enabled = FALSE; overlay.active = FALSE; overlay.show_grid = FALSE; - overlay.grid_xsize = setup.touch.grid_xsize[nr]; - overlay.grid_ysize = setup.touch.grid_ysize[nr]; - - for (x = 0; x < MAX_GRID_XSIZE; x++) - for (y = 0; y < MAX_GRID_YSIZE; y++) - overlay.grid_button[x][y] = setup.touch.grid_button[nr][x][y]; - overlay.grid_button_highlight = CHAR_GRID_BUTTON_NONE; overlay.grid_button_action = JOY_NO_ACTION; + SetOverlayGridSizeAndButtons(); + #if defined(USE_TOUCH_INPUT_OVERLAY) if (strEqual(setup.touch.control_type, TOUCH_CONTROL_VIRTUAL_BUTTONS)) overlay.enabled = TRUE; #endif } +void SetOverlayGridSizeAndButtons(void) +{ + int nr = GRID_ACTIVE_NR(); + int x, y; + + overlay.grid_xsize = setup.touch.grid_xsize[nr]; + overlay.grid_ysize = setup.touch.grid_ysize[nr]; + + for (x = 0; x < MAX_GRID_XSIZE; x++) + for (y = 0; y < MAX_GRID_YSIZE; y++) + overlay.grid_button[x][y] = setup.touch.grid_button[nr][x][y]; +} + void SetTileCursorEnabled(boolean enabled) { tile_cursor.enabled = enabled; @@ -1154,10 +1162,10 @@ Bitmap *LoadCustomImage(char *basename) Bitmap *new_bitmap; if (filename == NULL) - Error(ERR_EXIT, "LoadCustomImage(): cannot find file '%s'", basename); + Fail("LoadCustomImage(): cannot find file '%s'", basename); if ((new_bitmap = LoadImage(filename)) == NULL) - Error(ERR_EXIT, "LoadImage('%s') failed: %s", basename, GetError()); + Fail("LoadImage('%s') failed", basename); return new_bitmap; } @@ -1169,7 +1177,8 @@ void ReloadCustomImage(Bitmap *bitmap, char *basename) if (filename == NULL) // (should never happen) { - Error(ERR_WARN, "ReloadCustomImage(): cannot find file '%s'", basename); + Warn("ReloadCustomImage(): cannot find file '%s'", basename); + return; } @@ -1184,16 +1193,19 @@ void ReloadCustomImage(Bitmap *bitmap, char *basename) if ((new_bitmap = LoadImage(filename)) == NULL) { - Error(ERR_WARN, "LoadImage('%s') failed: %s", basename, GetError()); + Warn("LoadImage('%s') failed", basename); + return; } if (bitmap->width != new_bitmap->width || bitmap->height != new_bitmap->height) { - Error(ERR_WARN, "ReloadCustomImage: new image '%s' has wrong dimensions", + Warn("ReloadCustomImage: new image '%s' has wrong dimensions", filename); + FreeBitmap(new_bitmap); + return; }