Merge pull request #1409 from trigger-death/console-fix

Fixed console open and set commands
This commit is contained in:
Ted John 2015-06-20 22:44:02 +01:00
commit 6dbdce88d4
1 changed files with 6 additions and 4 deletions

View File

@ -318,14 +318,14 @@ void console_printf(const char *format, ...)
int console_parse_int(const char *src, bool *valid) { int console_parse_int(const char *src, bool *valid) {
char *end; char *end;
int value; int value;
value = strtol(src, &end, 10); *valid &= (*end == '\0'); value = strtol(src, &end, 10); *valid = (*end == '\0');
return value; return value;
} }
double console_parse_double(const char *src, bool *valid) { double console_parse_double(const char *src, bool *valid) {
char *end; char *end;
double value; double value;
value = strtod(src, &end); *valid &= (*end == '\0'); value = strtod(src, &end); *valid = (*end == '\0');
return value; return value;
} }
@ -1030,7 +1030,9 @@ void console_execute_silent(const char *src)
static bool invalidArguments(bool *invalid, bool arguments) static bool invalidArguments(bool *invalid, bool arguments)
{ {
if (!arguments) if (!arguments) {
*invalid = true; *invalid = true;
return !invalid; return false;
}
return true;
} }