| 1 | #include "Library/Rail/RailKeeper.h" |
| 2 | |
| 3 | #include "Library/Placement/PlacementFunction.h" |
| 4 | #include "Library/Placement/PlacementInfo.h" |
| 5 | #include "Library/Rail/Rail.h" |
| 6 | #include "Library/Rail/RailRider.h" |
| 7 | |
| 8 | namespace al { |
| 9 | RailKeeper::RailKeeper(const PlacementInfo& info) { |
| 10 | Rail* rail = new Rail(); |
| 11 | rail->init(info); |
| 12 | |
| 13 | mRailRider = new RailRider(rail); |
| 14 | } |
| 15 | |
| 16 | RailKeeper* createRailKeeper(const PlacementInfo& info, const char* linkName) { |
| 17 | return tryCreateRailKeeper(info, linkName); |
| 18 | } |
| 19 | |
| 20 | RailKeeper* tryCreateRailKeeper(const PlacementInfo& info, const char* linkName) { |
| 21 | PlacementInfo linkInfo; |
| 22 | if (!tryGetLinksInfo(railPlacementInfo: &linkInfo, placementInfo: info, linkName)) |
| 23 | return nullptr; |
| 24 | |
| 25 | return new RailKeeper(linkInfo); |
| 26 | } |
| 27 | |
| 28 | RailKeeper* createRailKeeperIndex(const PlacementInfo& info, s32 linkIndex, const char* linkName) { |
| 29 | PlacementInfo linkInfo; |
| 30 | getLinksInfoByIndex(linkPlacementInfo: &linkInfo, placementInfo: info, linkName, index: linkIndex); |
| 31 | |
| 32 | return new RailKeeper(linkInfo); |
| 33 | } |
| 34 | } // namespace al |
| 35 | |