Bug #7069

Type DurationUnit

Added by ic111 about 5 years ago.

Status:NewStart date:2014-09-02
Priority:LowDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

Originally, in date_type.h I wrote

enum DurationUnit {
DU_TICKS = 0,
DU_DAYS = 1,
DU_MONTHS = 2,
DU_YEARS = 3,
DU_INVALID = 255,
};

Unfortunately, at some point in time, some saveload consistency check didn´t allow me to use that type any longer in Saveload code. Thus, the equivalent definition now is

typedef uint8 DurationUnit;
static const uint8 DU_TICKS = 0;
static const uint8 DU_DAYS = 1;
static const uint8 DU_MONTHS = 2;
static const uint8 DU_YEARS = 3;
static const uint8 DU_INVALID = 255;

But I consider the former the nicer one. Just, is there a way to make it work with Saveload code? E.g.:

Duration timetable_duration; ///< Total duration of the timetable

SLE_CONDVAR(OrderList, timetable_duration.length, SLE_INT32, TIP_SAVEGAME_VERSION, SL_MAX_VERSION),

Also available in: Atom PDF