From: Cloudwalk Date: Wed, 23 Sep 2020 14:02:04 +0000 (-0400) Subject: protocol: Add max_edicts field to protocol_t. Set server limit_edicts from it X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=724c47acaa867f2ee5397ddac53c24bb16306e03;p=xonotic%2Fdarkplaces.git protocol: Add max_edicts field to protocol_t. Set server limit_edicts from it --- diff --git a/protocol.c b/protocol.c index 21db9f03..306761bc 100644 --- a/protocol.c +++ b/protocol.c @@ -43,6 +43,7 @@ protocol_t protocol_netquake = { .name = "QUAKE", .num = 15, + .max_edicts = 640, .WriteCoord = MSG_WriteCoord13i, .WriteAngle = MSG_WriteAngle8i, .WriteVector = MSG_WriteVector13i, @@ -59,6 +60,7 @@ protocol_t protocol_quakedp = { .name = "QUAKEDP", .num = 15, + .max_edicts = 2048, .WriteCoord = MSG_WriteCoord13i, .WriteAngle = MSG_WriteAngle8i, .WriteVector = MSG_WriteVector13i, @@ -91,6 +93,7 @@ protocol_t protocol_dpp1 = { .name = "DP1", .num = 96, + .max_edicts = MAX_EDICTS, .WriteCoord = MSG_WriteCoord32f, .WriteAngle = MSG_WriteAngle8i, .WriteVector = MSG_WriteVector32f, @@ -107,6 +110,7 @@ protocol_t protocol_dpp2 = { .name = "DP2", .num = 97, + .max_edicts = MAX_EDICTS, .WriteCoord = MSG_WriteCoord16i, .WriteAngle = MSG_WriteAngle8i, .WriteVector = MSG_WriteVector16i, @@ -123,6 +127,7 @@ protocol_t protocol_dpp3 = { .name = "DP3", .num = 3500, + .max_edicts = MAX_EDICTS, .WriteCoord = MSG_WriteCoord16i, .WriteAngle = MSG_WriteAngle8i, .WriteVector = MSG_WriteVector16i, @@ -139,6 +144,7 @@ protocol_t protocol_dpp4 = { .name = "DP4", .num = 3501, + .max_edicts = MAX_EDICTS, .WriteCoord = MSG_WriteCoord16i, .WriteAngle = MSG_WriteAngle8i, .WriteVector = MSG_WriteVector16i, @@ -155,6 +161,7 @@ protocol_t protocol_dpp5 = { .name = "DP5", .num = 3502, + .max_edicts = MAX_EDICTS, .WriteCoord = MSG_WriteCoord32f, .WriteAngle = MSG_WriteAngle16i, .WriteVector = MSG_WriteVector32f, @@ -171,6 +178,7 @@ protocol_t protocol_dpp6 = { .name = "DP6", .num = 3503, + .max_edicts = MAX_EDICTS, .WriteCoord = MSG_WriteCoord32f, .WriteAngle = MSG_WriteAngle16i, .WriteVector = MSG_WriteVector32f, @@ -187,6 +195,7 @@ protocol_t protocol_dpp7 = { .name = "DP7", .num = 3504, + .max_edicts = MAX_EDICTS, .WriteCoord = MSG_WriteCoord32f, .WriteAngle = MSG_WriteAngle16i, .WriteVector = MSG_WriteVector32f, @@ -204,6 +213,7 @@ protocol_t protocol_nehahramovie = { .name = "NEHAHRAMOVIE", .num = 250, + .max_edicts = 2048, .WriteCoord = MSG_WriteCoord13i, .WriteAngle = MSG_WriteAngle8i, .WriteVector = MSG_WriteVector13i, @@ -220,6 +230,7 @@ protocol_t protocol_nehahrabjp = { .name = "NEHAHRABJP", .num = 10000, + .max_edicts = 4096, .WriteCoord = MSG_WriteCoord13i, .WriteAngle = MSG_WriteAngle8i, .WriteVector = MSG_WriteVector13i, @@ -236,6 +247,7 @@ protocol_t protocol_nehahrabjp2 = { .name = "NEHAHRABJP2", .num = 10001, + .max_edicts = 4096, .WriteCoord = MSG_WriteCoord13i, .WriteAngle = MSG_WriteAngle8i, .WriteVector = MSG_WriteVector13i, @@ -252,6 +264,7 @@ protocol_t protocol_nehahrabjp3 = { .name = "NEHAHRABJP3", .num = 10002, + .max_edicts = 4096, .WriteCoord = MSG_WriteCoord13i, .WriteAngle = MSG_WriteAngle8i, .WriteVector = MSG_WriteVector13i, diff --git a/protocol.h b/protocol.h index 3df4f28e..6e6730aa 100644 --- a/protocol.h +++ b/protocol.h @@ -49,6 +49,8 @@ struct protocol_s const char *name; const int num; + const int max_edicts; + void (*WriteCoord)(sizebuf_t *, float); void (*WriteAngle)(sizebuf_t *, float); void (*WriteVector)(sizebuf_t *, const vec3_t); diff --git a/sv_main.c b/sv_main.c index 34a72b24..92adb255 100644 --- a/sv_main.c +++ b/sv_main.c @@ -3909,16 +3909,7 @@ static void SV_VM_Setup(void) prog->builtins = vm_sv_builtins; prog->numbuiltins = vm_sv_numbuiltins; prog->max_edicts = 512; - if (sv.protocol == &protocol_netquake) - prog->limit_edicts = 640; // before quake mission pack 1 this was 512 - else if (sv.protocol == &protocol_quakedp) - prog->limit_edicts = 2048; // guessing - else if (sv.protocol == &protocol_nehahramovie) - prog->limit_edicts = 2048; // guessing! - else if (sv.protocol == &protocol_nehahrabjp || sv.protocol == &protocol_nehahrabjp2 || sv.protocol == &protocol_nehahrabjp3) - prog->limit_edicts = 4096; // guessing! - else - prog->limit_edicts = MAX_EDICTS; + prog->limit_edicts = sv.protocol->max_edicts; prog->reserved_edicts = svs.maxclients; prog->edictprivate_size = sizeof(edict_engineprivate_t); prog->name = "server";