]> git.tdb.fi Git - r2c2.git/log
r2c2.git
9 years agoAvoid going past the end of route when a new one is set
Mikko Rasa [Tue, 3 Feb 2015 14:23:01 +0000 (16:23 +0200)]
Avoid going past the end of route when a new one is set

Calling stop_at(0) causes the block allocator to immediately resume
allocating blocks.  In certain circumstances this would cause an
allocation past the end of the route.

9 years agoMake sure the shadow volume does not have zero size
Mikko Rasa [Mon, 2 Feb 2015 17:51:42 +0000 (19:51 +0200)]
Make sure the shadow volume does not have zero size

9 years agoImprove accessory switching logic
Mikko Rasa [Mon, 2 Feb 2015 17:40:43 +0000 (19:40 +0200)]
Improve accessory switching logic

The off command can be sent as soon as the current monitor indicates that
the solenoid is no longer drawing power.  This allows giving multi-bit
accessories more time to accommodate quirks of the 74465 decoder.

9 years agoAdd debug output for accessory switching in ArduControl
Mikko Rasa [Mon, 2 Feb 2015 17:37:16 +0000 (19:37 +0200)]
Add debug output for accessory switching in ArduControl

9 years agoAvoid invalid states when setting multi-bit accessories
Mikko Rasa [Mon, 2 Feb 2015 17:21:53 +0000 (19:21 +0200)]
Avoid invalid states when setting multi-bit accessories

9 years agoAdd a dialog to control the clock
Mikko Rasa [Fri, 30 Jan 2015 09:03:34 +0000 (11:03 +0200)]
Add a dialog to control the clock

9 years agoEnsure that Timetable has necessary helper AIs
Mikko Rasa [Thu, 29 Jan 2015 16:50:52 +0000 (18:50 +0200)]
Ensure that Timetable has necessary helper AIs

Since AIControl and TrainRouter don't emit statements to the state file,
they are not created automatically when loading the state.  If they are
missing, the timetable won't be able to operate.

9 years agoAdapt to changes in vector slicing and composing API
Mikko Rasa [Wed, 28 Jan 2015 18:47:28 +0000 (20:47 +0200)]
Adapt to changes in vector slicing and composing API

10 years agoSet lighting for the sky pass too
Mikko Rasa [Sun, 13 Jul 2014 13:56:11 +0000 (16:56 +0300)]
Set lighting for the sky pass too

Otherwise whatever parameters were there before will get used, resulting
in incorrect rendering with multiple views.

10 years agoImprove lighting color computations
Mikko Rasa [Sun, 13 Jul 2014 13:48:14 +0000 (16:48 +0300)]
Improve lighting color computations

This produces a bit too bluish skylight and a bit too reddish sunlight,
but it's a step in the right direction.

10 years agoImprove graphics quality with some shaders and effects
Mikko Rasa [Thu, 8 May 2014 21:39:11 +0000 (00:39 +0300)]
Improve graphics quality with some shaders and effects

Lighting is now carried out in linear colorspace and sRGB conversion
applied in postprocessing.  All these effects will probably make the
program really slow on lower-end machines, but I'll fix that later.

10 years agoGet rid of some obsolete #includes
Mikko Rasa [Thu, 8 May 2014 15:27:10 +0000 (18:27 +0300)]
Get rid of some obsolete #includes

10 years agoAvoid segfault if an exception is thrown while loading
Mikko Rasa [Wed, 7 May 2014 20:26:13 +0000 (23:26 +0300)]
Avoid segfault if an exception is thrown while loading

The Layout::add functions are called from object constructors.  If an
exception is thrown inside them, the constructor will abort and the
object will be deleted.  If that happens, it must be removed from the
Layout as well, or an invalid memory access will occur later.

10 years agoReorganize data files into a directory structure
Mikko Rasa [Wed, 7 May 2014 20:14:49 +0000 (23:14 +0300)]
Reorganize data files into a directory structure

All object types have been split out of the *.dat files into individual
files.  As a side effect, their names have acquired a type-specific
suffix.

10 years agoBe more consistent with the use of name and description
Mikko Rasa [Sun, 4 May 2014 21:08:46 +0000 (00:08 +0300)]
Be more consistent with the use of name and description

