Thats something which should theoretically be possible with conditional orders, but I'm not the person to ask - I haven't touched the order code (Other than snarfing bits of it's GUI)Kogut wrote:Is it possible to make conditional train orders based on state of signal?
For example:
- wait for full load but leave if X signal is red (potential use: no more than n trains loading on one station)
- stop loading only if X signal is green (potential use: leave station only if mainline is empty)
etc
It require a lot of work but results may be great!
ProgSigs - Programmable Signals patch
Moderator: OpenTTD Developers
Re: ProgSigs - Programmable Signals patch for OpenTTD
Re: ProgSigs - Programmable Signals patch for OpenTTD
New revision. This is the first revision in which you can program, though the ways you can program it at the moment are limited.
Testing is highly appreciated.
For full details, see the first post.
Testing is highly appreciated.
For full details, see the first post.
- Attachments
-
- ProgSig-e26b81b-r19500.diff
- Latest revision
- (112.23 KiB) Downloaded 183 times
Re: ProgSigs - Programmable Signals patch - Now with editor!
Will the signals be able to check train information so you can deny certain trains to take a certain route for example?
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Re: ProgSigs - Programmable Signals patch for OpenTTD
To quote myself earlier
That feature certainly could be implemented on top of the ProgSigs framework - but it would take a slightly different kind of program (One which could look at the arriving train and allow/deny a route), and it would do it doing pathfinder penalties. In other words, such a feature would probably be implemented by selecting a "Pathfinding" or "Train Restrictions" option from a dropdown in the signal programming window.
OpenTTD only evaluates signals when (A) A train has entered the block behind them (In which case they go straight to red, don't pass go, don't collect £200), or (B) A train has left them, or (C) a presignal behind them has changed [OK, theres also (D), you've reprogrammed a signal...]. None of these times gives you access to a useful train (And you only get access sometimes anyway).Owen wrote:Restrictive/guiding signals are quite a different kettle of fish. Thats not to say they couldn't be implemented (Or even share code), just that they're not currently.
That feature certainly could be implemented on top of the ProgSigs framework - but it would take a slightly different kind of program (One which could look at the arriving train and allow/deny a route), and it would do it doing pathfinder penalties. In other words, such a feature would probably be implemented by selecting a "Pathfinding" or "Train Restrictions" option from a dropdown in the signal programming window.
Re: ProgSigs - Programmable Signals patch - Now with editor!
Revision 545263f, generated against r19504.
This version adds no new features. It just cleans up the code. It also fixes a bug in the save file validation code. Otherwise, it should be functionally identical.
Testing is, as always, appreciated.
This version adds no new features. It just cleans up the code. It also fixes a bug in the save file validation code. Otherwise, it should be functionally identical.
Testing is, as always, appreciated.
- Attachments
-
- ProgSig-545263f-r19504.diff
- (118.54 KiB) Downloaded 180 times
Re: ProgSigs - Programmable Signals patch - Now with editor!
Would anyone be interested in a 24/7 server running this patch?
Just asking. >_>
Just asking. >_>
Re: ProgSigs - Programmable Signals patch - Now with editor!
Were gonna run the next revision (That is, when I get the ability to look at arbitrary signals - and perhaps signal local variables - in) on #openttdcoop.dev.
Those changes are likely to change the save format, though, so starting now wouldn't be wise (I think I'm gonna version the SPRG chunk)
Those changes are likely to change the save format, though, so starting now wouldn't be wise (I think I'm gonna version the SPRG chunk)
Re: ProgSigs - Programmable Signals patch - Now with editor!
Ah, fine.
Also: not that I understand these signals yet, but this patch looks good. Adds a lot of flexibility to the game.
Also: not that I understand these signals yet, but this patch looks good. Adds a lot of flexibility to the game.
Re: ProgSigs - Programmable Signals patch - Now with editor!
New revision. This implements the major feature I'd wanted to get in: Arbitrary signal lookups. You can now look at any other exit signal you own on the map from within your programs.
Diff attached. Main other change is signal removal consolidation and some more cleanups to match the official style.
This version breaks backwards compatibility with previous savegames - that is, games from previous versions will not load (or if they do will behave weirdly).
Diff attached. Main other change is signal removal consolidation and some more cleanups to match the official style.
This version breaks backwards compatibility with previous savegames - that is, games from previous versions will not load (or if they do will behave weirdly).
- Attachments
-
- ProgSig-d79c64c-r19518.diff
- (134.5 KiB) Downloaded 160 times
Re: ProgSigs - Programmable Signals patch
Hi Owen,
while compiling I had a few warnings.
The game runs but I Did not get to playtesting yet.
while compiling I had a few warnings.
Code: Select all
[SRC] Compiling programmable_signals.cpp
~/src/programmable_signals.cpp: In member function â void SignalProgram::DebugPrintProgram()â :
~/src/programmable_signals.cpp:405: let op: format â %ldâ expects type â long intâ , but argument 3 has type â intâ
~/src/programmable_signals.cpp: In member function â virtual bool SignalVariableCondition::Evaluate(SignalVM&)â :
~/src/programmable_signals.cpp:114: let op: control reaches end of non-void function
~/src/programmable_signals.cpp: In function â CommandCost CmdModifySignalInstruction(TileIndex, DoCommandFlag, uint32, uint32, const char*)â :
~/src/programmable_signals.cpp:533: let op: â condâ may be used uninitialized in this function
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: ProgSigs - Programmable Signals patch
Thsoe warnings are all minor and I've fixed them & comitted them to the repo (No point spinning out a new patch just yet). A couple of them just required annotating branches as not used; the first has required adding some more casting to the DEBUG call.ChillCore wrote:Hi Owen,
while compiling I had a few warnings.The game runs but I Did not get to playtesting yet.Code: Select all
[SRC] Compiling programmable_signals.cpp ~/src/programmable_signals.cpp: In member function â void SignalProgram::DebugPrintProgram()â : ~/src/programmable_signals.cpp:405: let op: format â %ldâ expects type â long intâ , but argument 3 has type â intâ ~/src/programmable_signals.cpp: In member function â virtual bool SignalVariableCondition::Evaluate(SignalVM&)â : ~/src/programmable_signals.cpp:114: let op: control reaches end of non-void function ~/src/programmable_signals.cpp: In function â CommandCost CmdModifySignalInstruction(TileIndex, DoCommandFlag, uint32, uint32, const char*)â : ~/src/programmable_signals.cpp:533: let op: â condâ may be used uninitialized in this function
What compiler version are you using as it seems a little more picky than my GCC?
Re: ProgSigs - Programmable Signals patch
Terminal
A terminal emulator
Release 0.9.4
Author: Alexander Malmberg
I am on ubuntu 9.04
If you are on Windows you may want to give MinGW-MSYS a go. It seemed rather picky too when I was using that last year.
And according to some compiler bugfix I had to do, with some help, visual studio/express is even pickier.
A terminal emulator
Release 0.9.4
Author: Alexander Malmberg
I am on ubuntu 9.04
If you are on Windows you may want to give MinGW-MSYS a go. It seemed rather picky too when I was using that last year.
And according to some compiler bugfix I had to do, with some help, visual studio/express is even pickier.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: ProgSigs - Programmable Signals patch
The terminal emulator you use is pretty irrelevant, but the Ubuntu 9.04 is enough to tell me that mine is newer (I develop on 9.10, x86_64). Which makes me surprised it would be less picky.ChillCore wrote:Terminal
A terminal emulator
Release 0.9.4
Author: Alexander Malmberg
I am on ubuntu 9.04
If you are on Windows you may want to give MinGW-MSYS a go. It seemed rather picky too when I was using that last year.
And according to some compiler bugfix I had to do, with some help, visual studio/express is even pickier.
Re: ProgSigs - Programmable Signals patch
Bugfix!
Removing an If didn't remove the Else and Endif pseudo instructions properly. Saving would then crash as soon as the If's memory got reclaimed and used for something else. The game would then crash.
This bug was a really, really stupid error on my part
Removing an If didn't remove the Else and Endif pseudo instructions properly. Saving would then crash as soon as the If's memory got reclaimed and used for something else. The game would then crash.
This bug was a really, really stupid error on my part
- Attachments
-
- ProgSig-ec0e201-r19518.diff
- (134.6 KiB) Downloaded 170 times
Re: ProgSigs - Programmable Signals patch
Maybe it is a difference in the configuration file. I have attached mine (copied from the terminal output) if you want to compare.Owen wrote: The terminal emulator you use is pretty irrelevant, but the Ubuntu 9.04 is enough to tell me that mine is newer (I develop on 9.10, x86_64). Which makes me surprised it would be less picky.
I am new to ubuntu and its internals is still a still a big puzzle to me.
Compiling the new diff now ...
Edit: Cool ,no more compiler warnings.
- Attachments
-
- config.txt
- (2.69 KiB) Downloaded 189 times
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: ProgSigs - Programmable Signals patch
Bugfix release. This corrects a crash bug when deleting an If with a populated Else block, which was introduced by the previous fix for the Save crash regarding If blocks.
As you might have gathered, Ifs are somewhat complex.
As you might have gathered, Ifs are somewhat complex.
- Attachments
-
- ProgSig-2612770-r19519.diff
- (134.64 KiB) Downloaded 166 times
Re: ProgSigs - Programmable Signals patch
Hi Owen,
While having a better look at your patch I noticed you declare "STR_CONFIG_SETTING_SAMEINDCLOSE" in englich text.
However you do not seem to be using it anywhere ... I am testing and reading to see if the code is solid enough and what I may have to change for inclusion in my patchpack .
Is this something you have may have forgotten to remove or are you going to be using it in the future?
While having a better look at your patch I noticed you declare "STR_CONFIG_SETTING_SAMEINDCLOSE" in englich text.
However you do not seem to be using it anywhere ... I am testing and reading to see if the code is solid enough and what I may have to change for inclusion in my patchpack .
Is this something you have may have forgotten to remove or are you going to be using it in the future?
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: ProgSigs - Programmable Signals patch
Ill have a look, but it may take a while - a hdd has just died (my seccond in under a month! OMG!) so my dev environment is out of comission until i can replace it and get backups restored.
It sounds like a string removed in trunk recently which has gotten orphaned in my patch. Again, i'll look into it soon.
It sounds like a string removed in trunk recently which has gotten orphaned in my patch. Again, i'll look into it soon.
Re: ProgSigs - Programmable Signals patch
Sad to hear that. I hope you get your system back running again.Owen wrote: Ill have a look, but it may take a while - a hdd has just died (my seccond in under a month! OMG!) so my dev environment is out of comission until i can replace it and get backups restored.
Most likely that is what happened.It sounds like a string removed in trunk recently which has gotten orphaned in my patch. Again, i'll look into it soon.
Also, when using block signals after the programmable signal the logic seems to inversed. (or I am doing something wrong )
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: ProgSigs - Programmable Signals patch
OK, according to #openttd (Thanks andythenorth) frosch removed the close industries check recently. Git has obviously got a little confused with my somewhat complex history. I'll pull the string out soonMost likely that is what happened.It sounds like a string removed in trunk recently which has gotten orphaned in my patch. Again, i'll look into it soon.
It would be interesting to see what you're doing. I should probably create a wiki page documenting them...Also, when using block signals after the programmable signal the logic seems to inversed. (or I am doing something wrong )
Who is online
Users browsing this forum: Google [Bot] and 0 guests