X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsetup.c;h=5cd8c700fc1925bf4d5b5a4051c908a35db4e79a;hb=05ca3ceb489c27197cf846441c1464536479a5cb;hp=083b9c895f50b552859ac9407c6bf12755fab356;hpb=b461a474a18f36ff4bd5f1805ea01de11dd5a5fc;p=rocksndiamonds.git diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 083b9c89..5cd8c700 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -1013,58 +1013,6 @@ boolean checkCookieString(const char *cookie, const char *template) /* setup file list handling functions */ /* ------------------------------------------------------------------------- */ -int get_string_integer_value(char *s) -{ - static char *number_text[][3] = - { - { "0", "zero", "null", }, - { "1", "one", "first" }, - { "2", "two", "second" }, - { "3", "three", "third" }, - { "4", "four", "fourth" }, - { "5", "five", "fifth" }, - { "6", "six", "sixth" }, - { "7", "seven", "seventh" }, - { "8", "eight", "eighth" }, - { "9", "nine", "ninth" }, - { "10", "ten", "tenth" }, - { "11", "eleven", "eleventh" }, - { "12", "twelve", "twelfth" }, - }; - - int i, j; - char *s_lower = getStringToLower(s); - int result = -1; - - for (i=0; i<13; i++) - for (j=0; j<3; j++) - if (strcmp(s_lower, number_text[i][j]) == 0) - result = i; - - if (result == -1) - result = atoi(s); - - free(s_lower); - - return result; -} - -boolean get_string_boolean_value(char *s) -{ - char *s_lower = getStringToLower(s); - boolean result = FALSE; - - if (strcmp(s_lower, "true") == 0 || - strcmp(s_lower, "yes") == 0 || - strcmp(s_lower, "on") == 0 || - get_string_integer_value(s) == 1) - result = TRUE; - - free(s_lower); - - return result; -} - char *getFormattedSetupEntry(char *token, char *value) { int i; @@ -1411,7 +1359,7 @@ void setSetupInfo(struct TokenInfo *token_info, { case TYPE_BOOLEAN: case TYPE_SWITCH: - *(boolean *)setup_value = get_string_boolean_value(token_value); + *(boolean *)setup_value = get_boolean_from_string(token_value); break; case TYPE_KEY: @@ -1423,7 +1371,7 @@ void setSetupInfo(struct TokenInfo *token_info, break; case TYPE_INTEGER: - *(int *)setup_value = get_string_integer_value(token_value); + *(int *)setup_value = get_integer_from_string(token_value); break; case TYPE_STRING: