Skip to main content

Show Posts

This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.

Messages - neroden

1
Simutrans-Extended development / Re: Discussion: optimum starting settings
I'm back....

James, I think you have too many cities.  There's no "wilderness" on your maps, is there?

I've been running maps of similar size (1024x2048) with 64 cities; admittedly I often have around 50% water, but adjusting, 100 cities would be appropriate for your level of water.  300 cities?  Well, my cities are *also* probably twice as large as yours, but still.

As to the p****enger numbers, I am in the process of investigating that in detail myself. The system for generating p****engers has changed considerably in Experimental compared to Standard, and is now more subtle and sophisticated. I am currently experimenting with greatly reducing the proportion of "factory_pax" (from 33 to 15) and of "tourist_pax" (from 16 to 8), boosting the "p****enger_factor" to 20 (from 14 in Pak128.Britain-Ex 0.6) and reducing the "p****enger_routing_local_chance" from 40 to 37 and setting the "p****enger_routing_midrange_chance" to 36. I shall report back with my findings as to what constitute optimum settings. If anyone else has anything to contribute in that regard, I should be most grateful :-)
This seems like the correct direction to adjust things in.  You might have cut factory and tourist pax down too much, but it's the correct direction to adjust them in.  It's also clear that we needed fewer short-range trips and more medium-to-long-range ones.

The more important problem in the early game is factory *goods*, where the entire balancing is broken, but this is a pak question mostly.
2
Pak128.Britain / Re: Please add appropriate prices for river removal (patch attached)
Hmm. That analysis only makes sense if and in so far as those numbers are indeed realistic relative costs of bridges to ordinary ways. If not, there is insufficient incentive to avoid bridges.
.... in which case canal prices have to be increased.

Note that the numbers are *all different* in experimental.

First of all, bridge prices really ought to be adjusted based on the km distance in experimental.  (They aren't right now, which means it's cheaper to build elevateds.)  Once this is done, Experimental Is Different:


Current price: 250.00 (!) for a wood road trestle, maintenance 1.75.  For a three-tile bridge that's -- once the price is scaled per km instead of per tile -- 187.5 and maintenance .58.  A dirt road instead costs 7.5, maintenance 0.08.

The difference is 180.00, maintenance .50.  The cost of bulldozing a single river tile needs to be more than that difference, and enough more to make the lower maintenance worthwhile.  At the moment that would be a minimum of 180.00.

We want that to be less than the cost of the canal, which is already high at 200.00 -- and it *is* already less than the cost of the canal.  If (for instance) River0 costs 199.98 and River1 costs 199.99, then they'll still be cheaper than the canal.  (I'm ****uming that the game engine has been fixed to charge the lesser of the demolition cost and the canal cost; if it hasn't, I'll go back and fix that.)  That would leave a bulldozing cost of 199.98.

That means that there needs to be a bridge costing less than 66.66 per tile -- and there *is*, as the wooden road bridge costs only 60 per tile (once the prices are scaled to be per tile.).  Yay.  Unfortunately, knocking down the river still pays for itself within 14 months.  However, very slight price drops for the bridge or very slight price increases for the canal could stretch this out significantly.
3
Pak128.Britain-Ex / Re: Rebalancing industry settings in Pak128.Britain-Ex
James wrote in another thread:

"In relation to an earlier suggestion about the ratio of production and consumption of farms and shops: whilst there is much to be said for lowering considerably the consumption of shops and increasing their distributionweight, care should be taken not to increase the production of farms too greatly, or else each farm will require a far more substantial transport link than would in reality be required. The idea, for example, that a single farm deserves a railway line all to itself is absurd, and the industries should be balanced with this in mind."

In this case, farms should retain fairly low production levels.  But not *too* low (see below)

Several things need to be done, and I'll explain them all.

First of all, there are only so many trucks one can run on a short line: equal to the number of tiles, bascially.

On a large map, factories don't spread out that much, often being only 12 tiles apart.  I never get any long supply chains, I get clusters instead.  This means that many supply chains can only support up to 24 trucks.  This is also only 3 km apart, making for very low revenue.

Conclusion 1:
The distance of factories from their suppliers needs to be larger.  (Is it specified in terms of tiles instead of kilometers at the moment?  If so it should be in kilometers.)  The minimum should be at least twice what it is now in tile terms -- probably 4 times as much.

