Allow Vector2/Vector3 iterators to have non-integer values
This commit is contained in:
parent
f7b50992b5
commit
38a0ff2249
1 changed files with 10 additions and 10 deletions
|
@ -3458,8 +3458,8 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const {
|
||||||
return _data._float > 0.0;
|
return _data._float > 0.0;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2: {
|
case VECTOR2: {
|
||||||
int64_t from = reinterpret_cast<const Vector2 *>(_data._mem)->x;
|
double from = reinterpret_cast<const Vector2 *>(_data._mem)->x;
|
||||||
int64_t to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
|
double to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
|
||||||
|
|
||||||
r_iter = from;
|
r_iter = from;
|
||||||
|
|
||||||
|
@ -3474,9 +3474,9 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const {
|
||||||
return from < to;
|
return from < to;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3: {
|
case VECTOR3: {
|
||||||
int64_t from = reinterpret_cast<const Vector3 *>(_data._mem)->x;
|
double from = reinterpret_cast<const Vector3 *>(_data._mem)->x;
|
||||||
int64_t to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
|
double to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
|
||||||
int64_t step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
|
double step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
|
||||||
|
|
||||||
r_iter = from;
|
r_iter = from;
|
||||||
|
|
||||||
|
@ -3660,9 +3660,9 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const {
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR2: {
|
case VECTOR2: {
|
||||||
int64_t to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
|
double to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
|
||||||
|
|
||||||
int64_t idx = r_iter;
|
double idx = r_iter;
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
if (idx >= to)
|
if (idx >= to)
|
||||||
|
@ -3684,10 +3684,10 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const {
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case VECTOR3: {
|
case VECTOR3: {
|
||||||
int64_t to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
|
double to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
|
||||||
int64_t step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
|
double step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
|
||||||
|
|
||||||
int64_t idx = r_iter;
|
double idx = r_iter;
|
||||||
idx += step;
|
idx += step;
|
||||||
|
|
||||||
if (step < 0 && idx <= to)
|
if (step < 0 && idx <= to)
|
||||||
|
|
Loading…
Reference in a new issue