From: havoc Date: Mon, 24 Jul 2006 04:03:36 +0000 (+0000) Subject: some cleanups and improved warnings X-Git-Tag: xonotic-v0.1.0preview~3856 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=2caacb44b17d25721eff1f10fcd4438ae5d18947 some cleanups and improved warnings added Prydon campaign to multiplayer setup menu, fixed a bizarre crash in game episode lookup code by rewriting it git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6524 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/common.c b/common.c index fe84a1dd..9e5d4259 100644 --- a/common.c +++ b/common.c @@ -303,15 +303,15 @@ void MSG_WriteFloat (sizebuf_t *sb, float f) void MSG_WriteString (sizebuf_t *sb, const char *s) { - if (!s) - SZ_Write (sb, (unsigned char *)"", 1); + if (!s || !*s) + MSG_WriteChar (sb, 0); else SZ_Write (sb, (unsigned char *)s, (int)strlen(s)+1); } void MSG_WriteUnterminatedString (sizebuf_t *sb, const char *s) { - if (s) + if (s && *s) SZ_Write (sb, (unsigned char *)s, (int)strlen(s)); } @@ -633,7 +633,13 @@ void Com_HexDumpToConsole(const unsigned char *data, int size) { if (j < n) { - if (d[j] >= ' ' && d[j] <= 127) + // color change prefix character has to be treated specially + if (d[j] == STRING_COLOR_TAG) + { + *cur++ = STRING_COLOR_TAG; + *cur++ = STRING_COLOR_TAG; + } + else if (d[j] >= ' ') *cur++ = d[j]; else *cur++ = '.'; diff --git a/darkplaces.dev b/darkplaces.dev index 6584102b..fe4c6943 100644 --- a/darkplaces.dev +++ b/darkplaces.dev @@ -1,7 +1,7 @@ [Project] FileName=darkplaces.dev Name=DarkPlaces -UnitCount=156 +UnitCount=155 Type=0 Ver=1 ObjFiles= @@ -1439,18 +1439,8 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit144] -FileName=builddate.c -CompileCpp=0 -Folder=Source Files -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - [Unit145] -FileName=svvm_cmds.c +FileName=mvm_cmds.c CompileCpp=0 Folder=Source Files Compile=1 @@ -1460,9 +1450,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit146] -FileName=mvm_cmds.c +FileName=prvm_cmds.h CompileCpp=0 -Folder=Source Files +Folder=Header Files Compile=1 Link=1 Priority=1000 @@ -1470,7 +1460,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit147] -FileName=prvm_cmds.h +FileName=csprogs.h CompileCpp=0 Folder=Header Files Compile=1 @@ -1480,7 +1470,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit148] -FileName=csprogs.h +FileName=image_png.h CompileCpp=0 Folder=Header Files Compile=1 @@ -1490,7 +1480,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit149] -FileName=image_png.h +FileName=lhfont.h CompileCpp=0 Folder=Header Files Compile=1 @@ -1500,7 +1490,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit150] -FileName=lhfont.h +FileName=mdfour.h CompileCpp=0 Folder=Header Files Compile=1 @@ -1510,7 +1500,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit151] -FileName=mdfour.h +FileName=model_dpmodel.h CompileCpp=0 Folder=Header Files Compile=1 @@ -1520,7 +1510,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit152] -FileName=model_dpmodel.h +FileName=model_psk.h CompileCpp=0 Folder=Header Files Compile=1 @@ -1530,9 +1520,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit153] -FileName=model_psk.h +FileName=csprogs.c CompileCpp=0 -Folder=Header Files +Folder=Source Files Compile=1 Link=1 Priority=1000 @@ -1540,7 +1530,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit154] -FileName=csprogs.c +FileName=image_png.c CompileCpp=0 Folder=Source Files Compile=1 @@ -1550,7 +1540,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit155] -FileName=image_png.c +FileName=mdfour.c CompileCpp=0 Folder=Source Files Compile=1 @@ -1617,3 +1607,13 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= +[Unit144] +FileName=svvm_cmds.c +CompileCpp=0 +Folder=Source Files +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/menu.c b/menu.c index 66f228c8..919adb06 100644 --- a/menu.c +++ b/menu.c @@ -3850,6 +3850,19 @@ static episode_t defeatindetail2episodes[] = {"ATAC Campaign", 0, 3}, }; +static level_t prydonlevels[] = +{ + {"curig2", "Capel Curig"}, // 0 + + {"tdastart", "Gateway"}, // 1 +}; + +static episode_t prydonepisodes[] = +{ + {"Prydon Gate", 0, 1}, + {"The Dark Age", 1, 1} +}; + static gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2}; static gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7}; static gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6}; @@ -3860,6 +3873,7 @@ static gamelevels_t goodvsbad2game = {"Good Vs. Bad 2", goodvsbad2levels, goodvs static gamelevels_t battlemechgame = {"Battlemech", battlemechlevels, battlemechepisodes, 1}; static gamelevels_t openquartzgame = {"OpenQuartz", openquartzlevels, openquartzepisodes, 3}; static gamelevels_t defeatindetail2game = {"Defeat In Detail 2", defeatindetail2levels, defeatindetail2episodes, 1}; +static gamelevels_t prydongame = {"Prydon Gate", prydonlevels, prydonepisodes, 2}; typedef struct gameinfo_s { @@ -3880,13 +3894,22 @@ static gameinfo_t gamelist[] = {GAME_BATTLEMECH, &battlemechgame, &battlemechgame}, {GAME_OPENQUARTZ, &openquartzgame, &openquartzgame}, {GAME_DEFEATINDETAIL2, &defeatindetail2game, &defeatindetail2game}, - {(gamemode_t)-1, &sharewarequakegame, ®isteredquakegame} // final fallback + {GAME_PRYDON, &prydongame, &prydongame}, + {GAME_NORMAL, NULL, NULL} // terminator }; static gamelevels_t *lookupgameinfo(void) { - int i; - for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++); + int i = 0; + while (gamelist[i].gameid != gamemode) + { + if (gamelist[i].notregistered == NULL) + { + i = 0; + break; + } + i++; + } if (registered.integer) return gamelist[i].registered; else diff --git a/svvm_cmds.c b/svvm_cmds.c index b6b0f183..c052c6e9 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -261,10 +261,7 @@ void PF_sprint (void) entnum = PRVM_G_EDICTNUM(OFS_PARM0); if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active) - { - Con_Print("tried to sprint to a non-client\n"); - return; - } + PF_WARNING("tried to centerprint to a non-client\n"); client = svs.clients + entnum-1; if (!client->netconnection) @@ -294,10 +291,7 @@ void PF_centerprint (void) entnum = PRVM_G_EDICTNUM(OFS_PARM0); if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active) - { - Con_Print("tried to sprint to a non-client\n"); - return; - } + PF_WARNING("tried to centerprint to a non-client\n"); client = svs.clients + entnum-1; if (!client->netconnection) @@ -722,10 +716,7 @@ void PF_stuffcmd (void) entnum = PRVM_G_EDICTNUM(OFS_PARM0); if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active) - { - Con_Print("Can't stuffcmd to a non-client\n"); - return; - } + PF_WARNING("Can't stuffcmd to a non-client\n"); VM_VarString(1, string, sizeof(string));