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);
|
disconnect(0, !disconnecting);
|
||||||
}
|
}
|
||||||
|
|
||||||
string ctext;
|
static OFString *ctext;
|
||||||
void
|
void
|
||||||
toserver(OFString *text)
|
toserver(OFString *text)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
conoutf(@"%s:\f %@", player1->name, text);
|
||||||
conoutf(@"%s:\f %@", player1->name, text);
|
ctext = text;
|
||||||
strn0cpy(ctext, text.UTF8String, 80);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -238,13 +236,11 @@ OFString *toservermap;
|
||||||
bool senditemstoserver =
|
bool senditemstoserver =
|
||||||
false; // after a map change, since server doesn't have map data
|
false; // after a map change, since server doesn't have map data
|
||||||
|
|
||||||
string clientpassword;
|
OFString *clientpassword;
|
||||||
void
|
void
|
||||||
password(OFString *p)
|
password(OFString *p)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
clientpassword = p;
|
||||||
strcpy_s(clientpassword, p.UTF8String);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
COMMAND(password, ARG_1STR)
|
COMMAND(password, ARG_1STR)
|
||||||
|
|
||||||
|
@ -253,14 +249,14 @@ netmapstart()
|
||||||
{
|
{
|
||||||
senditemstoserver = true;
|
senditemstoserver = true;
|
||||||
return clienthost != NULL;
|
return clienthost != NULL;
|
||||||
};
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
initclientnet()
|
initclientnet()
|
||||||
{
|
{
|
||||||
ctext[0] = 0;
|
ctext = @"";
|
||||||
toservermap = @"";
|
toservermap = @"";
|
||||||
clientpassword[0] = 0;
|
clientpassword = @"";
|
||||||
newname(@"unnamed");
|
newname(@"unnamed");
|
||||||
newteam(@"red");
|
newteam(@"red");
|
||||||
}
|
}
|
||||||
|
@ -329,13 +325,12 @@ c2sinfo(dynent *d) // send update to the server
|
||||||
senditemstoserver = false;
|
senditemstoserver = false;
|
||||||
serveriteminitdone = true;
|
serveriteminitdone = true;
|
||||||
}
|
}
|
||||||
if (ctext[0]) // player chat, not flood protected for
|
// player chat, not flood protected for now
|
||||||
// now
|
if (ctext.length > 0) {
|
||||||
{
|
|
||||||
packet->flags = ENET_PACKET_FLAG_RELIABLE;
|
packet->flags = ENET_PACKET_FLAG_RELIABLE;
|
||||||
putint(p, SV_TEXT);
|
putint(p, SV_TEXT);
|
||||||
sendstring(@(ctext), p);
|
sendstring(ctext, p);
|
||||||
ctext[0] = 0;
|
ctext = @"";
|
||||||
}
|
}
|
||||||
if (!c2sinit) // tell other clients who I am
|
if (!c2sinit) // tell other clients who I am
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
extern int clientnum;
|
extern int clientnum;
|
||||||
extern bool c2sinit, senditemstoserver;
|
extern bool c2sinit, senditemstoserver;
|
||||||
extern OFString *toservermap;
|
extern OFString *toservermap;
|
||||||
extern string clientpassword;
|
extern OFString *clientpassword;
|
||||||
|
|
||||||
void
|
void
|
||||||
neterr(OFString *s)
|
neterr(OFString *s)
|
||||||
|
@ -89,11 +89,15 @@ localservertoclient(
|
||||||
// map
|
// map
|
||||||
toservermap = getclientmap();
|
toservermap = getclientmap();
|
||||||
sgetstr();
|
sgetstr();
|
||||||
if (text[0] && strcmp(text, clientpassword)) {
|
@autoreleasepool {
|
||||||
conoutf(@"you need to set the correct password "
|
if (text[0] &&
|
||||||
@"to join this server!");
|
strcmp(text, clientpassword.UTF8String)) {
|
||||||
disconnect();
|
conoutf(@"you need to set the correct "
|
||||||
return;
|
@"password "
|
||||||
|
@"to join this server!");
|
||||||
|
disconnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (getint(p) == 1)
|
if (getint(p) == 1)
|
||||||
conoutf(@"server is FULL, disconnecting..");
|
conoutf(@"server is FULL, disconnecting..");
|
||||||
|
|
|
@ -121,13 +121,11 @@ playerincrosshair()
|
||||||
dynent *o = players[i];
|
dynent *o = players[i];
|
||||||
if (!o)
|
if (!o)
|
||||||
continue;
|
continue;
|
||||||
if (intersect(o, player1->o, worldpos)) {
|
if (intersect(o, player1->o, worldpos))
|
||||||
@autoreleasepool {
|
return @(o->name);
|
||||||
return @(o->name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return NULL;
|
|
||||||
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int MAXPROJ = 100;
|
const int MAXPROJ = 100;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue