forked from flathub/org.widelands.Widelands
-
Notifications
You must be signed in to change notification settings - Fork 1
/
widelands-build20-gcc.patch
22 lines (21 loc) · 888 Bytes
/
widelands-build20-gcc.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff -up widelands-build20/src/graphic/gl/fields_to_draw.h~ widelands-build20/src/graphic/gl/fields_to_draw.h
--- widelands-build20/src/graphic/gl/fields_to_draw.h~ 2019-05-02 07:23:39.000000000 +0200
+++ widelands-build20/src/graphic/gl/fields_to_draw.h 2019-07-14 21:39:12.805869365 +0200
@@ -102,15 +102,11 @@ private:
// coordinates in the map. Returns kInvalidIndex if this field is not in the
// fields_to_draw.
inline int calculate_index(int fx, int fy) const {
- uint16_t xidx = fx - min_fx_;
- if (xidx >= w_) {
+ if (fx < min_fx_ || fx > max_fx_ ||
+ fy < min_fy_ || fy > max_fy_) {
return kInvalidIndex;
}
- uint16_t yidx = fy - min_fy_;
- if (yidx >= h_) {
- return kInvalidIndex;
- }
- return yidx * w_ + xidx;
+ return (fy - min_fy_) * w_ + (fx - min_fx_);
}
// Minimum and maximum field coordinates (geometric) to render. Can be negative.