News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

Recent posts

#91
Patches & Projects / Re: Freight list sorter - fix ...
Last post by prissi - September 28, 2025, 12:33:29 PM
I still think the XOR should be an or, because if merge is true, we should also break ...
#92
Patches & Projects / Bridge renovation
Last post by Nazalassa - September 28, 2025, 10:53:15 AM
Until now, the only way to upgrade/renovate a bridge was to remove it and rebuild it. This is not very practical and may lead to traffic problems when there are e.g stations or tram tracks on the bridge.

This patch modifies the behaviour of the bridge builder tool so that, when used on a bridge, it attempts to replace the old bridge with a new one (depending on which bridge was selected).
For example, using the "160 km/h bridge" tool on a "100 km/h bridge" replaces the 100 km/h bridge with a 160 km/h one, without having to remove and then rebuild it.
The tool checks whether the new bridge's length and height constraints are respected.
Players can renovate unowned bridges, public bridges and their own bridges only. Players get ownership of bridges they renovate.

It only works when clicking on one of the bridge's ends, though. (Due to sharing some logic with the bridge remover tool.)

renovate-bridge.gif

Another patch adds a test but the test is yet untested.
#93
Patches & Projects / Re: Freight list sorter - fix ...
Last post by Nazalassa - September 28, 2025, 06:36:49 AM
Quote from: prissi on September 28, 2025, 03:19:53 AMI think one needs to compare the wares' catg, not the good index. Also I found the logic a little convoluted, as it has to be either two line ore not. How about
                        // not same via halt, but maybe same lines
                        for (linehandle_t const& line : h->registered_lines) {
                            if (line->get_goods_catg_index().is_contained(ware.get_catg())) {
                                // only merge if both can travel with the same line to their stop
                                bool has_line1 = w_next->registered_lines.is_contained(line);
                                bool has_line2 = wi_next->registered_lines.is_contained(line);
                                merge = has_line1 && has_line2;
                                has_line = has_line1 || has_line2;
                            }
                        }

I see an issue with your code: it is equivalent to checking only the last line of h->registered_lines that can transport the wares. If it enters the "if", then merge and has_line will be overwritten and we will lose all information about the previous lines.

To be clear, the logic I have in mind is:
 - If no lines in common, try lineless convoys
 - If at least one line in common:
      - If one can take a line which the other cannot take: don't merge
      - Otherwise, i.e they can take the exact same lines: merge
Meaning wares will be merged if, and only if, they can take the exact same lines and (they can at least take one line, or they have a lineless convoy in common).

I would suggest:
                        // not same via halt, but maybe same lines
                        for (linehandle_t const& line : h->registered_lines) {
                            if (line->get_goods_catg_index().is_contained(ware.get_catg())) {
                                // only merge if both can travel with the same line to their stop
                                bool has_line1 = w_next->registered_lines.is_contained(line);
                                bool has_line2 = wi_next->registered_lines.is_contained(line);
                                has_line = has_line || has_line1 || has_line2;
                                if (has_line1 || has_line2)
                                    merge = has_line1 && has_line2;
                                if (has_line1 ^ has_line2)
                                    break;
                            }
                        }
- Do not overwrite has_line (that was my mistake).
- Do not overwrite merge if none can take the line; otherwise it may overwrite a previous "true".
- Break if one can take the line but not the other, because in this case we know they cannot be merged, so no reason to keep looping.
#94
Patches & Projects / Re: Freight list sorter - fix ...
Last post by prissi - September 28, 2025, 03:19:53 AM
I think one needs to compare the wares' catg, not the good index. Also I found the logic a little convoluted, as it has to be either two line ore not. How about
                        // not same via halt, but maybe same lines
                        for (linehandle_t const& line : h->registered_lines) {
                            if (line->get_goods_catg_index().is_contained(ware.get_catg())) {
                                // only merge if both can travel with the same line to their stop
                                bool has_line1 = w_next->registered_lines.is_contained(line);
                                bool has_line2 = wi_next->registered_lines.is_contained(line);
                                merge = has_line1 && has_line2;
                                has_line = has_line1 || has_line2;
                            }
                        }
#95
Patches & Projects / Re: Freight list sorter - fix ...
Last post by Nazalassa - September 27, 2025, 04:28:36 PM
Found (yet another) bug in the patch. How it escaped the compiler's wrath is still unknown.
#96
Today it works. Not sure what happened Yesterday. However, my testcase also worked with the old code, as long as it was not backwards. Anyway, thanks for finding this well-hidden bug. Sumitted in r11761
#97
really!? but my code does work well in my environment.
I send patch and image during debugging.
#98
If I use the suggested code, the curved choossignal stopped working in my tests, it only works with the code as it is.
#99
In rail_vehicle_t::is_choose_signal_clear(), the richtung used in route_t::find_route() is defined as
const int richtung = ribi_type(get_pos(), pos_next);in vehicle/rail_vehicle.cc, l438.
But, if the next signal of pre-signal is choose-signal, this ribi can be wrong and route_t::find_route() does not work well, because this vehicle is not on the tile with choose-signal.
So, I think it should be
const int richtung = ribi_type(cnv->get_route()->at(start_block),cnv->get_route()->at(start_block+1));then, pre-signal can always check next choose-signal.
#100
Forum / emails from simutrans forum
Last post by makie - September 24, 2025, 08:09:56 AM
I don't get any emails from the forum.

Today I happened to look at the log of my mail server and think this is the reason:
QuoteSep 23 18:46:11 m11 postfix/smtpd[78804]: NOQUEUE: reject: RCPT from unknown[69.30.245.114]: 450 4.7.25 Client host rejected: cannot find your hostname, [69.30.245.114]; from=<daychilde...deleted....com> to=<... deletet ...> proto=ESMTP helo=<s1.mh1.one>
I have now configured an exception for 69.30.245.114, now the mails arrive.
But most mail servers do not accept mails from unknown ip adresses.