Fix some type encoding problems found using qfprogs.

This commit is contained in:
Bill Currie 2011-02-25 15:59:23 +09:00
parent 58ac212b54
commit a7ae71efad
2 changed files with 13 additions and 13 deletions

View file

@ -190,7 +190,8 @@ qfo_encode_struct (type_t *type)
continue;
if (i == num_fields)
internal_error (0, "whoa, what happened?");
field_types[i++] = qfo_encode_type (sym->type);
field_types[i] = qfo_encode_type (sym->type);
i++;
}
}
@ -212,6 +213,7 @@ qfo_encode_struct (type_t *type)
ENC_DEF (strct->fields[i].type, field_types[i]);
ENC_STR (strct->fields[i].name, sym->name);
strct->fields[i].offset = offset;
i++;
}
return def;
}

View file

@ -788,8 +788,8 @@ init_types (void)
{"field_val", &type_field},
{"func_val", &type_function},
{"pointer_val", &type_pointer},
{"integer_val", &type_integer},
{"vector_val", &type_vector},
{"integer_val", &type_integer},
{"quaternion_val", &type_quaternion},
{0, 0}
};
@ -823,9 +823,9 @@ init_types (void)
// vector can't be part of .zero for v6 progs because for v6 progs,
// .zero is only one word wide.
zero_struct[7].name = 0;
// v6 progs don't have quaternions
zero_struct[8].name = 0;
param_struct[8].name = 0;
// v6 progs don't have integers or quaternions
zero_struct[7].name = 0;
param_struct[7].name = 0;
type_nil = &type_vector;
type_default = &type_float;
}
@ -860,6 +860,12 @@ chain_initial_types (void)
chain_type (&type_function);
chain_type (&type_pointer);
chain_type (&type_floatfield);
if (!options.traditional) {
chain_type (&type_quaternion);
chain_type (&type_integer);
chain_type (&type_short);
class_init_obj_module ();
}
chain_type (&type_param);
chain_type (&type_zero);
@ -867,12 +873,4 @@ chain_initial_types (void)
va_list_struct[1].type = pointer_type (&type_param);
make_structure (0, 's', va_list_struct, &type_va_list);
chain_type (&type_va_list);
if (options.traditional)
return;
chain_type (&type_quaternion);
chain_type (&type_integer);
chain_type (&type_short);
class_init_obj_module ();
}