MCPcopy Create free account
hub / github.com/TurningWheel/Barony / OnFunctionExecute

Method OnFunctionExecute

src/playfab.cpp:745–1264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

743}
744
745void PlayfabUser_t::OnFunctionExecute(const PlayFab::CloudScriptModels::ExecuteFunctionResult& result, void* customData)
746{
747 PlayFab::PlayFabErrorCode code = PlayFab::PlayFabErrorCode::PlayFabErrorUnknownError;
748 int retry = 0;
749 std::string message = "";
750 Json::Value data;
751 for ( auto& m : result.FunctionResult.getMemberNames() )
752 {
753 if ( result.FunctionResult[m].isString() )
754 {
755 if ( m == "message" )
756 {
757 message = result.FunctionResult[m].asCString();
758 }
759 else if ( m == "data" )
760 {
761 data = result.FunctionResult[m].asCString();
762 }
763 }
764 else if ( result.FunctionResult[m].isInt() )
765 {
766 if ( m == "code" )
767 {
768 code = (PlayFab::PlayFabErrorCode)result.FunctionResult[m].asInt();
769 }
770 else if ( m == "retry" )
771 {
772 retry = result.FunctionResult[m].asInt();
773 }
774 }
775 else
776 {
777 if ( m == "data" )
778 {
779 data = result.FunctionResult[m];
780 }
781 }
782 }
783
784 if ( (int)code == 200 || code == PlayFab::PlayFabErrorCode::PlayFabErrorSuccess )
785 {
786 code = PlayFab::PlayFabErrorCode::PlayFabErrorSuccess;
787 logInfo("\"%s\": [%d] [%s] (%dms)",
788 result.FunctionName.c_str(), (int)code, message.c_str(), result.ExecutionTimeMilliseconds);
789 }
790 else
791 {
792 logError("\"%s\": [%d] [%s] (%dms)",
793 result.FunctionName.c_str(), (int)code, message.c_str(), result.ExecutionTimeMilliseconds);
794 }
795
796 if ( result.FunctionName == "PostScore" || result.FunctionName == "PostScoreDebug" )
797 {
798 int sequence = reinterpret_cast<intptr_t>(customData);
799 for ( auto it = playfabUser.postScoreHandler.queue.begin();
800 it != playfabUser.postScoreHandler.queue.end(); ++it )
801 {
802 if ( (*it).sequence == sequence )

Callers

nothing calls this directly

Calls 15

steamAchievementFunction · 0.85
jsonValueToIntFunction · 0.85
jsonValueToStringFunction · 0.85
jsonValueToUintFunction · 0.85
SaveGameInfoClass · 0.85
parseOnlineHiscoreFunction · 0.85
c_strMethod · 0.80
steamStatisticUpdateFunction · 0.70
Entry_tClass · 0.70

Tested by

no test coverage detected