Now suppose we do this and factories are at least 48 tiles apart instead of the current 12.  It becomes theoretically possible to put in a truck (lorry) line.  However, it's not reasonable to do so because it's always cheaper to run a train line.  This is mostly because the horses cost more if they're running a lorry line (!!!).

Conclusion 2:
Horse running costs for road, lorry, and canal horses need to be rationalized.  For starters the pulling power should be rationalized (10 kw waterway 10 kw roadway 12 kw railway right now), but then the price-per-kilowatt should be approximately the same.

So suppose the horses cost X /km, with the 1-unit carts costing .01/km.  And suppose the minimum line is 48 tiles long (long enough to supply a 48-unit-per-month farm).  Suppose .17 remains the price for goods.

(.17 * 12 km  - (X + .01) * 24 km) * 48 = Y (per month) operating profit
Y should be at least 2 * the cost of the cheapest halt, otherwise it's impossible to pay for infrastructure.

If the cheapest halt still costs 18 per month, then this means X is less than or equal to .04.

I strongly advise .03 for the single horse if revenues and halt prices remain constant

Conclusion 3:
It is probably desirable to raise revenues slightly and/or lower halt prices.

This would leave more room to adjust the price of vehicles.  

(edit:)
P****enger and mail vehicles are going to continue to run short distances (as little as 2 km) and although they need not always be profitable when doing so they should come close to breaking even, when running a shuttle or extension service, for example.  At most.  Also, 90% full is as good as we can ****ume.

Short distance p****enger  for the 'minimum-length' trip, ****uming some economies of scale with halts and a completely congested road:  (Edited for hackney capacity)
(.90 * .22 * 5 * 2 km  - (X) * 2 km) * 16 = Y (per month) operating profit
where Y will pay for *one* halt (we ****ume the one on the other end is pre-existing) and X is the running cost.  ****ume halt prices and p****enger revenues stay the same and we discover that X can be no larger than .42.  ****uming a completely congested line is an uncomfortable and unreasonable ****umption.  If we ****ume half as many buses, we find that X has to be negative.  Ow.

This means that either p****enger revenues need to be raised, or halt costs need to be reduced, or both.

Conclusion 3, revised:
Either halt (maintenance) costs need to be lowered or revenues need to be raised, or both.

I strongly suggest both.

Lowering halt maintenance costs.  I suggest starting with an across-the-board reduction to 16 per level.

Raising revenues.  Based on my computations, I suggest raising "slow" goods revenue to .18.  (Edited): P****enger and mail revenue should go a lot higher than it currently is.  It depends on the other changes made, but if single horses are reduced to a cost of .03, then .27 will suffice for p****engers and .30 for mail.


FINAL CONCLUSIONS:
(1) Minimum factory distance: raise to 12 km/48 tiles from current 3 km/12 tiles.
(2) Horses: increase to consistent 12 kW, cost .03/km; double horses to 24 kw, .06/km
(3) Halt maintenance: reduce to 16 per level
(4) Revenues: slow goods .18, p****enger .27, mail .30.
4
Pak128.Britain-Ex / Re: Early years need a general revenue boost.
How about, for now, we just reset all the running costs to a flat number like $1.00 for all vehicles?
Or maybe halve the running costs?
I'm not sure which of the numbers are researched and which ones aren't.  I'd rather retain the researched numbers if possible :-) 

Also, a gross rebalancing is needed and I've been waiting until the power/weight stuff is all straightened out before doing it.  I was just hoping for a temporary patch until then.
5
Pak128.Britain / Re: Please add appropriate prices for river removal (patch attached)
D'oh.  Would you like to propose some sensible values instead?

It depends on bridge pricing.  I think the bridges may be too expensive (relative to canals) right now.  

Current price: 250.00 (!) for a wood road trestle, maintenance 1.75.  For a three-tile bridge that's 750 (!) and maintenance 5.25.  A dirt road instead costs 30, maintenance 0.30.  The difference is 720, maintenance 4.95.  The cost of bulldozing a single river tile needs to be more than that difference, and enough more to make the lower maintenance worthwhile.  At the moment that would be a minimum of 720.00.

That seems like too much since we also want it to be less than the cost of the canal, which is already high at 200.00.  The answer is to make the bridges cheaper as well.  If (for instance) River0 costs 199.98 and River1 costs 199.99, then they'll still be cheaper than the canal.  (I'm ****uming that the game engine has been fixed to charge the lesser of the demolition cost and the canal cost; if it hasn't, I'll go back and fix that.)  That would leave a bulldozing cost of 199.98.

