- 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

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