MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / CPE_ExtEntry

Function CPE_ExtEntry

src/Protocol.c:1011–1078  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1009}
1010
1011static void CPE_ExtEntry(cc_uint8* data) {
1012 struct CpeExt* ext;
1013 cc_string name = UNSAFE_GetString(data);
1014 int version = data[67];
1015 Platform_Log2("cpe ext: %s, %i", &name, &version);
1016
1017 cpe_serverExtensionsCount--;
1018 CPE_SendCpeExtInfoReply();
1019
1020 ext = CPEExtensions_Find(&name);
1021 if (!ext) return;
1022 ext->serverVersion = min(ext->clientVersion, version);
1023
1024 /* update support state */
1025 if (ext == &extPlayerList_Ext) {
1026 Server.SupportsExtPlayerList = true;
1027 } else if (ext == &playerClick_Ext) {
1028 Server.SupportsPlayerClick = true;
1029 } else if (ext == &mapAppearance_Ext) {
1030 if (ext->serverVersion == 1) return;
1031 Protocol.Sizes[OPCODE_ENV_SET_MAP_APPEARANCE] += 4;
1032 } else if (ext == &longerMessages_Ext) {
1033 Server.SupportsPartialMessages = true;
1034 } else if (ext == &fullCP437_Ext) {
1035 Server.SupportsFullCP437 = true;
1036 } else if (ext == &blockDefsExt_Ext) {
1037 if (ext->serverVersion == 1) return;
1038 Protocol.Sizes[OPCODE_DEFINE_BLOCK_EXT] += 3;
1039 } else if (ext == &extEntityPos_Ext) {
1040 Protocol.Sizes[OPCODE_ENTITY_TELEPORT] += 6;
1041 Protocol.Sizes[OPCODE_ADD_ENTITY] += 6;
1042 Protocol.Sizes[OPCODE_EXT_ADD_ENTITY2] += 6;
1043 Protocol.Sizes[OPCODE_SET_SPAWNPOINT] += 6;
1044 Protocol.Sizes[OPCODE_ENTITY_TELEPORT_EXT] += 6;
1045 } else if (ext == &fastMap_Ext) {
1046 Protocol.Sizes[OPCODE_LEVEL_BEGIN] += 4;
1047 } else if (ext == &envMapAspect_Ext) {
1048 if (ext->serverVersion == 1) return;
1049 Protocol.Sizes[OPCODE_ENV_SET_MAP_URL] += 64;
1050 } else if (ext == &customModels_Ext) {
1051 if (ext->serverVersion == 2) {
1052 Protocol.Sizes[OPCODE_DEFINE_MODEL_PART] = 167;
1053 }
1054 } else if (ext == &notifyAction_Ext) {
1055 Server.SupportsNotifyAction = true;
1056 }
1057#ifdef EXTENDED_TEXTURES
1058 else if (ext == &extTextures_Ext) {
1059 Protocol.Sizes[OPCODE_DEFINE_BLOCK] += 3;
1060 Protocol.Sizes[OPCODE_DEFINE_BLOCK_EXT] += 6;
1061 }
1062#endif
1063#ifdef EXTENDED_BLOCKS
1064 else if (ext == &extBlocks_Ext) {
1065 if (!Game_AllowCustomBlocks) return;
1066
1067 Protocol.Sizes[OPCODE_SET_BLOCK] += 1;
1068 Protocol.Sizes[OPCODE_HOLD_THIS] += 1;

Callers

nothing calls this directly

Calls 4

UNSAFE_GetStringFunction · 0.85
Platform_Log2Function · 0.85
CPE_SendCpeExtInfoReplyFunction · 0.85
CPEExtensions_FindFunction · 0.85

Tested by

no test coverage detected