That means that there needs to be a bridge costing less than 66.66 per tile -- I suggest the wooden road bridge should cost 50.00.  The maintenance should also be knocked down so that it doesn't 'pay off instantly' to do the demolition instead of the bridge-building.  For it to take 2 years to pay off (with a 50.00 bridge), the appropriate maintenance cost for the wooden bridge would be .70.  You would probably want to make other bridges cheaper as well.

This is ****uming you want to keep the canal price the same.  :-)  The higher the canal price is the higher the prices of bridges can be....

(All these numbers are different in experimental, BTW.)
8
Pak128.Britain-Ex / Early years need a general revenue boost.
While this may be fixed by a more proper price balancing later on, right now it is fundamentally impossible to make any money with practically all of the early-timeline vehicles, except ships (and ships have running costs which are almost certainly too small).  It's *very close* to being possible to make money, however.  Accordingly, I think a small general revenue boost (5%? 10%?) might put the game into the "fully playable" state.
9
Simutrans-Extended development / Re: Graphics bug:
I have that same problem with official 8.2.
I think james suggested it might be a problem with the standard nightly experimental was compiled from.

Hmm, well, I'm getting this in -devel, so it's a bug in the codebase.  Can someone check to see if there are problems like this in 'standard'?  If not, it's probably due to a bad merge from standard (the divergences are getting very serious, I really need to try to get rid of as many as possible).
10
Simutrans-Extended development / Re: Bug in -devel: "Replace all in line" doesn't always work.
By 'reverse' being separated, I mean if my convoy consists of:
Engine-Tender-dining-coach-coach-TPO-mail-mail-brake
I'll make a batch 2 or more of these to run on different lines.

When the train turns around at the end of the line, it'll now have:
Engine-Tender-brake-mail-mail-TPO-coach-coach-dining

When I go to replace the convoy through the replace function, if some convoys are facing in the 'reverse' direction, I will only get to replace convoys facing the same direction, as the 'replace all or 'replace all in line' function will treat the forward facing and reverse facing convoys as two different convoy consists.

seems like neroden fixed it already. That was quick  :o

No, no, I didn't fix that.  I fixed a worse problem, where two convoys which looked positively *identical* were showing up as "not the same".  Incidentally, if I'm not mistaken (James please confirm) in -devel when you reverse the train you'll get

Engine-Tender-mail-mail-TPO-coach-coach-dining-brake

:-)
11
Pak128.Britain-Ex / Suggest reducing min_bonus_max_distance
'10' means that p****engers simply don't care about speed when travelling as much as 6 miles.  Which is a bit unrealistic.  And also, given the way the game is laid out, there are lots of *less than 40 tile* local trips which should care *somewhat* about speed.   As it is local trips simply don't care about speed at all.  Which they should.  If only a little.

I suggest cutting it down to 4 (a bit under 3 miles, or 12,000 feet, or 16 tiles).
12
Simutrans-Extended development / Graphics bug:
http://files.[ simutrans [dot] us (site down, do not visit) ]/files/get/osZovy_gLW/simscr18.bmp

Certain rail tiles disappear on the season update.  Going into underground mode and back (!) makes them reappear.  I'm guessing there's a rendering order issue during the season update or something?  Note that this is a self-built pak.britain.experimental and the rail is Wrought Iron (in case it's a pakfile issue).
13
Simutrans-Extended development / Re: Bug in -devel: "Replace all in line" doesn't always work.
Found and fixed on my jp-devel branch.   ;D  When checking for "identical" status, convoys are now compared both "forwards" and "backwards", no matter what.

This solves all the really perplexing cases of "miscounting" on my game.  Obviously, if you have a TPO or something and it's in a different position on each convoy, it's going to be considered different, but engine-tender-identical cars-brake van and push-pull sets with identical cars should work right now. 

I think players can at least understand *why* sets arranged in a different order will count as different, but not "purely reversed" sets.

There was a second subtler bug where some convoys were *counted* as being replaceable but then weren't replaced, but we'll see if that's still around now that the primary bug is fixed (it might have been a symptom of the same thing).
14
Simutrans-Extended development / crashes in demo.sve and in generating sample map (with no demo.sve)
These are intermittent and I haven't bothered to track them down yet (I just restart and I'm generally OK), but if anyone else tracks either one down it would be good.  

