TBTR: Refactor train/template match function to return difference flags

This commit is contained in:
Jonathan G Rennison
2023-08-20 21:09:22 +01:00
parent 2b44d3302e
commit 2cf95eea36
4 changed files with 40 additions and 44 deletions

View File

@@ -55,8 +55,16 @@ void TransferCargoForTrain(Train *old_veh, Train *new_head);
void NeutralizeStatus(Train *t);
bool TrainMatchesTemplate(const Train *t, const TemplateVehicle *tv);
bool TrainMatchesTemplateRefit(const Train *t, const TemplateVehicle *tv);
enum TBTRDiffFlags {
TBTRDF_NONE = 0, ///< no difference between train and template
TBTRDF_CONSIST = 1 << 0, ///< consist (vehicle units) differs between train and template
TBTRDF_REFIT = 1 << 1, ///< refit differs between train and template
TBTRDF_DIR = 1 << 2, ///< unit direction differs between train and template
TBTRDF_ALL = TBTRDF_CONSIST | TBTRDF_REFIT | TBTRDF_DIR,
};
DECLARE_ENUM_AS_BIT_SET(TBTRDiffFlags)
TBTRDiffFlags TrainTemplateDifference(const Train *t, const TemplateVehicle *tv);
void UpdateAllTemplateVehicleImages();