10 years agoRemove some unnecessary things
Mikko Rasa [Sun, 4 May 2014 20:23:59 +0000 (23:23 +0300)]
Remove some unnecessary things

10 years agoRework article numbers
Mikko Rasa [Sun, 4 May 2014 19:10:34 +0000 (22:10 +0300)]
Rework article numbers

10 years agoAvoid crash in SlopeTool if nothing is selected
Mikko Rasa [Sun, 4 May 2014 17:36:44 +0000 (20:36 +0300)]
Avoid crash in SlopeTool if nothing is selected

10 years agoSupport multiple TrackAppearances in Catalogue
Mikko Rasa [Sun, 4 May 2014 09:11:37 +0000 (12:11 +0300)]
Support multiple TrackAppearances in Catalogue

10 years agoConvert Catalogue to a Collection
Mikko Rasa [Sun, 4 May 2014 07:47:49 +0000 (10:47 +0300)]
Convert Catalogue to a Collection

Since this involves changing the key from ArticleNumber to std::string,
existing layout and state files need to be adjusted by hand.

10 years agoThings with different gauges don't go together
Mikko Rasa [Sat, 3 May 2014 11:04:14 +0000 (14:04 +0300)]
Things with different gauges don't go together

10 years agoAdd a shortcut for getting the gauge of a TrackType
Mikko Rasa [Sat, 3 May 2014 11:03:33 +0000 (14:03 +0300)]
Add a shortcut for getting the gauge of a TrackType

10 years agoAlso store gauge in VehicleType
Mikko Rasa [Sat, 3 May 2014 10:59:57 +0000 (13:59 +0300)]
Also store gauge in VehicleType

10 years agoSet depth clip in View3D::view_all
Mikko Rasa [Sat, 3 May 2014 09:18:18 +0000 (12:18 +0300)]
Set depth clip in View3D::view_all

10 years agoFix a bug with attaching ends in ExtendTool
Mikko Rasa [Sat, 3 May 2014 09:17:07 +0000 (12:17 +0300)]
Fix a bug with attaching ends in ExtendTool

This managed to avoid a segfault despite the null pointer dereference,
because the first thing Track::link_to does is check if the passed-in
reference is a track, and a null pointer isn't.

10 years agoMove gauge to TrackAppearance
Mikko Rasa [Sat, 3 May 2014 09:15:22 +0000 (12:15 +0300)]
Move gauge to TrackAppearance

It may eventually be desirable to have multiple gauges in the same layout
(narrow-gauge trams together with a standard-gauge railway, for example),
and this is a necessary step towards that.

10 years agoOverhaul SvgExporter to use SVG defs for tracks
Mikko Rasa [Fri, 2 May 2014 20:53:16 +0000 (23:53 +0300)]
Overhaul SvgExporter to use SVG defs for tracks

This produces much more compact SVG files than outputting the paths for
each track separately.

10 years agoUse GL::Resources and DirectorySource in Catalogue3D
Mikko Rasa [Tue, 29 Apr 2014 05:32:22 +0000 (08:32 +0300)]
Use GL::Resources and DirectorySource in Catalogue3D

10 years agoImprove comments
Mikko Rasa [Wed, 16 Apr 2014 19:02:01 +0000 (22:02 +0300)]
Improve comments

10 years agoAlways handle sequence checks in tick()
Mikko Rasa [Wed, 16 Apr 2014 19:00:54 +0000 (22:00 +0300)]
Always handle sequence checks in tick()

10 years agoBegin arrival immediately if the entire route has already been reserved
Mikko Rasa [Wed, 16 Apr 2014 18:55:39 +0000 (21:55 +0300)]
Begin arrival immediately if the entire route has already been reserved

10 years agoKeep routes until the train has completely left them
Mikko Rasa [Tue, 15 Apr 2014 19:58:07 +0000 (22:58 +0300)]
Keep routes until the train has completely left them

10 years agoTinker with arrival logic
Mikko Rasa [Tue, 15 Apr 2014 19:20:10 +0000 (22:20 +0300)]
Tinker with arrival logic