The one with the sample map seems to be memory corruption; I get segfaults, and when I don't the 'pause' button is copied all over the screen in a weird pattern on the demo map (!).

[edit] I found and fixed one of the intermittent crash bugs.  But there appear to be others in different places, so this may take a while.
16
Incorporated Patches and Solved Bug Reports / Re: I want to separate gui_coord from koord.
Some remarks:
gui_coord is not a good choice, since it is rather drawing coordinates, draw_koord. (To indicate close relationship to koord, but this can be done by search and replace easily ... ). As such they should not reside in gui/ but maybe in dataobj.cc;
Those are easy enough changes to make.  I'd still rather have it be draw_coord, in the spirit of translating to English -- eventually koord should be something like map_coord too -- but I could leave the k if you really want me to.

Quote
also all routines in simding.cc (and also other dings) simview.cc and all other drawing stuff should use those coordinates then too.
That's the right thing to do, but it's going to make the patch even *bigger* and harder to maintain.... I could do it in a second p**** or I could just go ahead and make the patch enormous.

(EDIT: oddly most of these routines only use koord for map coordinates, and use 'plain' sint16 for the display coordinates. So there's nothing much to do to make them not use koord for drawing coordinates.  I'll try to clean that up later...)

Quote
That the offset is not an sint16 might be a problem with some scrollbars. Did you test this with very large savegames?

The offset is not an sint16?  Did I make an accidental change here?.... I thought it was still an sint16...  EDIT: it still seems to be an sint16?...

EDIT: Here is the version of the patch with draw_coord (not gui_coord) and the relocation of the new files to dataobj/ ; it's also updated to patch the current version:  http://files.[ simutrans [dot] us (site down, do not visit) ]/files/get/Xkit2XDRIn/gui-coord-3.diff
17
Simutrans-Extended development / Re: Bug in -devel: "Replace all in line" doesn't always work.
For road vehicles "replace all" and "replace all in line" works fine for me.

Have you tested -devel? 
I run mixed consists in all my road and train pax/mail lines.

One thing I've realized is that when the convoy, train, is in 'reverse' the consist is also reversed after the engine(s) and the 'replace' function will separate the two, despite being part of the same batch.
Does this happen even when the consist is Engine-Tender-(lots of identical cars)?  If so it's seriously a bug.  It may also be related to the problems I'm seeing.
Quote
For road vehicles "replace all" and "replace all in line" works fine for me.

I'm having trouble with hackneys and single horses in -devel!  Are you sure you're running -devel?  If so, what git commit number?  That might help us track this down....
18
Simutrans-Extended development / Re: Bug in -devel: "Replace all in line" doesn't always work.
I frequently do... especially in the early early years when there f ex is no sensible road transport for both pax and mail (yes I do mail runs early on too...) and where my routes are set up for both pax and mail (to be able to use them later on as well...). I would not like my mail carriages to be upgraded to gardenseats once these are available...
With road transport, I always end up running a separate pax line and mail line, even if they have the same route, because I set different waiting time standards for them; also, it often turns out to be desirable to add a 'shuttle service' in order to add a stop to pax traffic, but to simply extend the existing mail line by one stop.  I do end up with trains with (and without) mail cars on the same line, though, that's true.

Similarly, it quite often makes sense to not include mail service on each and every train servicing a specific route even quite late in the game, since that will leave pax waiting while running empty mail coaches....
[/quote]
19
Incorporated Patches and Solved Bug Reports / The patch is ready.
It's a very large patch.  It applies cleanly against standard as of now... and it works.  No behavior change.

http://files.[ simutrans [dot] us (site down, do not visit) ]/files/get/L-WDKQeChX/gui-coord.zip

(EDIT: New version of the patch adapted to the latest changes in standard as of this evening:
http://files.[ simutrans [dot] us (site down, do not visit) ]/files/get/tVyygS_YgG/gui-coord-2.diff )

This was the painful part.  Well, actually, merging it to experimental will be painful too.  :-)  I hope it can go in relatively quickly because keeping it up to date with changes in standard will be painful...

Anyway, after this is done I'm going to try to do the further cleanup I was talking about, but that should be less painful.  And this should be an improvement in readability in itself.

The karte_to_screen and screen_to_karte routines had to have their interface rewritten, since they're now converting between two different data types.  They're still inline.

