More string migration
FossilOrigin-Name: 245efe8045462b8ece957f5bed9f5543ec761f4506353d571186a7efb469b878
This commit is contained in:
parent
745514762e
commit
7ab817d420
3 changed files with 26 additions and 29 deletions
|
@ -164,14 +164,12 @@ trydisconnect()
|
|||
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
|
||||
|
@ -238,13 +236,11 @@ 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)
|
||||
|
||||
|
@ -253,14 +249,14 @@ netmapstart()
|
|||
{
|
||||
senditemstoserver = true;
|
||||
return clienthost != NULL;
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
initclientnet()
|
||||
{
|
||||
ctext[0] = 0;
|
||||
ctext = @"";
|
||||
toservermap = @"";
|
||||
clientpassword[0] = 0;
|
||||
clientpassword = @"";
|
||||
newname(@"unnamed");
|
||||
newteam(@"red");
|
||||
}
|
||||
|
@ -329,13 +325,12 @@ c2sinfo(dynent *d) // send update to the server
|
|||
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
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
extern int clientnum;
|
||||
extern bool c2sinit, senditemstoserver;
|
||||
extern OFString *toservermap;
|
||||
extern string clientpassword;
|
||||
extern OFString *clientpassword;
|
||||
|
||||
void
|
||||
neterr(OFString *s)
|
||||
|
@ -89,11 +89,15 @@ localservertoclient(
|
|||
// 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..");
|
||||
|
|
|
@ -121,13 +121,11 @@ playerincrosshair()
|
|||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue