Skip to content

Commit e41b176

Browse files
committed
sgame: resend configstrings that could be wrong
...due to a map change during the client downloading something. This is a temporary workaround until clients have DaemonEngine/Daemon#1954.
1 parent d308a46 commit e41b176

2 files changed

Lines changed: 32 additions & 3 deletions

File tree

src/sgame/sg_client.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,30 @@ const char *ClientBotConnect( int clientNum, bool firstTime )
12651265
return nullptr;
12661266
}
12671267

1268+
// Resend configstrings that could be affected by https://github.com/Unvanquished/Unvanquished/issues/1102.
1269+
// Skip CS_SERVERINFO since it changes all the time anyway with players joining a team etc.
1270+
// TODO(0.57): remove since with the new version we have well-behaved clients.
1271+
static void ResendPossiblyWrongConfigstrings( int clientNum )
1272+
{
1273+
for ( int cs = CS_PLAYERS + level.maxclients; --cs >= CS_SYSTEMINFO; )
1274+
{
1275+
char configstring[ 1024 ];
1276+
trap_GetConfigstring( cs, configstring, sizeof( configstring ) );
1277+
std::string command = Str::Format( "cs %d %s", cs, Cmd::Escape( configstring ) );
1278+
if ( command.size() > 1022 )
1279+
{
1280+
// don't want to re-implement all of the bcs0 bcs1 bcs2 junk for this band-aid
1281+
Log::Notice( "Disabling configstring update workaround for client %d string %d due to length",
1282+
clientNum, cs );
1283+
}
1284+
else
1285+
{
1286+
Log::Notice("cs workaround: %s", command);
1287+
trap_SendServerCommand( clientNum, command.c_str() );
1288+
}
1289+
}
1290+
}
1291+
12681292
/*
12691293
===========
12701294
ClientBegin
@@ -1322,6 +1346,8 @@ void ClientBegin( int clientNum )
13221346
// locate ent at a spawn point
13231347
ClientSpawn( ent, nullptr, nullptr, nullptr );
13241348

1349+
ResendPossiblyWrongConfigstrings( clientNum );
1350+
13251351
trap_SendServerCommand( -1, va( "print_tr %s %s", QQ( N_("$1$^* entered the game") ), Quote( client->pers.netname ) ) );
13261352

13271353
std::string startMsg = g_mapStartupMessage.Get();

src/shared/bg_public.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,18 @@ enum
260260
CS_SHADERSTATE,
261261
CS_CLIENTS_READY,
262262

263-
CS_MODELS,
263+
CS_PLAYERS,
264+
265+
// Stuff below this normally never changes after the match starts
266+
267+
CS_MODELS = CS_PLAYERS + MAX_CLIENTS,
264268
CS_SOUNDS = CS_MODELS + MAX_MODELS,
265269
CS_SHADERS = CS_SOUNDS + MAX_SOUNDS,
266270
CS_GRADING_TEXTURES = CS_SHADERS + MAX_GAME_SHADERS,
267271
CS_REVERB_EFFECTS = CS_GRADING_TEXTURES + MAX_GRADING_TEXTURES,
268272
CS_PARTICLE_SYSTEMS = CS_REVERB_EFFECTS + MAX_REVERB_EFFECTS,
269273

270-
CS_PLAYERS = CS_PARTICLE_SYSTEMS + MAX_GAME_PARTICLE_SYSTEMS,
271-
CS_LOCATIONS = CS_PLAYERS + MAX_CLIENTS,
274+
CS_LOCATIONS = CS_PARTICLE_SYSTEMS + MAX_GAME_PARTICLE_SYSTEMS,
272275
CS_MAX = CS_LOCATIONS + MAX_LOCATIONS
273276
};
274277

0 commit comments

Comments
 (0)