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

Function SG_ReadServerConfigStrings

code/server/sv_savegame.cpp:655–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

653}
654
655void SG_ReadServerConfigStrings( void )
656{
657 // trash the whole table...
658 //
659 for (int i=0; i<MAX_CONFIGSTRINGS; i++)
660 {
661 if (i!=CS_SYSTEMINFO)
662 {
663 if ( sv.configstrings[i] )
664 {
665 Z_Free( sv.configstrings[i] );
666 }
667 sv.configstrings[i] = CopyString("");
668 }
669 }
670
671 // now read the replacement ones...
672 //
673 int iCount = 0;
674
675 ojk::SavedGameHelper saved_game(
676 &ojk::SavedGame::get_instance());
677
678 saved_game.read_chunk<int32_t>(
679 INT_ID('C', 'S', 'C', 'N'),
680 iCount);
681
682 Com_DPrintf( "Reading %d configstrings...\n",iCount);
683
684 for (int i = 0; i<iCount; i++)
685 {
686 int iIndex = 0;
687 const char *psName;
688
689 saved_game.read_chunk<int32_t>(
690 INT_ID('C', 'S', 'I', 'N'),
691 iIndex);
692
693 saved_game.read_chunk(
694 INT_ID('C', 'S', 'D', 'A'));
695
696 psName = reinterpret_cast<const char*>(
697 saved_game.get_buffer_data());
698
699 Com_DPrintf( "Cfg str %d = %s\n",iIndex, psName);
700
701 //sv.configstrings[iIndex] = psName;
702 SV_SetConfigstring(iIndex, psName);
703 }
704}
705
706static unsigned int SG_UnixTimestamp ( const time_t& t )
707{

Callers 1

SG_ReadSavegameFunction · 0.85

Calls 6

SV_SetConfigstringFunction · 0.70
Z_FreeFunction · 0.50
CopyStringFunction · 0.50
Com_DPrintfFunction · 0.50
read_chunkMethod · 0.45
get_buffer_dataMethod · 0.45

Tested by

no test coverage detected