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

Method eventUpdateCodex

src/mod_tools.cpp:18368–18643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18366}
18367
18368void Compendium_t::Events_t::eventUpdateCodex(int playernum, const EventTags tag, const char* category,
18369 Sint32 value, const bool loadingValue, const int entryID, const bool floorEvent)
18370{
18371 if ( !allowedCompendiumProgress() && !loadingValue ) { return; }
18372 if ( intro && !loadingValue ) { return; }
18373 if ( playernum < 0 || playernum >= MAXPLAYERS ) { return; }
18374
18375 if ( multiplayer == SINGLE && playernum != 0 ) { return; }
18376 if ( multiplayer == SERVER && client_disconnected[playernum] )
18377 {
18378 return;
18379 }
18380
18381 auto find = events.find(tag);
18382 if ( find == events.end() )
18383 {
18384 return;
18385 }
18386 auto& def = find->second;
18387
18388 bool clientReceiveUpdateFromServer = false;
18389
18390 if ( !loadingValue )
18391 {
18392 if ( gameModeManager.currentMode == GameModeManager_t::GAME_MODE_TUTORIAL
18393 || gameModeManager.currentMode == GameModeManager_t::GAME_MODE_TUTORIAL_INIT )
18394 {
18395 // don't update in tutorial
18396 if ( def.eventTrackingType == EventTrackingType::UNIQUE_PER_RUN
18397 || def.eventTrackingType == EventTrackingType::UNIQUE_PER_FLOOR )
18398 {
18399 return;
18400 }
18401 else if ( tag == Compendium_t::CPDM_CLASS_MOVING_TIME
18402 || tag == Compendium_t::CPDM_CLASS_SNEAK_TIME )
18403 {
18404 return;
18405 }
18406 if ( category )
18407 {
18408 auto find = CompendiumEntries.codex.find(category);
18409 if ( find != CompendiumEntries.codex.end() )
18410 {
18411 if ( !find->second.enableTutorial )
18412 {
18413 return;
18414 }
18415 }
18416 }
18417 }
18418
18419 if ( def.clienttype == CLIENT_ONLY )
18420 {
18421 if ( multiplayer != SINGLE )
18422 {
18423 if ( playernum != clientnum )
18424 {
18425 return;

Callers

nothing calls this directly

Calls 4

EventVal_tClass · 0.85
applyValueMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected