Page 3 of 3
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 20 May 2008 18:09
by Gedemon
nycom, would it be a lot of work to make a version compatible with tracksharing ?
(ie : all trains should follow rules for a waypoint, not only the waypoint owner's trains)
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 29 May 2008 07:22
by zypa
Is this patch still in development?
It is a really useful patch. It would be a pitty if it will be really outdated in some weeks...
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 29 May 2008 10:52
by MacJariel
I found a bug. When you click on the waypoint gui window and miss any widget the game terminates:
Code: Select all
Error: NOT_REACHED triggered at line 83 of /usr/local/src/games/openttd/openttd-svn-routing-restriction/src/waypoint_gui.cpp
There is a simple fix: comment that line 83 in waypoint_gui.cpp.
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 29 May 2008 11:03
by planetmaker
MacJariel wrote:I found a bug. When you click on the waypoint gui window and miss any widget the game terminates:
Code: Select all
Error: NOT_REACHED triggered at line 83 of /usr/local/src/games/openttd/openttd-svn-routing-restriction/src/waypoint_gui.cpp
There is a simple fix: comment that line 83 in waypoint_gui.cpp.
That certainly is no fix, but a dirty hack. The lines which contain "NOT_REACHED" are parts of case or switch statements where all possibilities are handled before - and something went wrong, if they're reached. Basically commenting out this line is a fixing the symptoms rather than the cause.
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 29 May 2008 11:05
by richk67
Ah... commenting out. The "I dont understand it, and cannot debug it, so hide it and maybe it will go away." approach.
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 29 May 2008 11:16
by Roujin
Actually in this case, i'd say it is the right fix.
The author didn't handle all the widgets in the switchcase, only those that do something special. Thus the rest (like, background panel) gets handled by "default:", and thus, it shouldn't have NOT_REACHED().
Now the other way would be adding all missing widgets, with just a break; and then leave the NOT_REACHED() for default.
But why not let default handle all other widgets, for which nothing should happen?
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 29 May 2008 16:45
by zombie
Hi.
That's quite easy to answer: If you add a widget and forget handling it you get the error message on testing your modifications and you know where to add the code.
Kind regards
Zombie
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 29 May 2008 16:48
by Splatman
Updated to r13310, I have removed the default: NOT_REACHED(); to match the style of other OnClick() functions in the game.
I haven't done extensive testing, but it seems to work.
EDIT: Scrap that I forgot to include the extra files in the patch will upload a fixed version later.
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 29 May 2008 18:56
by nycom
Patch updated (cf first post)
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 29 May 2008 19:03
by nautre125
Would it be possible to implement programmable signals ? having signals that turn red if the oncoming trains doesn't match the conditions. I didn't looked into your code but the principle of programmable waypoints makes me think of the TTDP feature: programmable signals.
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 29 May 2008 21:08
by Roujin
zombie wrote:Hi.
That's quite easy to answer: If you add a widget and forget handling it you get the error message on testing your modifications and you know where to add the code.
Kind regards
Zombie
Uhmm.. yeah, makes sense.
Still kind of arkward imo adding special cases for all the widgets only to tell it to do nothing with them.
In the long run you're right though..
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 30 May 2008 18:42
by Splatman
I've found a bug, when you try to save multiline rules in multiplayer the game gets stuck in an infinite loop on a DoCommandP in rule_gui.cpp it seems to be the following lines
Code: Select all
while (rs->GetNumCriteria() < this->num_criteria)
DoCommandP(0, rs->index, 0, NULL, CMD_ADD_CRITERIA | CMD_MSG(STR_RULE_CAN_T_ADD_CRITERIA));
while (rs->GetNumCriteria() > this->num_criteria)
DoCommandP(0, rs->index, rs->GetNumCriteria() - 1, NULL, CMD_DELETE_CRITERIA | CMD_MSG(STR_RULE_CAN_T_DELETE_CRITERIA));
It gets stuck on the fist DoCommandP. This seems to be because the Command is queued, but can't ever execute because the while loop is still running.
Re: Routing Restriction (Programmable waypoint) / Virtual group
Posted: 22 Sep 2008 00:42
by sir_schwick
Any chance you or somebody closely related is going to extend the rule options to other forms of transport? This patch is extremely useful and time saving, but would be ultra useful for quickly grouping road vehicles. Excellent work!