X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=1ea2a2edb823e909267815575b6eb3121ddb6dba;hb=8cea50fbd1b74a2bc164a79cbd26bdbb3abd6689;hp=ea5ed01a06a8898b9a60bd6a667fee291a9b8c1d;hpb=8e17da8cdff134bfa0e766a50f408a3c06428f54;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index ea5ed01a..1ea2a2ed 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1900,6 +1900,29 @@ int get_auto_parameter_value(char *token, char *value_raw) return get_parameter_value(value_raw, suffix, TYPE_INTEGER); } +struct ScreenModeInfo *get_screen_mode_from_string(char *screen_mode_string) +{ + static struct ScreenModeInfo screen_mode; + char *screen_mode_string_x = strchr(screen_mode_string, 'x'); + char *screen_mode_string_copy; + char *screen_mode_string_pos_w; + char *screen_mode_string_pos_h; + + if (screen_mode_string_x == NULL) /* invalid screen mode format */ + return NULL; + + screen_mode_string_copy = getStringCopy(screen_mode_string); + + screen_mode_string_pos_w = screen_mode_string_copy; + screen_mode_string_pos_h = strchr(screen_mode_string_copy, 'x'); + *screen_mode_string_pos_h++ = '\0'; + + screen_mode.width = atoi(screen_mode_string_pos_w); + screen_mode.height = atoi(screen_mode_string_pos_h); + + return &screen_mode; +} + static void FreeCustomArtworkList(struct ArtworkListInfo *, struct ListNodeInfo ***, int *);