Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r 95909be228c2 src/rail.h
- --- a/src/rail.h Fri Dec 09 21:27:22 2016 +0000
- +++ b/src/rail.h Sat Dec 10 13:42:05 2016 +0100
- @@ -113,7 +113,8 @@
- /**
- * This struct contains all the info that is needed to draw and construct tracks.
- */
- -struct RailtypeInfo {
- +class RailtypeInfo {
- +public:
- /**
- * Struct containing the main sprites. @note not all sprites are listed, but only
- * the ones used directly in the code
- diff -r 95909be228c2 src/rail_cmd.cpp
- --- a/src/rail_cmd.cpp Fri Dec 09 21:27:22 2016 +0000
- +++ b/src/rail_cmd.cpp Sat Dec 10 13:42:05 2016 +0100
- @@ -47,8 +47,6 @@
- RailType _sorted_railtypes[RAILTYPE_END];
- uint8 _sorted_railtypes_size;
- -assert_compile(sizeof(_original_railtypes) <= sizeof(_railtypes));
- -
- /** Enum holding the signal offset in the sprite sheet according to the side it is representing. */
- enum SignalOffsets {
- SIGNAL_TO_SOUTHWEST,
- @@ -66,8 +64,11 @@
- */
- void ResetRailTypes()
- {
- - memset(_railtypes, 0, sizeof(_railtypes));
- - memcpy(_railtypes, _original_railtypes, sizeof(_original_railtypes));
- + assert_compile(lengthof(_original_railtypes) <= lengthof(_railtypes));
- +
- + uint i = 0;
- + for (; i < lengthof(_original_railtypes); i++) _railtypes[i] = _original_railtypes[i];
- + for (; i < lengthof(_railtypes); i++) _railtypes[i] = RailtypeInfo(); // zero-init
- }
- void ResolveRailTypeGUISprites(RailtypeInfo *rti)
- @@ -151,11 +152,8 @@
- if (rti->label == 0) {
- /* Set up new rail type */
- - memcpy(rti, &_railtypes[RAILTYPE_RAIL], sizeof(*rti));
- + *rti = _railtypes[RAILTYPE_RAIL];
- rti->label = label;
- - /* Clear alternate label list. Can't use Reset() here as that would free
- - * the data pointer of RAILTYPE_RAIL and not our new rail type. */
- - new (&rti->alternate_labels) RailTypeLabelList;
- /* Make us compatible with ourself. */
- rti->powered_railtypes = (RailTypes)(1 << rt);
Advertisement
Add Comment
Please, Sign In to add comment