10 years agoAdd a signal for advancing the rear end of the train
Mikko Rasa [Tue, 15 Apr 2014 15:41:36 +0000 (18:41 +0300)]
Add a signal for advancing the rear end of the train

10 years agoMove members after type declarations
Mikko Rasa [Tue, 15 Apr 2014 15:37:03 +0000 (18:37 +0300)]
Move members after type declarations

10 years agoRemove a function that was never used
Mikko Rasa [Tue, 15 Apr 2014 15:36:36 +0000 (18:36 +0300)]
Remove a function that was never used

10 years agoKeep better track of routes
Mikko Rasa [Tue, 15 Apr 2014 15:25:34 +0000 (18:25 +0300)]
Keep better track of routes

Finding the correct route for each allocated block from scratch is prone
to errors if the combined route contains loops.

10 years agoSimplify sequence handling
Mikko Rasa [Mon, 14 Apr 2014 06:00:30 +0000 (09:00 +0300)]
Simplify sequence handling

Instead of checking all sequence points when another train reserves a
block, only check the first one.  The subsequent ones can be checked
when they become relevant.

10 years agoRedesign the interface between TrainRouter and TrainRoutePlanner
Mikko Rasa [Mon, 14 Apr 2014 05:01:36 +0000 (08:01 +0300)]
Redesign the interface between TrainRouter and TrainRoutePlanner

This will make it easier to move planning to a separate thread in the
future.

10 years agoRefactor TrainRoutePlanner so that the same object may be used again
Mikko Rasa [Sun, 13 Apr 2014 17:02:42 +0000 (20:02 +0300)]
Refactor TrainRoutePlanner so that the same object may be used again

This is unlikely to be needed, but it makes the design more robust.

10 years agoAvoid creating looping routes
Mikko Rasa [Sat, 12 Apr 2014 19:45:27 +0000 (22:45 +0300)]
Avoid creating looping routes

If th route went past its end, adding the turnout would cause a loop to
be created.  Trying to add the next track would then throw bad_chain.

10 years agoReplace waits with a more robust sequencing system
Mikko Rasa [Sat, 12 Apr 2014 19:32:03 +0000 (22:32 +0300)]
Replace waits with a more robust sequencing system

10 years agoUse set_route for the first route
Mikko Rasa [Sat, 12 Apr 2014 19:29:23 +0000 (22:29 +0300)]
Use set_route for the first route

10 years agoDon't pick a route that doesn't know how to set the turnout
Mikko Rasa [Fri, 11 Apr 2014 19:59:16 +0000 (22:59 +0300)]
Don't pick a route that doesn't know how to set the turnout

10 years agoDiverge from a route early only if it's a loop
Mikko Rasa [Fri, 11 Apr 2014 19:31:18 +0000 (22:31 +0300)]
Diverge from a route early only if it's a loop

This does not entirely fix handling of chained routes, but it's a step in
the right direction.

10 years agoUse a better cost estimator for the route planner
Mikko Rasa [Fri, 11 Apr 2014 19:12:39 +0000 (22:12 +0300)]
Use a better cost estimator for the route planner

Total time is not good because it doesn't penalize waiting time for
earlier trains.  This can cause the state tree to explode as later ones
start moving.

The sum of travel and wait times for each train works much better.

10 years agoFix lead route generation
Mikko Rasa [Fri, 11 Apr 2014 18:18:09 +0000 (21:18 +0300)]
Fix lead route generation

Lead routes are now created up to the target, but not past it.  This fixes
a problem where a route diverging from the train's reserved blocks caused
the router to attempt to create a lead route with gaps.

10 years agoAdd a function to check if a track chain forms a loop
Mikko Rasa [Fri, 11 Apr 2014 17:28:56 +0000 (20:28 +0300)]
Add a function to check if a track chain forms a loop

10 years agoPopulate the target variable when a timetable row is selected
Mikko Rasa [Fri, 11 Apr 2014 17:24:51 +0000 (20:24 +0300)]
Populate the target variable when a timetable row is selected

Failing to do so will clear the target from the row when applying changes.

