mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-07 11:52:51 +00:00
nilrider:: activate achievements/leaderboards
This commit is contained in:
parent
7025bf6c58
commit
ccb3284d78
@ -37,6 +37,13 @@
|
|||||||
#include "solver.cpp"
|
#include "solver.cpp"
|
||||||
#include "save.cpp"
|
#include "save.cpp"
|
||||||
|
|
||||||
|
#ifdef RVCOL
|
||||||
|
namespace hr {
|
||||||
|
void rv_achievement(const string& name);
|
||||||
|
void rv_leaderboard(const string& name, int score);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace nilrider {
|
namespace nilrider {
|
||||||
|
|
||||||
multi::config scfg_nilrider;
|
multi::config scfg_nilrider;
|
||||||
@ -155,6 +162,7 @@ bool turn(int delta) {
|
|||||||
for(int i=0; i<delta * simulation_speed; i++) {
|
for(int i=0; i<delta * simulation_speed; i++) {
|
||||||
curlev->history.push_back(curlev->current);
|
curlev->history.push_back(curlev->current);
|
||||||
curlev->current.be_consistent();
|
curlev->current.be_consistent();
|
||||||
|
auto goals = curlev->current.goals;
|
||||||
bool b = curlev->current.tick(curlev);
|
bool b = curlev->current.tick(curlev);
|
||||||
running = b;
|
running = b;
|
||||||
if(!b) {
|
if(!b) {
|
||||||
@ -162,6 +170,22 @@ bool turn(int delta) {
|
|||||||
fail = true;
|
fail = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if RVCOL
|
||||||
|
if(b) {
|
||||||
|
goals = curlev->current.goals &~goals;
|
||||||
|
int gid = 0;
|
||||||
|
for(auto& g: curlev->goals) {
|
||||||
|
if(goals & Flag(gid)) {
|
||||||
|
if(g.achievement_name != "") rv_achievement(g.achievement_name);
|
||||||
|
if(g.leaderboard_name != "") {
|
||||||
|
auto res = curlev->current_score[gid];
|
||||||
|
rv_leaderboard(g.leaderboard_name, abs(res) * 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(t != curlev->current.collected_triangles)
|
if(t != curlev->current.collected_triangles)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user