mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-07 16:31:32 +00:00
[qfcc] Allow binary operations between vector and vec3
While I might need to tighten up the rules later, this allows binary operations between vector (the type) and explicitly typed vec3 constants (and non-constants, about which I am undecided). The idea is that explicit constants such as '1 2 3'f should be compatible with either type. This applies to quaternions as well.
This commit is contained in:
parent
0897952a57
commit
42287f1e0e
1 changed files with 6 additions and 0 deletions
|
@ -1094,6 +1094,12 @@ binary_expr (int op, expr_t *e1, expr_t *e2)
|
||||||
e2 = cast_expr (t1, e2);
|
e2 = cast_expr (t1, e2);
|
||||||
} else if (type_promotes (base_type (t2), base_type (t1))) {
|
} else if (type_promotes (base_type (t2), base_type (t1))) {
|
||||||
e1 = cast_expr (t2, e1);
|
e1 = cast_expr (t2, e1);
|
||||||
|
} else if (base_type (t1) == base_type (t2)) {
|
||||||
|
if (is_vector (t1) || is_quaternion (t1)) {
|
||||||
|
e2 = cast_expr (t1, e2);
|
||||||
|
} else if (is_vector (t2) || is_quaternion (t2)) {
|
||||||
|
e1 = cast_expr (t2, e1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
debug (e1, "%d %d\n", e1->implicit, e2->implicit);
|
debug (e1, "%d %d\n", e1->implicit, e2->implicit);
|
||||||
return invalid_binary_expr (op, e1, e2);
|
return invalid_binary_expr (op, e1, e2);
|
||||||
|
|
Loading…
Reference in a new issue