- fix menu for network/csnetwork

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7929 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: ac8e8b79c7e2bcc2cac8d17ceacf1a18158a5135
Former-commit-id: 2bc1593466a065f1b0a02dcd307d5f59eeff3bbe
This commit is contained in:
torcs-ng 2022-01-22 01:22:21 +00:00
parent f1e6d2f077
commit 251d0b14cf
2 changed files with 505 additions and 491 deletions

File diff suppressed because it is too large Load diff

View file

@ -29,7 +29,7 @@ class GfTrack;
/** @file /** @file
Singleton holding information on the available race managers Singleton holding information on the available race managers
@defgroup tgfdata Data manager for the client gaming framework. @defgroup tgfdata Data manager for the client gaming framework.
*/ */
@ -37,110 +37,115 @@ class TGFDATA_API GfRaceManager
{ {
public: public:
GfRaceManager(const std::string& strId, void* hparmHandle); GfRaceManager(const std::string& strId, void* hparmHandle);
void reset(void* hparmHandle, bool bClosePrevHdle = false); void reset(void* hparmHandle, bool bClosePrevHdle = false);
~GfRaceManager(); ~GfRaceManager();
const std::string& getId() const; const std::string& getId() const;
void* getDescriptorHandle() const; void* getDescriptorHandle() const;
std::string getDescriptorFileName() const; std::string getDescriptorFileName() const;
const std::string& getName() const; const std::string& getName() const;
const std::string& getType() const; const std::string& getType() const;
const std::string& getSubType() const; const std::string& getSubType() const;
int getPriority() const; int getPriority() const;
bool isNetwork() const; bool isNetwork() const;
bool acceptsDriverType(const std::string& strType) const; bool acceptsDriverType(const std::string& strType) const;
const std::vector<std::string>& getAcceptedDriverTypes() const; const std::vector<std::string>& getAcceptedDriverTypes() const;
bool acceptsCarCategory(const std::string& strCatId) const; bool acceptsCarCategory(const std::string& strCatId) const;
const std::vector<std::string>& getAcceptedCarCategoryIds() const; const std::vector<std::string>& getAcceptedCarCategoryIds() const;
unsigned getEventCount() const; unsigned getEventCount() const;
bool isMultiEvent() const; bool isMultiEvent() const;
GfTrack* getEventTrack(unsigned nEventIndex); // index in [0, nEvents[ GfTrack* getEventTrack(unsigned nEventIndex); // index in [0, nEvents[
void setEventTrack(unsigned nEventIndx, GfTrack* pTrack); // index in [0, nEvents[ void setEventTrack(unsigned nEventIndx, GfTrack* pTrack); // index in [0, nEvents[
GfTrack* getPreviousEventTrack(unsigned nEventIndex); // index in [0, nEvents[ GfTrack* getPreviousEventTrack(unsigned nEventIndex); // index in [0, nEvents[
const std::vector<std::string>& getSessionNames() const; const std::vector<std::string>& getSessionNames() const;
unsigned getSessionCount() const; unsigned getSessionCount() const;
const std::string& getSessionName(unsigned nIndex) const; const std::string& getSessionName(unsigned nIndex) const;
const std::string& getSavedConfigsDir() const; const std::string& getSavedConfigsDir() const;
bool hasSavedConfigsFiles() const; bool hasSavedConfigsFiles() const;
const std::string& getResultsDir() const; const std::string& getResultsDir() const;
bool hasResultsFiles() const; bool hasResultsFiles() const;
bool hasSubFiles() const; bool hasSubFiles() const;
//! Save data to params (in-memory, no file written to disk). //! Save data to params (in-memory, no file written to disk).
void store(); void store();
//! Is the race manager data consistent with the params from which it was loaded ? //! Is the race manager data consistent with the params from which it was loaded ?
bool isDirty() const; bool isDirty() const;
protected: protected:
//! Load remaining info from params (called by accessors, lazy mode). //! Load remaining info from params (called by accessors, lazy mode).
void load() const; void load() const;
protected: protected:
std::string _strId; // XML file name (ex: quickrace, singleevent-endurance, championship-sc) std::string _strId; // XML file name (ex: quickrace, singleevent-endurance, championship-sc)
void* _hparmHandle; // Params handle to the descriptor file. void* _hparmHandle; // Params handle to the descriptor file.
std::string _strName; // User friendly full name (ex: Quick Race, Supercar Championship). std::string _strName; // User friendly full name (ex: Quick Race, Supercar Championship).
std::string _strType; // User friendly type name (ex: Quick Race, Single Event, Championship). std::string _strType; // User friendly type name (ex: Quick Race, Single Event, Championship).
std::string _strSubType; // User friendly sub-type name (ex: "", Endurance, Challenge, Supercars"). std::string _strSubType; // User friendly sub-type name (ex: "", Endurance, Challenge, Supercars").
int _nPriority; // Gives the order of the buttons in the race select menu int _nPriority; // Gives the order of the buttons in the race select menu
std::vector<std::string> _vecAcceptedDriverTypes; std::vector<std::string> _vecAcceptedDriverTypes;
std::vector<std::string> _vecAcceptedCarCategoryIds; std::vector<std::string> _vecAcceptedCarCategoryIds;
mutable bool _bHasSubFiles; // True if multiple configuration files are used (ex: Career mode). mutable bool _bHasSubFiles; // True if multiple configuration files are used (ex: Career mode).
// Saved configs and results files dirs. // Saved configs and results files dirs.
mutable std::string _strSavedConfigsDir; mutable std::string _strSavedConfigsDir;
mutable std::string _strResultsDir; mutable std::string _strResultsDir;
mutable std::vector<std::string> _vecEventTrackIds; // Id of the track for each scheduled event. mutable std::vector<std::string> _vecEventTrackIds; // Id of the track for each scheduled event.
mutable std::vector<std::string> _vecSessionNames; // Name and order of sessions for each event. mutable std::vector<std::string> _vecSessionNames; // Name and order of sessions for each event.
mutable bool _bIsDirty; // True if no change occurred since last reset(). mutable bool _bIsDirty; // True if no change occurred since last reset().
}; };
class TGFDATA_API GfRaceManagers class TGFDATA_API GfRaceManagers
{ {
public: public:
// Accessor to the unique instance of the singleton. // Accessor to the unique instance of the singleton.
static GfRaceManagers* self(); static GfRaceManagers* self();
static void shutdown(); static void shutdown();
const std::vector<std::string>& getTypes() const; const std::vector<std::string>& getTypes() const;
GfRaceManager* getRaceManager(const std::string& strId) const; GfRaceManager* getRaceManager(const std::string& strId) const;
GfRaceManager* getRaceManagerWithName(const std::string& strName) const; GfRaceManager* getRaceManagerWithName(const std::string& strName) const;
std::vector<GfRaceManager*> getRaceManagersWithType(const std::string& strType = "") const; std::vector<GfRaceManager*> getRaceManagersWithType(const std::string& strType = "") const;
void print(bool bVerbose = false) const; void print(bool bVerbose = false) const;
protected: protected:
// Protected constructor and destructor : clients can not use them. // Protected constructor and destructor : clients can not use them.
GfRaceManagers(); GfRaceManagers();
~GfRaceManagers(); ~GfRaceManagers();
protected: protected:
// The singleton itself. // The singleton itself.
static GfRaceManagers* _pSelf; static GfRaceManagers* _pSelf;
// Its private data. // Its private data.
class Private; class Private;
Private* _pPrivate; Private* _pPrivate;
private:
bool cmakeConfigurationPermits(const std::string& raceManagerType) const;
static constexpr const char *const CLIENT_SERVER_OFF_DISALLOWED_NETWORK_RACEMANAGER_TYPE = "Network";
static constexpr const char *const CLIENT_SERVER_ON_DISALLOWED_NETWORK_RACEMANAGER_TYPE = "Online";
}; };
#endif /* __TGFRACEMANAGERS__H__ */ #endif /* __TGFRACEMANAGERS__H__ */