MCPcopy Create free account
hub / github.com/JACoders/OpenJK / SG_WriteServerConfigStrings

Function SG_WriteServerConfigStrings

code/server/sv_savegame.cpp:609–653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607}
608
609void SG_WriteServerConfigStrings()
610{
611 ojk::SavedGameHelper saved_game(
612 &ojk::SavedGame::get_instance());
613
614 int iCount = 0;
615 int i; // not in FOR statement in case compiler goes weird by reg-optimising it then failing to get the address later
616
617 // count how many non-blank server strings there are...
618 //
619 for ( i=0; i<MAX_CONFIGSTRINGS; i++)
620 {
621 if (i!=CS_SYSTEMINFO)
622 {
623 if (sv.configstrings[i] && strlen(sv.configstrings[i])) // paranoia... <g>
624 {
625 iCount++;
626 }
627 }
628 }
629
630 saved_game.write_chunk<int32_t>(
631 INT_ID('C', 'S', 'C', 'N'),
632 iCount);
633
634 // now write 'em...
635 //
636 for (i=0; i<MAX_CONFIGSTRINGS; i++)
637 {
638 if (i!=CS_SYSTEMINFO)
639 {
640 if (sv.configstrings[i] && strlen(sv.configstrings[i]))
641 {
642 saved_game.write_chunk<int32_t>(
643 INT_ID('C', 'S', 'I', 'N'),
644 i);
645
646 saved_game.write_chunk(
647 INT_ID('C', 'S', 'D', 'A'),
648 ::sv.configstrings[i],
649 static_cast<int>(strlen(::sv.configstrings[i]) + 1));
650 }
651 }
652 }
653}
654
655void SG_ReadServerConfigStrings( void )
656{

Callers 1

sv_savegame.cppFile · 0.85

Calls 1

write_chunkMethod · 0.45

Tested by

no test coverage detected