- added another steam achievement for winning first online game

This commit is contained in:
SoftCoder
2017-10-08 23:05:29 -07:00
parent d78f28983b
commit 2988521701
2 changed files with 11 additions and 2 deletions

View File

@@ -5177,6 +5177,7 @@ void saveStatsToSteam(Game* game, Stats& endStats) {
if (steamInstance != NULL) { if (steamInstance != NULL) {
printf("\nSTEAM detected, writing out end game stats for player!\n"); printf("\nSTEAM detected, writing out end game stats for player!\n");
// Write out stats here
if (NetworkManager::getInstance().isNetworkGame()) { if (NetworkManager::getInstance().isNetworkGame()) {
//printf("\nSTEAM Refresh Stats!\n"); //printf("\nSTEAM Refresh Stats!\n");
steamInstance->requestRefreshStats(); steamInstance->requestRefreshStats();
@@ -5228,6 +5229,7 @@ void saveStatsToSteam(Game* game, Stats& endStats) {
} }
} }
// Write out achievements here
for (int factionIndex = 0; for (int factionIndex = 0;
factionIndex < game->getWorld()->getFactionCount(); ++factionIndex) { factionIndex < game->getWorld()->getFactionCount(); ++factionIndex) {
if (factionIndex == game->getWorld()->getThisFactionIndex()) { if (factionIndex == game->getWorld()->getThisFactionIndex()) {
@@ -5236,6 +5238,11 @@ void saveStatsToSteam(Game* game, Stats& endStats) {
if(steamInstance->isUnlocked(EnumParser<SteamAchievementName>::getString(ACH_WIN_ONE_GAME).c_str()) == false) { if(steamInstance->isUnlocked(EnumParser<SteamAchievementName>::getString(ACH_WIN_ONE_GAME).c_str()) == false) {
steamInstance->unlock(EnumParser<SteamAchievementName>::getString(ACH_WIN_ONE_GAME).c_str()); steamInstance->unlock(EnumParser<SteamAchievementName>::getString(ACH_WIN_ONE_GAME).c_str());
} }
if (NetworkManager::getInstance().isNetworkGame()) {
if(steamInstance->isUnlocked(EnumParser<SteamAchievementName>::getString(ACH_WIN_ONE_GAME_ONLINE).c_str()) == false) {
steamInstance->unlock(EnumParser<SteamAchievementName>::getString(ACH_WIN_ONE_GAME_ONLINE).c_str());
}
}
} }
} }
} }

View File

@@ -41,12 +41,14 @@ inline EnumParser<SteamStatName>::EnumParser() {
} }
enum SteamAchievementName { enum SteamAchievementName {
ACH_WIN_ONE_GAME ACH_WIN_ONE_GAME,
ACH_WIN_ONE_GAME_ONLINE
}; };
template <> template <>
inline EnumParser<SteamAchievementName>::EnumParser() { inline EnumParser<SteamAchievementName>::EnumParser() {
enumMap["ACH_WIN_ONE_GAME"] = ACH_WIN_ONE_GAME; enumMap["ACH_WIN_ONE_GAME"] = ACH_WIN_ONE_GAME;
enumMap["ACH_WIN_ONE_GAME_ONLINE"] = ACH_WIN_ONE_GAME_ONLINE;
} }
class Steam class Steam