mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
strings now work in switch statements
This commit is contained in:
parent
50f2d46398
commit
dcfea9796e
1 changed files with 9 additions and 4 deletions
|
@ -213,9 +213,9 @@ switch_expr (switch_block_t *switch_block, expr_t *break_label,
|
|||
for (l = labels; *l; l++)
|
||||
num_labels++;
|
||||
if (options.code.progsversion == PROG_ID_VERSION
|
||||
|| (type->type != ev_string
|
||||
&& type->type != ev_float
|
||||
&& type->type != ev_integer)
|
||||
|| (type != &type_string
|
||||
&& type != &type_float
|
||||
&& type != &type_integer)
|
||||
|| num_labels < 8) {
|
||||
for (l = labels; *l; l++) {
|
||||
expr_t *cmp = binary_expr (EQ, sw_val, (*l)->value);
|
||||
|
@ -227,8 +227,13 @@ switch_expr (switch_block_t *switch_block, expr_t *break_label,
|
|||
append_expr (sw, test);
|
||||
}
|
||||
} else {
|
||||
expr_t *temp = new_temp_def_expr (type);
|
||||
expr_t *temp;
|
||||
int op;
|
||||
|
||||
if (type == &type_string)
|
||||
temp = new_temp_def_expr (&type_integer);
|
||||
else
|
||||
temp = new_temp_def_expr (type);
|
||||
qsort (labels, num_labels, sizeof (*labels), label_compare);
|
||||
switch (type->type) {
|
||||
case ev_string:
|
||||
|
|
Loading…
Reference in a new issue