#pragma once #include "lc_library.h" #include #include #include #include enum LC_TTS_TYPES { LC_TTS_STRAIGHT, LC_TTS_CURVED, LC_TTS_CROSS, LC_TTS_LEFT_BRANCH, LC_TTS_RIGHT_BRANCH, LC_TTS_NUMITEMS }; class TrainTrackConnectionPoint { public: TrainTrackConnectionPoint(float angle, float x, float y); float angle; lcVector2 xy_coordinate; }; class TrainTrackType { public: void Load(lcPiecesLibrary* Library, char const* filename); void AddConnection(TrainTrackConnectionPoint *connectionPoint); TrainTrackConnectionPoint *GetConnection(int index); //lcArray& GetConnections(); std::vector& GetConnections(); PieceInfo* pieceInfo; int GetNoOfConnections(); private: char const* filename; //lcArray connectionPoints; std::vector connectionPoints; }; class TrainTrackSection { public: TrainTrackSection(TrainTrackType *trackType, enum LC_TTS_TYPES trackTypeId, lcMatrix44 location, int mCurrentStep, int mColorIndex); lcMatrix44 GetConnectionLocation(int connectionNo); int GetNoOfConnections(); int FindConnectionNumber(lcVector3 searchLocation); TrainTrackType *trackType; enum LC_TTS_TYPES trackTypeId; lcMatrix44 location; int mCurrentStep; int mColorIndex; }; class TrainTrackSystem { public: TrainTrackSystem(); ~TrainTrackSystem(); void setColorIndex(int colorIndex); void setCurrentStep(int mCurrentStep); void addFirstTrackSection(lcMatrix44 position, enum LC_TTS_TYPES trackTypeId); void addTrackSection(int fromTrackSectionIdx, int fromTrackSectionConnectionIdx, enum LC_TTS_TYPES toTrackType, int toTrackTypeConnectionIdx); void addTrackSection(TrainTrackSection* fromTrackSection, int fromTrackSectionConnectionIdx, enum LC_TTS_TYPES toTrackType, int toTrackTypeConnectionIdx); bool deleteTrackSection(lcPiece* piece); //lcArray getTrackTypes(); std::vector getTrackTypes(); //lcArray GetTrackSections(); std::vector GetTrackSections(); //lcArray* GetTrackSectionsPtr(); std::vector* GetTrackSectionsPtr(); //lcArray GetPieces(); std::vector GetPieces(); lcModel* GetModel(); void SetModel(); LC_TTS_TYPES findTrackTypeByString(const char *tracktypeName); private: //lcArray trainTrackTypes; std::vector trainTrackTypes; static const char* mTrackTypeFilenames[LC_TTS_NUMITEMS]; //lcArray trackSections; std::vector trackSections; int mColorIndex; int mCurrentStep; std::unique_ptr mModel; std::map trackTypesByName; };