v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
51
source/game/StarStatisticsDatabase.hpp
Normal file
51
source/game/StarStatisticsDatabase.hpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
#ifndef STAR_STATISTICS_DATABASE_HPP
|
||||
#define STAR_STATISTICS_DATABASE_HPP
|
||||
|
||||
#include "StarRoot.hpp"
|
||||
#include "StarAssets.hpp"
|
||||
#include "StarLruCache.hpp"
|
||||
|
||||
namespace Star {
|
||||
|
||||
STAR_STRUCT(StatEvent);
|
||||
STAR_STRUCT(Achievement);
|
||||
STAR_CLASS(StatisticsDatabase);
|
||||
|
||||
struct StatEvent {
|
||||
String eventName;
|
||||
StringList scripts;
|
||||
Json config;
|
||||
};
|
||||
|
||||
struct Achievement {
|
||||
String name;
|
||||
StringList triggers;
|
||||
StringList scripts;
|
||||
Json config;
|
||||
};
|
||||
|
||||
class StatisticsDatabase {
|
||||
public:
|
||||
StatisticsDatabase();
|
||||
|
||||
StatEventPtr event(String const& eventName) const;
|
||||
|
||||
AchievementPtr achievement(String const& name) const;
|
||||
StringList allAchievements() const;
|
||||
StringList achievementsForStat(String const& statName) const;
|
||||
|
||||
private:
|
||||
static StatEventPtr readEvent(String const& path);
|
||||
static AchievementPtr readAchievement(String const& path);
|
||||
|
||||
StringMap<String> m_eventPaths;
|
||||
StringMap<String> m_achievementPaths;
|
||||
StringMap<StringList> m_statAchievements;
|
||||
mutable Mutex m_cacheMutex;
|
||||
mutable HashLruCache<String, StatEventPtr> m_eventCache;
|
||||
mutable HashLruCache<String, AchievementPtr> m_achievementCache;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue