On Sun, 13 Jan 2019 17:34:04 +0100
Charlene Wendling <[email protected]> wrote:
> Runtime is fine, but colors are off: the ice is red instead of
> blueish [1]. Anyone know where to start to look at?
There's an endian problem in polygons.cpp:part(). I tried to fix it
with the patch below, but it didn't work. My patch turned the ice
walls into invisible black tiles.
My PowerBook G4 with OpenBSD/macppc has 1G of RAM and uses more than
700M of swap to compile hyper.cpp, which includes most of the other
.cpp files. This takes about an hour, so I can't easily test changes
to the code.
=begin patches/patch-polygons_cpp
$OpenBSD$
Fix color on big-endian machines.
clang or gcc defines __BIG_ENDIAN__.
Index: polygons.cpp
--- polygons.cpp.orig
+++ polygons.cpp
@@ -762,7 +762,12 @@ void fixMercator(bool tinf) {
}
unsigned char& part(color_t& col, int i) {
- unsigned char* c = (unsigned char*) &col; return c[i];
+ unsigned char* c = (unsigned char*) &col;
+#ifdef __BIG_ENDIAN__
+ return c[sizeof(col) - i];
+#else
+ return c[i];
+#endif
}
bool in_twopoint = false;
=end
--
George Koehler <[email protected]>