mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
Simplify protocol.c for when string arguments don't need to be variable
Also add missing document. in hosting-flask.md, fixes #679 (Thanks ToonDragon)
This commit is contained in:
parent
2b83dbc32a
commit
c44153a50b
@ -143,7 +143,7 @@ if __name__ == "__main__":
|
||||
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
||||
console.error(text);
|
||||
},
|
||||
canvas: (function() { return getElementById('GameCanvas'); })(),
|
||||
canvas: (function() { return document.getElementById('GameCanvas'); })(),
|
||||
setStatus: function(text) {
|
||||
console.log(text);
|
||||
document.getElementById('logmsg').innerHTML = text;
|
||||
|
@ -367,13 +367,13 @@ void Classic_WriteSetBlock(int x, int y, int z, cc_bool place, BlockID block) {
|
||||
Server.WriteBuffer = data;
|
||||
}
|
||||
|
||||
void Classic_SendLogin(const String* username, const String* verKey) {
|
||||
void Classic_SendLogin(void) {
|
||||
cc_uint8 data[131];
|
||||
data[0] = OPCODE_HANDSHAKE;
|
||||
{
|
||||
data[1] = 7; /* protocol version */
|
||||
WriteString(&data[2], username);
|
||||
WriteString(&data[66], verKey);
|
||||
WriteString(&data[2], &Game_Username);
|
||||
WriteString(&data[66], &Game_Mppass);
|
||||
data[130] = Game_UseCPE ? 0x42 : 0x00;
|
||||
}
|
||||
Server.SendData(data, 131);
|
||||
@ -787,12 +787,12 @@ void CPE_SendPlayerClick(int button, cc_bool pressed, cc_uint8 targetId, struct
|
||||
Server.SendData(data, 15);
|
||||
}
|
||||
|
||||
static void CPE_SendExtInfo(const String* appName, int extsCount) {
|
||||
static void CPE_SendExtInfo(int extsCount) {
|
||||
cc_uint8 data[67];
|
||||
data[0] = OPCODE_EXT_INFO;
|
||||
{
|
||||
WriteString(&data[1], appName);
|
||||
Stream_SetU16_BE(&data[65], extsCount);
|
||||
WriteString(&data[1], &Server.AppName);
|
||||
Stream_SetU16_BE(&data[65], extsCount);
|
||||
}
|
||||
Server.SendData(data, 67);
|
||||
}
|
||||
@ -802,7 +802,7 @@ static void CPE_SendExtEntry(const String* extName, int extVersion) {
|
||||
data[0] = OPCODE_EXT_ENTRY;
|
||||
{
|
||||
WriteString(&data[1], extName);
|
||||
Stream_SetU32_BE(&data[65], extVersion);
|
||||
Stream_SetU32_BE(&data[65], extVersion);
|
||||
}
|
||||
Server.SendData(data, 69);
|
||||
}
|
||||
@ -836,7 +836,7 @@ static void CPE_SendCpeExtInfoReply(void) {
|
||||
#else
|
||||
if (!Game_AllowCustomBlocks) count -= 2;
|
||||
#endif
|
||||
CPE_SendExtInfo(&Server.AppName, count);
|
||||
CPE_SendExtInfo(count);
|
||||
|
||||
for (i = 0; i < Array_Elems(cpe_clientExtensions); i++) {
|
||||
name = String_FromReadonly(cpe_clientExtensions[i]);
|
||||
|
@ -57,6 +57,6 @@ extern cc_bool cpe_needD3Fix;
|
||||
void Classic_SendChat(const String* text, cc_bool partial);
|
||||
void Classic_WritePosition(Vec3 pos, float yaw, float pitch);
|
||||
void Classic_WriteSetBlock(int x, int y, int z, cc_bool place, BlockID block);
|
||||
void Classic_SendLogin(const String* username, const String* verKey);
|
||||
void Classic_SendLogin(void);
|
||||
void CPE_SendPlayerClick(int button, cc_bool pressed, cc_uint8 targetId, struct RayTracer* t);
|
||||
#endif
|
||||
|
@ -251,7 +251,7 @@ static void MPConnection_FinishConnect(void) {
|
||||
net_readCurrent = net_readBuffer;
|
||||
Server.WriteBuffer = net_writeBuffer;
|
||||
|
||||
Classic_SendLogin(&Game_Username, &Game_Mppass);
|
||||
Classic_SendLogin();
|
||||
net_lastPacket = Game.Time;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user