Index: src/client.mm ================================================================== --- src/client.mm +++ src/client.mm @@ -162,18 +162,16 @@ } conoutf(@"attempting to disconnect..."); disconnect(0, !disconnecting); } -string ctext; +static OFString *ctext; void toserver(OFString *text) { - @autoreleasepool { - conoutf(@"%s:\f %@", player1->name, text); - strn0cpy(ctext, text.UTF8String, 80); - } + conoutf(@"%s:\f %@", player1->name, text); + ctext = text; } void echo(OFString *text) { @@ -236,33 +234,31 @@ int lastupdate = 0, lastping = 0; OFString *toservermap; bool senditemstoserver = false; // after a map change, since server doesn't have map data -string clientpassword; +OFString *clientpassword; void password(OFString *p) { - @autoreleasepool { - strcpy_s(clientpassword, p.UTF8String); - } + clientpassword = p; } COMMAND(password, ARG_1STR) bool netmapstart() { senditemstoserver = true; return clienthost != NULL; -}; +} void initclientnet() { - ctext[0] = 0; + ctext = @""; toservermap = @""; - clientpassword[0] = 0; + clientpassword = @""; newname(@"unnamed"); newteam(@"red"); } void @@ -327,17 +323,16 @@ putitems(p); putint(p, -1); senditemstoserver = false; serveriteminitdone = true; } - if (ctext[0]) // player chat, not flood protected for - // now - { + // player chat, not flood protected for now + if (ctext.length > 0) { packet->flags = ENET_PACKET_FLAG_RELIABLE; putint(p, SV_TEXT); - sendstring(@(ctext), p); - ctext[0] = 0; + sendstring(ctext, p); + ctext = @""; } if (!c2sinit) // tell other clients who I am { packet->flags = ENET_PACKET_FLAG_RELIABLE; c2sinit = true; Index: src/clients2c.mm ================================================================== --- src/clients2c.mm +++ src/clients2c.mm @@ -3,11 +3,11 @@ #include "cube.h" extern int clientnum; extern bool c2sinit, senditemstoserver; extern OFString *toservermap; -extern string clientpassword; +extern OFString *clientpassword; void neterr(OFString *s) { conoutf(@"illegal network message (%@)", s); @@ -87,15 +87,19 @@ if (!getint(p)) // we are the first client on this server, set // map toservermap = getclientmap(); sgetstr(); - if (text[0] && strcmp(text, clientpassword)) { - conoutf(@"you need to set the correct password " - @"to join this server!"); - disconnect(); - return; + @autoreleasepool { + if (text[0] && + strcmp(text, clientpassword.UTF8String)) { + conoutf(@"you need to set the correct " + @"password " + @"to join this server!"); + disconnect(); + return; + } } if (getint(p) == 1) conoutf(@"server is FULL, disconnecting.."); break; } Index: src/weapon.mm ================================================================== --- src/weapon.mm +++ src/weapon.mm @@ -119,17 +119,15 @@ loopv(players) { dynent *o = players[i]; if (!o) continue; - if (intersect(o, player1->o, worldpos)) { - @autoreleasepool { - return @(o->name); - } - } + if (intersect(o, player1->o, worldpos)) + return @(o->name); } - return NULL; + + return nil; } const int MAXPROJ = 100; struct projectile { OFVector3D o, to;