Skip to content

Commit

Permalink
export functions for use with rc_client_external (#1040)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamiras authored Dec 9, 2023
1 parent 2164dcc commit c19a893
Show file tree
Hide file tree
Showing 14 changed files with 671 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/api/impl/ConnectedServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ static bool DoRequest(const rc_api_request_t& api_request, const char* sApiName,
if (!sParams.empty())
sParams.push_back('&');

sParams.append(api_request.post_data, ptr - api_request.post_data - 1);
sParams.append(api_request.post_data, ptr - api_request.post_data);
}

while (*ptr && ptr[0] != '&')
Expand Down
12 changes: 9 additions & 3 deletions src/data/context/GameContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ void GameContext::LoadGame(unsigned int nGameId, const std::string& sGameHash, M
}
}

// enable spectator mode to prevent unlocks when testing compatibility
rc_client_set_spectator_mode_enabled(pRuntime.GetClient(), nMode == Mode::CompatibilityTest);

const bool bWasPaused = pRuntime.IsPaused();
pRuntime.SetPaused(true);

Expand Down Expand Up @@ -322,6 +319,15 @@ void GameContext::InitializeFromAchievementRuntime(const std::map<uint32_t, std:
{
case RC_CLIENT_ACHIEVEMENT_CATEGORY_CORE:
nCategory = ra::data::models::AssetCategory::Core;

// automatically activate all core achievements in compatibility mode
if (GetMode() == Mode::CompatibilityTest)
{
pAchievementData->public_.state = RC_CLIENT_ACHIEVEMENT_STATE_ACTIVE;

if (pAchievementData->trigger)
pAchievementData->trigger->state = RC_TRIGGER_STATE_WAITING;
}
break;

case RC_CLIENT_ACHIEVEMENT_CATEGORY_UNOFFICIAL:
Expand Down
9 changes: 7 additions & 2 deletions src/data/models/CodeNotesModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ void CodeNotesModel::ExtractSize(CodeNote& pNote)
const wchar_t c = (nIndex == nLength) ? 0 : pNote.Note.at(nIndex);

// find the next word
if (isalpha(c))
if (c > 255)
{
// ignore unicode characters - isalpha with the default locale would return false,
// but also likes to pop up asserts when in a debug build.
}
else if (isalpha(c))
{
if (sWord.empty())
{
Expand Down Expand Up @@ -252,7 +257,7 @@ void CodeNotesModel::ExtractSize(CodeNote& pNote)
bLastWordIsSize = bWordIsSize;
bLastWordIsNumber = bWordIsNumber;

if (isalnum(c))
if (c < 256 && isalnum(c))
{
std::swap(sPreviousWord, sWord);
sWord.clear();
Expand Down
Loading

0 comments on commit c19a893

Please sign in to comment.