File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22#include " AuroraGSI.h"
33
44// using std::placeholders::_1;
5- BAKKESMOD_PLUGIN (AuroraGSI, " AuroraGSI" , " 0.0.1 " , PLUGINTYPE_THREADED)
5+ BAKKESMOD_PLUGIN (AuroraGSI, " AuroraGSI" , " 0.0.2 " , PLUGINTYPE_THREADED)
66
77#pragma region Plugin Methods
88void AuroraGSI::onLoad ()
@@ -12,16 +12,23 @@ void AuroraGSI::onLoad()
1212
1313void AuroraGSI::onUnload ()
1414{
15+ ok = false ;
16+ cvarManager->log (" false" );
1517}
1618#pragma endregion
1719
1820#pragma region Aurora
1921void AuroraGSI::StartLoop () {
20- for (;; ) {
22+ while (ok ) {
2123 gameWrapper->Execute (std::bind (&AuroraGSI::UpdateMatchState, this ));
22- SendToAurora (GameState.GetJson ().dump ());
24+ string newJson = GameState.GetJson ().dump ();
25+ if (Json != newJson) {
26+ Json = newJson;
27+ SendToAurora (newJson);
28+ }
2329 Sleep (100 );
2430 }
31+ cvarManager->log (" stop" );
2532}
2633
2734void AuroraGSI::SendToAurora (std::string data)
@@ -31,7 +38,7 @@ void AuroraGSI::SendToAurora(std::string data)
3138 (void )request.send (" POST" , data, { " Content-Type: application/json" });
3239 }
3340 catch (...) {
34- // ignore
41+ ok = false ;
3542 }
3643}
3744#pragma endregion
Original file line number Diff line number Diff line change @@ -9,21 +9,22 @@ class AuroraGSI : public BakkesMod::Plugin::BakkesModPlugin
99public:
1010 virtual void onLoad ();
1111 virtual void onUnload ();
12-
1312private:
1413#pragma region Fields
1514 GameStateNode GameState;
15+ std::string Json;
16+ bool ok = true ;
1617#pragma endregion
1718
1819#pragma region Aurora
1920 void StartLoop ();
2021 void SendToAurora (std::string);
21- ServerWrapper GetCurrentGameType ();
2222#pragma endregion
2323
2424#pragma region Update States
2525 void UpdateMatchState ();
2626 void UpdateState (ServerWrapper wrapper);
2727 void ResetStates ();
28+ ServerWrapper GetCurrentGameType ();
2829#pragma endregion
2930};
You can’t perform that action at this time.
0 commit comments