EDIT: To be clear on what's going on here, koord is now supposed to be *only* for map coords, which have the 45 degree rotation in the 'iso view' (well, with a couple of weird exceptions like the case where it's used for map coords *and* different data is overloaded in it when x = -1), and gui_coord is used for all pixel coords and similar things which aren't rotated 45 degrees.  I'm going to try to clean up the conversions further after this but this helped disentangle things a *lot*.

Zeichnen was also renamed "display", as proposed.
20
Incorporated Patches and Solved Bug Reports / Re: I want to separate gui_coord from koord.
The problem is, that current dialoge were not made with larger screens (and fonts) in mind. When renovating the screen coordinate system, It would make sense that dialogues would use a font relative system of displaying. (This might not affect your patch, but should kept in mind.)
This should not affect my patch, but I will keep it in mind.  :-)

Quote
zeichnen->display => why not, for dings_t it is already display. That is one easy search and replace.

About what functions you are thinking? The mapping of to_display_coords( koord3d pos, koord offset_in_tile ) ?

Yes, the mapping from koord<->gui_coord could be made into a method.  I was thinking also that some of the clipping and some of the proportional layout code might turn out to have common computations, though I can't tell whether that is the case yet.
22
Incorporated Patches and Solved Bug Reports / Re: [cleanup patch] Don't use min() in quickstone
I saw no harm in min, but I have also no aversions against your code. What is the problem with min?

There is no problem with min().... yet.  I have been hoping to switch over to a template version of min() which does typechecking, instead of a macro which doesn't.  In the long run std::min() could be used. 

So I've been discovering all the places where min(type A, type B) was called, which causes trouble for a type-safe version of min().  Of course min(type A, type A) is always fine.

In some of these place, it's appropriate to just put in a type cast.  But in others it's cleaner to *remove* typecasts, and this is one of those places.
23
Patches & Projects / Re: [cleanup patch] move #include directive to top of file
Since all those stettings are pretty much independent, I did it this way (to show that this is only needed to climate_stats). I intended it to do it this way also for forest and citystats. You give a valid argument, and a comment could achieve the same. I feel this warrants a little more discussion on how to proceed. (Although I actually nearly convinced (together with a comment).

Comments are good.  :-)  Actually, perhaps each of the #include lines should have a comment right above it explaining why that header is needed.  That's what I do in my own code sometimes.
24
Incorporated Patches and Solved Bug Reports / I want to separate gui_coord from koord.
I want to make a separate type for screen coordinates and switch the GUI over to using it.

This has inherent type-safety benefits, and readability benefits, as screen coordinates and map coordinates will become different.  

It also has other benefits:
- gui_coord will be simpler than koord
- gui_coord can have functions added to it to simplify the gui code.
- The integer conversion problems of gui_coord and koord will be *separate* and can be dealt with *separately* rather than in one huge mess.
- The size of the coordinates for gui_coord and koord can be changed independently (gui_coord might get larger for people with really large screens, koord is unlikely to get larger unless people have really huge maps, which are too slow to play right now).
- It might allow for the map rotation code to be simplified.

It has one downside:
- It's going to be a *large* patch due to replacing koord with gui_coord in most of the gui directory (apart from where it's referring to the map, obviously).

I would really like to make this change, as it would make the code a lot cleaner.  

Would it be accepted?  

And is there anything else I should do while I'm doing this?  (For instance, I have to change every declaration of "zeichnen" -- I could translate it to "display", or "draw".  I'm also changing practically every line with set_groesse or get_groesse in it -- I could change those to set_size and get_size.)
27
Simutrans-Extended development / Re: A good reason to disable city electric supply until you can get it working right
in a case where city A's city hall is contained in city B's limits, and city B's city hall is contained in city A's limits, then a square that is within both cities' limits will be registered as belonging to city B (on the ****umption that the order in the vector is alphabetical). This code does, however, have the added advantage that, when a city is entirely encased in another city, it will always be accessible for electricity supply purposes.
Yes, it's an improvement.  I still will have to get around to that city merger code some day.... but I'm trying to clean up integer type conversions right now.
28
Simutrans-Extended development / Re: Serious bug in -devel: "also reverse" and "Mirror schedule" are not saved! fixed
As to what needs to be done before 9.x, I need to integrate and test this feature,

Hmm.  That's a nice feature, certainly, but the other changes in -devel probably deserve wider testing before it goes in.

Quote
as well as implement a feature to require depots to be built within city boundaries and have them contribute to local employment to an extent depending on their "level".

