progsig: Fix remove and clone program functions being completely broken.

Remove function only removed instructions from the local machine, and
was therefore not MP safe.
Clone function failed to work correctly for non-trivial cases,
and sometimes caused an array out of bounds assertion.

These are replaced by a new commandproc which does each operation
as a single action, which is therefore MP safe.

Remove an unused struct field.
This commit is contained in:
Jonathan G Rennison
2015-11-24 01:03:09 +00:00
parent 8760187899
commit 769b8ae096
5 changed files with 142 additions and 70 deletions

View File

@@ -28,6 +28,11 @@ class SignalInstruction;
class SignalSpecial;
typedef SmallVector<SignalInstruction*, 4> InstructionList;
enum SignalProgramMgmtCode {
SPMC_REMOVE, ///< Remove program
SPMC_CLONE, ///< Clone program
};
/** The actual programmable signal information */
struct SignalProgram {
SignalProgram(TileIndex tile, Track track, bool raw = false);
@@ -212,7 +217,6 @@ class SignalStateCondition: public SignalCondition {
SignalReference this_sig;
TileIndex sig_tile;
Trackdir sig_track;
SignalState state;
};
// -- Instructions