Tracerestrict: Add a group membership conditional.

This commit is contained in:
Jonathan G Rennison
2016-04-05 18:40:16 +01:00
parent 4d94470d08
commit 213b0e7e3a
6 changed files with 170 additions and 26 deletions

View File

@@ -17,6 +17,7 @@
#include "command_func.h"
#include "rail_map.h"
#include "tile_type.h"
#include "group_type.h"
#include <map>
#include <vector>
@@ -111,6 +112,7 @@ enum TraceRestrictItemType {
TRIT_COND_CARGO = 15, ///< Test if train can carry cargo type
TRIT_COND_ENTRY_DIRECTION = 16, ///< Test which side of signal/signal tile is being entered from
TRIT_COND_PBS_ENTRY_SIGNAL = 17, ///< Test tile and PBS-state of previous signal
TRIT_COND_TRAIN_GROUP = 18, ///< Test train group membership
//TRIT_COND_TRAIN_OWNER = 24, ///< Test train owner: reserved for future use
/* space up to 31 */
};
@@ -411,6 +413,7 @@ enum TraceRestrictValueType {
TRVT_PF_PENALTY = 9, ///< takes a pathfinder penalty value or preset index, as per the auxiliary field as type: TraceRestrictPathfinderPenaltyAuxField
TRVT_RESERVE_THROUGH = 10,///< takes a value 0 = reserve through, 1 = cancel previous reserve through
TRVT_LONG_RESERVE = 11,///< takes a value 0 = long reserve, 1 = cancel previous long reserve
TRVT_GROUP_INDEX = 12,///< takes a GroupID
};
/**
@@ -472,6 +475,11 @@ static inline TraceRestrictTypePropertySet GetTraceRestrictTypeProperties(TraceR
out.cond_type = TRCOT_BINARY;
break;
case TRIT_COND_TRAIN_GROUP:
out.value_type = TRVT_GROUP_INDEX;
out.cond_type = TRCOT_BINARY;
break;
default:
NOT_REACHED();
break;
@@ -565,5 +573,6 @@ CommandCost CmdProgramSignalTraceRestrictProgMgmt(TileIndex tile, DoCommandFlag
void ShowTraceRestrictProgramWindow(TileIndex tile, Track track);
void TraceRestrictRemoveDestinationID(TraceRestrictOrderCondAuxField type, uint16 index);
void TraceRestrictRemoveGroupID(GroupID index);
#endif /* TRACERESTRICT_H */