News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

[bug devel] simwerkz.cc wont compile

Started by sanna, June 15, 2010, 01:03:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sanna

Trying to compile branch devel commit c95ef7daa0fa9388d22cc6b9829973d9e5fdcc12 fails complaining about the following code:
char const* wkz_depot_t::get_tooltip(spieler_t* const sp)
{
karte_t&               welt = *sp->get_welt();
einstellungen_t    const& settings  = *welt.get_einstellungen();
const haus_besch_t const& besch     = *hausbauer_t::find_tile(default_param, 0)->get_besch();
const char         const* tip = translator::translate(besch.get_name());
const uint16   level =  besch.get_level();
sint64                 price;
switch (besch.get_extra()) {
case road_wt:            price = settings.cst_depot_road * level; break;
case track_wt:       price = settings.cst_depot_rail * level; break;
case monorail_wt:    price = settings.cst_depot_rail * level; break;
case maglev_wt:      price = settings.cst_depot_rail * level; break;
case narrowgauge_wt: price = settings.cst_depot_rail * level; break;
case tram_wt:        price = settings.cst_depot_rail * level; break;
case water_wt:       price = settings.cst_depot_ship * level; break;
case air_wt:         price = settings.cst_depot_air  * level; break;
default:             return 0;
}
return tooltip_with_price_maintenance(&welt, tip, price, settings.maint_building * level);
}

It is these (odd) rows that generate the error: const haus_besch_t const& besch     = *hausbauer_t::find_tile(default_param, 0)->get_besch();
const char         const* tip = translator::translate(besch.get_name());


A git blame call shows that these rows where last altered when merging from standard on June 6. The function in question has undergone code clean up in Standard, and seem to have merged in an unfortunate way. I have simply replaced the entire function with its counterpart from Standard, which allows me to compile and run the game. I have tried to make a patch, but it is six months since I last made a git patch, so use with caution.

Sys: debian/squeeze 32-bit, gcc (Debian 4.4.4-1) 4.4.4

jamespetts

Sanna,

thank you for the report. Can you let me know what the GCC error message was? I can't just use the Standard version, because the Experimental version functions differently (the multiplication by level). The lines to which you refer compile without error in MSVC++, so this must be a GCC specific error. Knowing the error message would be most useful :-)
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

sanna

Sure, here you are:
simwerkz.cc: In member function 'virtual const char* wkz_depot_t::get_tooltip(spieler_t*)':
simwerkz.cc:4007: error: duplicate 'const'
simwerkz.cc:4008: error: duplicate 'const'

yobbobandana

I just pushed a fix for this to my github testing branch. I tried to keep the style from simutrans-standard.

jamespetts

Thank you! I'll merge that when I get a chance.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.