News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

r1943 - Water level of ppm preview on new map window is one level high

Started by z9999, August 09, 2008, 12:49:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

z9999

simutrans r1943 GDI

I repoted this before and made a patch.
But this problem is NOT solved yet.
I don't know why you don't like my patches in spite of working well.


Index: gui/welt.cc
===================================================================
--- gui/welt.cc (r1943)
+++ gui/welt.cc (copy)
@@ -322,7 +322,7 @@
uint16 B = (uint8)fgetc(file);

while(karte_x<=rest_x  &&  karte_x<preview_size) {
- karte[(karte_y*preview_size)+karte_x] = reliefkarte_t::calc_hoehe_farbe( (((R*2+G*3+B)/4 - 224+16)/16)*Z_TILE_STEP, sets->gib_grundwasser() );
+ karte[(karte_y*preview_size)+karte_x] = reliefkarte_t::calc_hoehe_farbe( (((R*2+G*3+B)/4 - 224+16)>>4)*Z_TILE_STEP, sets->gib_grundwasser() );
karte_x ++;
}
rest_x += skip_x;



prissi

This is a compiler error then. It works fine on my compiler. Furthermore for an unsigned number >> 4 and /16 are identical. Hmm. Ok, can change it, although I do not like hidden divisions in not speed critical sections.

It works even for the main routine ... maybe should be same in both places.

z9999

AFAIK, both vc++ and gcc are same at this point.
-5/2 = -2
-5 >> 1 = -3

And my first report is for v100.0 which you made it.
My code is the old simutrans code before you changed it. I dig it.

prissi

I apologize. Since the numbers are unsigned, I was assuming that the compiler would make an unsigned shift. And even more, I was so used to /16 equal >>4 that I overlooked your point. (Strangley division by 16 is still used in the main code though).