10 years agoUse signal_advanced for train speed measurement and vehicle placement
Mikko Rasa [Fri, 11 Apr 2014 17:24:30 +0000 (20:24 +0300)]
Use signal_advanced for train speed measurement and vehicle placement

It's stupid to try to reproduce the logic of checking whether this is the
correct sensor when BlockAllocator has that information already.

10 years agoPut signal_advanced in BlockAllocator
Mikko Rasa [Fri, 11 Apr 2014 05:27:54 +0000 (08:27 +0300)]
Put signal_advanced in BlockAllocator

It's bad practice to emit other objects' signals.

10 years agoUse the endpoint closest to the pointer when placing trains
Mikko Rasa [Thu, 10 Apr 2014 23:06:18 +0000 (02:06 +0300)]
Use the endpoint closest to the pointer when placing trains

10 years agoFurther fix delay handling
Mikko Rasa [Thu, 10 Apr 2014 22:54:47 +0000 (01:54 +0300)]
Further fix delay handling

10 years agoTrack trains' remaining estimate by distance, not time
Mikko Rasa [Thu, 10 Apr 2014 22:50:43 +0000 (01:50 +0300)]
Track trains' remaining estimate by distance, not time

This makes it easier to keep correct since delay is not included.

10 years agoDon't return indeterminate paths from Route::get_path
Mikko Rasa [Thu, 10 Apr 2014 19:49:52 +0000 (22:49 +0300)]
Don't return indeterminate paths from Route::get_path

Return the active path of the track instead.

10 years agoUse path coercion in track iterators
Mikko Rasa [Thu, 10 Apr 2014 19:04:03 +0000 (22:04 +0300)]
Use path coercion in track iterators

This enforces common traversal rules in all places.  It also fixes a bug
in TrackOffsetIter where moving to a turnout from an endpoint not on the
selected path would potentially cause an out-of-range iterator to be
created.

10 years agoMake sure TrackOffsetIters make sense
Mikko Rasa [Thu, 10 Apr 2014 19:02:39 +0000 (22:02 +0300)]
Make sure TrackOffsetIters make sense

Disallow creation of iterators that have a path not connected to the
entry endpoint, or an out of range offset.

10 years agoMove path coercion to TrackType
Mikko Rasa [Thu, 10 Apr 2014 19:01:54 +0000 (22:01 +0300)]
Move path coercion to TrackType

10 years agoSet speed slider range from the advertised top speed of the train
Mikko Rasa [Wed, 9 Apr 2014 21:23:42 +0000 (00:23 +0300)]
Set speed slider range from the advertised top speed of the train

10 years agoPut emergency highlights on a higher layer
Mikko Rasa [Wed, 9 Apr 2014 21:18:10 +0000 (00:18 +0300)]
Put emergency highlights on a higher layer

10 years agoExport properly formatted track statements from shoppinglist
Mikko Rasa [Tue, 8 Apr 2014 19:56:42 +0000 (22:56 +0300)]
Export properly formatted track statements from shoppinglist

10 years agoDo not tick the clock while halted
Mikko Rasa [Tue, 8 Apr 2014 18:48:11 +0000 (21:48 +0300)]
Do not tick the clock while halted

10 years agoImplement halt in the dummy driver
Mikko Rasa [Tue, 8 Apr 2014 18:47:53 +0000 (21:47 +0300)]
Implement halt in the dummy driver

10 years agoDisplay blinking red markers on blocks where emergencies have occurred
Mikko Rasa [Tue, 8 Apr 2014 18:47:07 +0000 (21:47 +0300)]
Display blinking red markers on blocks where emergencies have occurred

10 years agoInclude block in the emergency signal
Mikko Rasa [Tue, 8 Apr 2014 18:33:40 +0000 (21:33 +0300)]
Include block in the emergency signal

10 years agoAlso use halt in sighandler
Mikko Rasa [Tue, 8 Apr 2014 18:31:28 +0000 (21:31 +0300)]
Also use halt in sighandler

10 years agoDon't set pure_speed and accurate_position when halted
Mikko Rasa [Sun, 6 Apr 2014 20:28:53 +0000 (23:28 +0300)]
Don't set pure_speed and accurate_position when halted