Ugh.  Please don't require depots to be built within city boundaries.  At the very least, make it possible for paks to turn this off.  I would always turn it off immediately.  It's horribly impractical.  Apart from the obvious (ship depots on the open ocean would become impossible unless there was a coastal city), I often end up with an isolated industrial railway (supplying coal to a power plant or something) and it is NOT reasonable to require me to put my depot hours and hours away in the city.

I strongly suggest abandoning that proposed feature.
29
Incorporated Patches and Solved Bug Reports / [cleanup patch] Don't use min() in quickstone
While attempting to clean up types in preparation for switching to template-based min/max functions, I found that the code in quickstone_tpl.h was actually cleaner and simpler without the use of min().  This rearranges the logic of the array extension, with the nice side effect of moving the main code out by one indentation level (with the error case in an if clause) -- and manages to avoid long arithmetic, too!

No behavior change.  Patch attached.
30
Incorporated Patches and Solved Bug Reports / [cleanup patch] clean up AUTOLINEAR number input
Another thing I ran into while preparing the codebase for templated min/max.  The code for the AUTOLINEAR mode in gui_numberinput.cc was slightly confused about types (and also inconsistent between the decrement and the increment modes).  The PROGRESS mode was also confused about types and the integer promotion rules.

These have been fixed to behave in a consistent manner; patch attached.
31
Simutrans-Extended closed bug reports / Re: Request for ****istance - bizarre error on merge
Nathaneal,

thank you very much for your help with this. I have been somewhat too tired to work on this to-day, but think that these warnings might be relevant, given what you wrote above:

Code: [Select]

1>f:\my documents\development\simutrans\simutrans-experimental-sources\gui\gui_container.h(79): warning C4091: 'virtual ' : ignored on left of 'gui_container_t' when no variable is declared
1>f:\my documents\development\simutrans\simutrans-experimental-sources\gui\settings_stats.h(209): warning C4584: 'settings_climates_stats_t' : base-cl**** 'gui_container_t' is already a base-cl**** of 'settings_stats_t'
1>          f:\my documents\development\simutrans\simutrans-experimental-sources\gui\gui_container.h(24) : see declaration of 'gui_container_t'
1>          f:\my documents\development\simutrans\simutrans-experimental-sources\gui\settings_stats.h(133) : see declaration of 'settings_stats_t'

Bingo.

The reason standard is working is that gui_container_t is *not* a public base cl**** of settings_stats_t in standard.

Bernd caused settings_stats_t to inherit from gui_container_t in experimental.

It's all related to this commit from Bernd:
http://github.com/neroden/simutrans/commit/13c4b9ffaec79f50f63847ce4a0752de4c758957

You have to apply the same change to the new cl**** settings_climate_stats_t which Bernd already applied to all the previously existing similar cl****es.  Replace this line in settings_stats.h:
Code: [Select]
cl**** settings_climates_stats_t : protected settings_stats_t, public gui_container_t, public action_listener_t
with this:
Code: [Select]
cl**** settings_climates_stats_t : public settings_stats_t, public action_listener_t

I'm betting that will do the trick.  But I haven't tested it yet. If you have any further problems don't hesitate to ask.  :-)
32
Incorporated Patches and Solved Bug Reports / [cleanup patch] hoist duplicate code to private method, increase type safety
I'm trying to get the codebase ready for use of typesafe template-style 'min' and 'max'.  This is too big a project to do all at once.  As I've been doing this, I've encountered some sections of code where the code is made much simpler by doing some other code cleanup at the same time, so I'm submitting those as individual patches in advance of the big change.

This is one of those patches.  Compiles and works by itself.
33
Patches & Projects / [cleanup patch] move #include directive to top of file
It's not good form to put an #include directive in the middle of a file, but such a thing was introduced recently.  This patch fixes this.

(Intended to be applied after the compilation / const correctness fix.)  EDIT: But can be applied independently.
34
Incorporated Patches and Solved Bug Reports / Fix compilation failure on gcc... by being const-correct
That 'casting away constness' bug?  Recent changes caused it to turn into a failure-to-compile bug on gcc.  (Sometimes the compiler believes you if you tell it that something is const....)  

I fixed it.  The function returns a non-const value now.  In addition, a section of code is restructured to use a modifiable lvalue rather than an rvalue.  Patch is attached.  (edit: compiles and runs.)