The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: isidoro on September 13, 2008, 05:14:38 AM

Title: r2018: some small errors prevent compiling with gcc
Post by: isidoro on September 13, 2008, 05:14:38 AM

gui/welt.cc: In member function 'bool welt_gui_t::update_from_heightfield(const char*)':
gui/welt.cc:297: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
gui/welt.cc:297: note: candidate 1: operator/(int, int) <built-in>
gui/../ifc/../dataobj/koord.h:78: note: candidate 2: koord operator/(const koord&, sint16)

:o  This is certainly a psycotropic error  :o
I mended with this in that line:

   const long repeat_y = ((int)preview_size)/h;


Other error:

simworld.cc: In static member function 'static sint8* karte_t::get_height_data_from_file(const char*, sint8, sint16&, sint16&)':
simworld.cc:165: error: invalid conversion from 'sint32*' to 'const uint32*'
simworld.cc:165: error:   initializing argument 1 of 'uint32 endian_uint32(const uint32*)'

The same is repeated for lines 168, 173, 175, and 178.  But all vanish if lines 162 and 163 are changed to:
         uint32 l;
         uint16 s;

And a typo gcc detects with a warning:

simworld.cc:201: warning: statement has no effect

== should be changed by =.

Title: Re: r2018: some small errors prevent compiling with gcc
Post by: isidoro on September 14, 2008, 03:17:30 AM
Sorry, for double posting, but there is a new typo left that doesn't deserve a new topic.  In r2020:simworld.cc:166, it says:
         data_offset = endian_sint32(&l);
and it should say:
         data_offset = endian_uint32(&l);