It may happen that the train has enough momentum to roll onto the next
sensor when halt occurs.  Setting accurate_position in this case is
likely to cause a sensor missed emergency when halt is lifted, as the
physical locomotive takes a moment to get up to speed again.

10 years agoReact to overcurrent events
Mikko Rasa [Sun, 6 Apr 2014 20:28:03 +0000 (23:28 +0300)]
React to overcurrent events

10 years agoFix handling of uncertain bits in accessories
Mikko Rasa [Sun, 6 Apr 2014 20:08:32 +0000 (23:08 +0300)]
Fix handling of uncertain bits in accessories

When the state of an accessory is first set, send commands for all
uncertain bits.  Otherwise the accessory could remain unsynced or a
failure could go undetected.

Always clear the uncertain bit after setting an accessory, not only
when it failed.

10 years agoDon't wait for queued accessories if power is off
Mikko Rasa [Sat, 5 Apr 2014 14:42:28 +0000 (17:42 +0300)]
Don't wait for queued accessories if power is off

10 years agoFix an error in calculating curved TrackPart points
Mikko Rasa [Fri, 4 Apr 2014 16:59:03 +0000 (19:59 +0300)]
Fix an error in calculating curved TrackPart points

10 years agoPrefer is_turnout() when checking if a track is, in fact, a turnout
Mikko Rasa [Fri, 4 Apr 2014 16:57:54 +0000 (19:57 +0300)]
Prefer is_turnout() when checking if a track is, in fact, a turnout

10 years agoCreate multiple routes if the planned route crosses itself
Mikko Rasa [Fri, 4 Apr 2014 16:43:27 +0000 (19:43 +0300)]
Create multiple routes if the planned route crosses itself

10 years agoAllow queueing multiple routes for a train
Mikko Rasa [Fri, 4 Apr 2014 16:40:10 +0000 (19:40 +0300)]
Allow queueing multiple routes for a train

10 years agoAttempt to resync ArduControl if there's no response to a command
Mikko Rasa [Fri, 4 Apr 2014 15:47:54 +0000 (18:47 +0300)]
Attempt to resync ArduControl if there's no response to a command

10 years agoAdd a timeout to ArduControl commands
Mikko Rasa [Fri, 4 Apr 2014 15:47:13 +0000 (18:47 +0300)]
Add a timeout to ArduControl commands

10 years agoRemove an unused mutex
Mikko Rasa [Fri, 4 Apr 2014 15:46:40 +0000 (18:46 +0300)]
Remove an unused mutex

10 years agoStore the Transform in TrackPart instead of creating it on the fly
Mikko Rasa [Wed, 2 Apr 2014 20:41:06 +0000 (23:41 +0300)]
Store the Transform in TrackPart instead of creating it on the fly

10 years agoUse elevation granularity for terrain Z positions
Mikko Rasa [Wed, 2 Apr 2014 20:20:21 +0000 (23:20 +0300)]
Use elevation granularity for terrain Z positions

10 years agoInstead of setting the speed of all locomotives, just enable halt mode
Mikko Rasa [Wed, 2 Apr 2014 20:15:49 +0000 (23:15 +0300)]
Instead of setting the speed of all locomotives, just enable halt mode

The old code was causing an exception and segfault with ArduControl,
since locomotive IDs are not equal to their addresses.

10 years agoImplement flush() for ArduControl
Mikko Rasa [Wed, 2 Apr 2014 20:15:26 +0000 (23:15 +0300)]
Implement flush() for ArduControl

10 years agoLift selection wraps slightly off the ground
Mikko Rasa [Wed, 2 Apr 2014 20:14:51 +0000 (23:14 +0300)]
Lift selection wraps slightly off the ground

10 years agoImprove tool status display
Mikko Rasa [Wed, 2 Apr 2014 20:12:55 +0000 (23:12 +0300)]
Improve tool status display

If a tool finishes instantly and displays a status (such as SlopeTool
or ExtendTool when they encounter an error during construction), do not
replace it with the selection tool status.

10 years agoFix some bad behavior in tools
Mikko Rasa [Wed, 2 Apr 2014 19:57:22 +0000 (22:57 +0300)]
Fix some bad behavior in tools

