diff --git a/src/programmable_signals.cpp b/src/programmable_signals.cpp index 58d8865919..bfa1261e86 100644 --- a/src/programmable_signals.cpp +++ b/src/programmable_signals.cpp @@ -428,7 +428,7 @@ void RemoveProgramDependencies(SignalReference by, SignalReference on) } } - AddTrackToSignalBuffer(by.tile, by.track, GetTileOwner(by.tile)); + AddTrackToSignalBuffer(by.tile, by.track, GetTileOwner(by.tile)); UpdateSignalsInBuffer(); } diff --git a/src/programmable_signals.h b/src/programmable_signals.h index d9bb94d4c1..29909b9918 100644 --- a/src/programmable_signals.h +++ b/src/programmable_signals.h @@ -33,10 +33,10 @@ struct SignalProgram { SignalProgram(TileIndex tile, Track track, bool raw = false); ~SignalProgram(); void DebugPrintProgram(); - + TileIndex tile; Track track; - + SignalSpecial *first_instruction; SignalSpecial *last_instruction; InstructionList instructions; @@ -55,7 +55,7 @@ enum SignalOpcode { PSO_IF_ELSE = 3, ///< If Else pseudo instruction PSO_IF_ENDIF = 4, ///< If Endif pseudo instruction PSO_SET_SIGNAL = 5, ///< Set signal instruction - + PSO_END, PSO_INVALID = 0xFF }; @@ -66,22 +66,22 @@ class SignalInstruction { public: /// Get the instruction's opcode inline SignalOpcode Opcode() const { return this->opcode; } - + /// Get the previous instruction. If this is NULL, then this is the first /// instruction. inline SignalInstruction *Previous() const { return this->previous; } - + /// Get the Id of this instruction - inline int Id() const + inline int Id() const // Const cast is safe (perculiarity of SmallVector) { return program->instructions.FindIndex(const_cast(this)); } - + /// Insert this instruction, placing it before @p before_insn virtual void Insert(SignalInstruction *before_insn); - + /// Evaluate the instruction. The instruction should update the VM state. virtual void Evaluate(SignalVM &vm) = 0; - + /// Remove the instruction. When removing itself, an instruction should /// virtual void Remove() = 0; - + /// Gets a reference to the previous member. This is only intended for use by /// the saveload code. inline SignalInstruction *&GetPrevHandle() { return previous; } - - /// Sets the previous instruction of this instruction. This is only intended + + /// Sets the previous instruction of this instruction. This is only intended /// to be used by instructions to update links during insertion and removal. inline void SetPrevious(SignalInstruction *prev) { previous = prev; } /// Set the next instruction. This is only intended to be used by instructions /// to update links during insertion and removal virtual void SetNext(SignalInstruction *next_insn) = 0; - + protected: /// Constructs an instruction /// @param prog the program to add this instruction to @@ -117,7 +117,7 @@ protected: /** Programmable Signal condition code. * - * These discriminate conditions in much the same way that SignalOpcode + * These discriminate conditions in much the same way that SignalOpcode * discriminates instructions. */ enum SignalConditionCode { @@ -126,7 +126,7 @@ enum SignalConditionCode { PSC_NUM_GREEN = 2, ///< Number of green signals behind this signal PSC_NUM_RED = 3, ///< Number of red signals behind this signal PSC_SIGNAL_STATE = 4, ///< State of another signal - + PSC_MAX = PSC_SIGNAL_STATE }; @@ -134,16 +134,16 @@ class SignalCondition { public: /// Get the condition's code inline SignalConditionCode ConditionCode() const { return this->cond_code; } - + /// Evaluate the condition virtual bool Evaluate(SignalVM& vm) = 0; - + /// Destroy the condition. Any children should also be destroyed virtual ~SignalCondition(); - + protected: SignalCondition(SignalConditionCode code) : cond_code(code) {} - + const SignalConditionCode cond_code; }; @@ -167,7 +167,7 @@ enum SignalComparator { SGC_MORE_THAN_EQUALS = 5, ///< the variable is grater than or equal to the specified value SGC_IS_TRUE = 6, ///< the variable is true (non-zero) SGC_IS_FALSE = 7, ///< the variable is false (zero) - + SGC_LAST = SGC_IS_FALSE }; @@ -188,10 +188,10 @@ public: /// Constructs a condition refering to the value @p code refers to. Sets the /// comparator and value to sane defaults. SignalVariableCondition(SignalConditionCode code); - + SignalComparator comparator; uint32 value; - + /// Evaluates the condition virtual bool Evaluate(SignalVM &vm); }; @@ -200,14 +200,14 @@ public: class SignalStateCondition: public SignalCondition { public: SignalStateCondition(SignalReference this_sig, TileIndex sig_tile, Trackdir sig_track); - + void SetSignal(TileIndex tile, Trackdir track); bool IsSignalValid(); void Invalidate(); - + virtual bool Evaluate(SignalVM& vm); virtual ~SignalStateCondition(); - + SignalReference this_sig; TileIndex sig_tile; Trackdir sig_track; @@ -223,8 +223,8 @@ class SignalStateCondition: public SignalCondition { *
  • They permit every other instruction to assume that there is another * following it. This makes the code much simpler (and by extension less * error prone)
  • - *
  • Particularly in the case of the End instruction, they provide an - * instruction in the user interface that can be clicked on to add + *
  • Particularly in the case of the End instruction, they provide an + * instruction in the user interface that can be clicked on to add * instructions at the end of a program
  • * */ @@ -232,23 +232,23 @@ class SignalSpecial: public SignalInstruction { public: /** Constructs a special signal of the opcode @p op in program @p prog. * - * Generally you should not need to call this; it will be called by the + * Generally you should not need to call this; it will be called by the * program's constructor. An exception is in the saveload code, which needs * to construct raw objects to deserialize into */ SignalSpecial(SignalProgram *prog, SignalOpcode op); - + /** Evaluates the instruction. If this is an Start instruction, flow will be * vectored to the first instruction; if it is an End instruction, the program * will terminate and the signal will be left red. */ virtual void Evaluate(SignalVM &vm); - + /** Links the first and last instructions in the program. Generally only to be * called from the SignalProgram constructor. */ static void link(SignalSpecial *first, SignalSpecial *last); - + /** Removes this instruction. If this is the start instruction, then all of * the other instructions in the program will be successively removed, * (emptying it). If this is the End instruction, then it will do nothing. @@ -257,12 +257,12 @@ public: * the instruction. */ virtual void Remove(); - - /** The next instruction after this one. On the End instruction, this should + + /** The next instruction after this one. On the End instruction, this should * be NULL. */ SignalInstruction *next; - + virtual void SetNext(SignalInstruction *next_insn); }; @@ -273,12 +273,12 @@ public: */ class SignalIf: public SignalInstruction { public: - /** The If-Else and If-Endif pseudo instructions. The Else instruction + /** The If-Else and If-Endif pseudo instructions. The Else instruction * follows the Then block, and the Endif instruction follows the Else block. * * These serve two purposes: *