10 years agoDo not attempt to switch accessories while power is off
Mikko Rasa [Wed, 2 Apr 2014 16:40:33 +0000 (19:40 +0300)]
Do not attempt to switch accessories while power is off

Any changes in accessory state are held in the queue and performed once
power is restored.

10 years agoImplement halt mode to ArduControl
Mikko Rasa [Wed, 2 Apr 2014 16:40:11 +0000 (19:40 +0300)]
Implement halt mode to ArduControl

10 years agoUse current monitoring to detect failed turnouts
Mikko Rasa [Tue, 1 Apr 2014 18:35:31 +0000 (21:35 +0300)]
Use current monitoring to detect failed turnouts

The turnout solenoid takes quite a bit of current, which is easy to
detect.  If there's no current spike after activating a solenoid, it
may have a broken microswitch that prevents operation.

10 years agoBasic support for failed turnout detection
Mikko Rasa [Tue, 1 Apr 2014 18:28:36 +0000 (21:28 +0300)]
Basic support for failed turnout detection

10 years agoAdd voltage and current monitoring task to ArduControl
Mikko Rasa [Tue, 1 Apr 2014 18:25:15 +0000 (21:25 +0300)]
Add voltage and current monitoring task to ArduControl

It's not used for anything yet, bit will be soon.

10 years agoKeep track of the active accessory bit index
Mikko Rasa [Tue, 1 Apr 2014 18:14:35 +0000 (21:14 +0300)]
Keep track of the active accessory bit index

Failing to do this may theoretically cause trouble if a multi-bit
accessory spans a k83 module boundary.  Sending a deactivation command
for the first bit would only turn off the first module but not the
second.

10 years agoArduControl debugging tweaks
Mikko Rasa [Mon, 31 Mar 2014 19:34:00 +0000 (22:34 +0300)]
ArduControl debugging tweaks

10 years agoAdd helper class for processing driver options
Mikko Rasa [Mon, 31 Mar 2014 14:27:14 +0000 (17:27 +0300)]
Add helper class for processing driver options

10 years agoAdd a missing initializer
Mikko Rasa [Sun, 30 Mar 2014 18:14:06 +0000 (21:14 +0300)]
Add a missing initializer

10 years agoRemove some unnecessary braces and an outdated comment
Mikko Rasa [Sun, 30 Mar 2014 18:13:14 +0000 (21:13 +0300)]
Remove some unnecessary braces and an outdated comment

10 years agoPass goto target with the correct type
Mikko Rasa [Sun, 30 Mar 2014 18:11:44 +0000 (21:11 +0300)]
Pass goto target with the correct type

10 years agoAdd a distance metric to turn the routing into an A* search
Mikko Rasa [Sun, 30 Mar 2014 17:22:31 +0000 (20:22 +0300)]
Add a distance metric to turn the routing into an A* search

The original straightforward implementation exploded in complexity much
sooner than I expected.  The reasons are not entirely clear, but the
inability to converge states and drop those where the same position was
already reached through a faster path may have something to do with it.

10 years agoMaintain a separate list of pending RoutingStates
Mikko Rasa [Sun, 30 Mar 2014 17:13:53 +0000 (20:13 +0300)]
Maintain a separate list of pending RoutingStates

10 years agoCheck that occupied_track is not null before accessing it
Mikko Rasa [Sun, 30 Mar 2014 16:36:47 +0000 (19:36 +0300)]
Check that occupied_track is not null before accessing it

This could only happen if an exception is thrown from TrainRoutingState
constructor, but the resulting segfault can act as a red herring and
distract from the actual cause.

10 years agoRename is_occupied to is_occupying
Mikko Rasa [Sun, 30 Mar 2014 13:46:53 +0000 (16:46 +0300)]
Rename is_occupied to is_occupying

This reflects the function's actual purpose better.

10 years agoMake deadlock detection more robust
Mikko Rasa [Sun, 30 Mar 2014 13:43:54 +0000 (16:43 +0300)]
Make deadlock detection more robust

Deadlock cycles involving more than two trains can now be detected.