Run newer version of clang-format
FossilOrigin-Name: cc7ebd7f79185bc5f0a595af12d4de9ca8ad89c57858d96aaa7c0b8f9802d59f
This commit is contained in:
parent
20d8cfc364
commit
c7ee55e1e3
12 changed files with 31 additions and 40 deletions
20
src/Cube.m
20
src/Cube.m
|
@ -84,14 +84,12 @@ VARP(minmillis, 0, 5, 1000);
|
||||||
_userDataIRI =
|
_userDataIRI =
|
||||||
[OFFileManager.defaultManager currentDirectoryIRI];
|
[OFFileManager.defaultManager currentDirectoryIRI];
|
||||||
|
|
||||||
[OFFileManager.defaultManager
|
[OFFileManager.defaultManager createDirectoryAtIRI:
|
||||||
createDirectoryAtIRI:
|
|
||||||
[_userDataIRI IRIByAppendingPathComponent:@"demos"]
|
[_userDataIRI IRIByAppendingPathComponent:@"demos"]
|
||||||
createParents:true];
|
createParents:true];
|
||||||
[OFFileManager.defaultManager
|
[OFFileManager.defaultManager createDirectoryAtIRI:
|
||||||
createDirectoryAtIRI:
|
|
||||||
[_userDataIRI IRIByAppendingPathComponent:@"savegames"]
|
[_userDataIRI IRIByAppendingPathComponent:@"savegames"]
|
||||||
createParents:true];
|
createParents:true];
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | par) < 0)
|
if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | par) < 0)
|
||||||
fatal(@"Unable to initialize SDL");
|
fatal(@"Unable to initialize SDL");
|
||||||
|
@ -153,23 +151,23 @@ VARP(minmillis, 0, 5, 1000);
|
||||||
&xs, &ys, false) ||
|
&xs, &ys, false) ||
|
||||||
!installtex(3,
|
!installtex(3,
|
||||||
[_gameDataIRI IRIByAppendingPathComponent:
|
[_gameDataIRI IRIByAppendingPathComponent:
|
||||||
@"data/martin/base.png"],
|
@"data/martin/base.png"],
|
||||||
&xs, &ys, false) ||
|
&xs, &ys, false) ||
|
||||||
!installtex(6,
|
!installtex(6,
|
||||||
[_gameDataIRI IRIByAppendingPathComponent:
|
[_gameDataIRI IRIByAppendingPathComponent:
|
||||||
@"data/martin/ball1.png"],
|
@"data/martin/ball1.png"],
|
||||||
&xs, &ys, false) ||
|
&xs, &ys, false) ||
|
||||||
!installtex(7,
|
!installtex(7,
|
||||||
[_gameDataIRI IRIByAppendingPathComponent:
|
[_gameDataIRI IRIByAppendingPathComponent:
|
||||||
@"data/martin/smoke.png"],
|
@"data/martin/smoke.png"],
|
||||||
&xs, &ys, false) ||
|
&xs, &ys, false) ||
|
||||||
!installtex(8,
|
!installtex(8,
|
||||||
[_gameDataIRI IRIByAppendingPathComponent:
|
[_gameDataIRI IRIByAppendingPathComponent:
|
||||||
@"data/martin/ball2.png"],
|
@"data/martin/ball2.png"],
|
||||||
&xs, &ys, false) ||
|
&xs, &ys, false) ||
|
||||||
!installtex(9,
|
!installtex(9,
|
||||||
[_gameDataIRI IRIByAppendingPathComponent:
|
[_gameDataIRI IRIByAppendingPathComponent:
|
||||||
@"data/martin/ball3.png"],
|
@"data/martin/ball3.png"],
|
||||||
&xs, &ys, false) ||
|
&xs, &ys, false) ||
|
||||||
!installtex(4,
|
!installtex(4,
|
||||||
[_gameDataIRI
|
[_gameDataIRI
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#import <ObjFW/ObjFW.h>
|
#import <ObjFW/ObjFW.h>
|
||||||
|
|
||||||
@interface
|
@interface OFString (Cube)
|
||||||
OFString (Cube)
|
|
||||||
@property (readonly, nonatomic) int cube_intValue;
|
@property (readonly, nonatomic) int cube_intValue;
|
||||||
|
|
||||||
- (int)cube_intValueWithBase:(unsigned char)base;
|
- (int)cube_intValueWithBase:(unsigned char)base;
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
#include "cube.h"
|
#include "cube.h"
|
||||||
|
|
||||||
@implementation
|
@implementation OFString (Cube)
|
||||||
OFString (Cube)
|
|
||||||
- (int)cube_intValue
|
- (int)cube_intValue
|
||||||
{
|
{
|
||||||
@try {
|
@try {
|
||||||
|
|
|
@ -114,10 +114,9 @@ renderscore(Player *d)
|
||||||
{
|
{
|
||||||
OFString *lag = [OFString stringWithFormat:@"%d", d.lag];
|
OFString *lag = [OFString stringWithFormat:@"%d", d.lag];
|
||||||
OFString *name = [OFString stringWithFormat:@"(%@)", d.name];
|
OFString *name = [OFString stringWithFormat:@"(%@)", d.name];
|
||||||
OFString *line =
|
OFString *line = [OFString stringWithFormat:@"%d\t%@\t%d\t%@\t%@",
|
||||||
[OFString stringWithFormat:@"%d\t%@\t%d\t%@\t%@", d.frags,
|
d.frags, (d.state == CS_LAGGED ? @"LAG" : lag), d.ping, d.team,
|
||||||
(d.state == CS_LAGGED ? @"LAG" : lag), d.ping, d.team,
|
(d.state == CS_DEAD ? name : d.name)];
|
||||||
(d.state == CS_DEAD ? name : d.name)];
|
|
||||||
|
|
||||||
if (scoreLines == nil)
|
if (scoreLines == nil)
|
||||||
scoreLines = [[OFMutableArray alloc] init];
|
scoreLines = [[OFMutableArray alloc] init];
|
||||||
|
@ -171,7 +170,7 @@ renderscores()
|
||||||
OFMutableString *teamScores = [OFMutableString string];
|
OFMutableString *teamScores = [OFMutableString string];
|
||||||
for (size_t j = 0; j < teamsUsed; j++)
|
for (size_t j = 0; j < teamsUsed; j++)
|
||||||
[teamScores appendFormat:@"[ %@: %d ]", teamName[j],
|
[teamScores appendFormat:@"[ %@: %d ]", teamName[j],
|
||||||
teamScore[j]];
|
teamScore[j]];
|
||||||
menumanual(0, scoreLines.count, @"");
|
menumanual(0, scoreLines.count, @"");
|
||||||
menumanual(0, scoreLines.count + 1, teamScores);
|
menumanual(0, scoreLines.count + 1, teamScores);
|
||||||
}
|
}
|
||||||
|
@ -208,7 +207,7 @@ COMMAND(sendmap, ARG_1STR, (^(OFString *mapname) {
|
||||||
OFString *msg =
|
OFString *msg =
|
||||||
[OFString stringWithFormat:@"[map %@ uploaded to server, "
|
[OFString stringWithFormat:@"[map %@ uploaded to server, "
|
||||||
@"\"getmap\" to receive it]",
|
@"\"getmap\" to receive it]",
|
||||||
mapname];
|
mapname];
|
||||||
toserver(msg);
|
toserver(msg);
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ void
|
||||||
writeclientinfo(OFStream *stream)
|
writeclientinfo(OFStream *stream)
|
||||||
{
|
{
|
||||||
[stream writeFormat:@"name \"%@\"\nteam \"%@\"\n", Player.player1.name,
|
[stream writeFormat:@"name \"%@\"\nteam \"%@\"\n", Player.player1.name,
|
||||||
Player.player1.team];
|
Player.player1.team];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -353,7 +353,7 @@ writecfg()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[stream writeFormat:@"%@ %d\n", identifier.name,
|
[stream writeFormat:@"%@ %d\n", identifier.name,
|
||||||
*[identifier storage]];
|
*[identifier storage]];
|
||||||
}];
|
}];
|
||||||
[stream writeString:@"\n"];
|
[stream writeString:@"\n"];
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ writecfg()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[stream writeFormat:@"alias \"%@\" [%@]\n", identifier.name,
|
[stream writeFormat:@"alias \"%@\" [%@]\n", identifier.name,
|
||||||
[identifier action]];
|
[identifier action]];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[stream close];
|
[stream close];
|
||||||
|
|
|
@ -184,8 +184,7 @@ keypress(int code, bool isDown)
|
||||||
case SDLK_BACKSPACE:
|
case SDLK_BACKSPACE:
|
||||||
case SDLK_LEFT:
|
case SDLK_LEFT:
|
||||||
if (commandbuf.length > 0)
|
if (commandbuf.length > 0)
|
||||||
[commandbuf
|
[commandbuf deleteCharactersInRange:
|
||||||
deleteCharactersInRange:
|
|
||||||
OFMakeRange(
|
OFMakeRange(
|
||||||
commandbuf.length - 1, 1)];
|
commandbuf.length - 1, 1)];
|
||||||
|
|
||||||
|
@ -277,5 +276,5 @@ writebinds(OFStream *stream)
|
||||||
for (KeyMapping *mapping in keyMappings)
|
for (KeyMapping *mapping in keyMappings)
|
||||||
if (mapping.action.length > 0)
|
if (mapping.action.length > 0)
|
||||||
[stream writeFormat:@"bind \"%@\" [%@]\n", mapping.name,
|
[stream writeFormat:@"bind \"%@\" [%@]\n", mapping.name,
|
||||||
mapping.action];
|
mapping.action];
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,8 +199,8 @@ renderents()
|
||||||
closeent =
|
closeent =
|
||||||
[OFString stringWithFormat:@"closest entity = %@ (%d, %d, "
|
[OFString stringWithFormat:@"closest entity = %@ (%d, %d, "
|
||||||
@"%d, %d), selection = (%d, %d)",
|
@"%d, %d), selection = (%d, %d)",
|
||||||
entnames[c.type], c.attr1, c.attr2, c.attr3,
|
entnames[c.type], c.attr1, c.attr2, c.attr3, c.attr4,
|
||||||
c.attr4, getvar(@"selxs"), getvar(@"selys")];
|
getvar(@"selxs"), getvar(@"selys")];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ void
|
||||||
disconnect_client(int n, OFString *reason)
|
disconnect_client(int n, OFString *reason)
|
||||||
{
|
{
|
||||||
[OFStdOut writeFormat:@"disconnecting client (%@) [%@]\n",
|
[OFStdOut writeFormat:@"disconnecting client (%@) [%@]\n",
|
||||||
clients[n].hostname, reason];
|
clients[n].hostname, reason];
|
||||||
enet_peer_disconnect(clients[n].peer);
|
enet_peer_disconnect(clients[n].peer);
|
||||||
clients[n].type = ST_EMPTY;
|
clients[n].type = ST_EMPTY;
|
||||||
send2(true, -1, SV_CDIS, n);
|
send2(true, -1, SV_CDIS, n);
|
||||||
|
@ -490,7 +490,7 @@ serverslice(int seconds,
|
||||||
if ((intptr_t)event.peer->data < 0)
|
if ((intptr_t)event.peer->data < 0)
|
||||||
break;
|
break;
|
||||||
[OFStdOut writeFormat:@"disconnected client (%@)\n",
|
[OFStdOut writeFormat:@"disconnected client (%@)\n",
|
||||||
clients[(size_t)event.peer->data].hostname];
|
clients[(size_t)event.peer->data].hostname];
|
||||||
clients[(size_t)event.peer->data].type = ST_EMPTY;
|
clients[(size_t)event.peer->data].type = ST_EMPTY;
|
||||||
send2(true, -1, SV_CDIS, (intptr_t)event.peer->data);
|
send2(true, -1, SV_CDIS, (intptr_t)event.peer->data);
|
||||||
event.peer->data = (void *)-1;
|
event.peer->data = (void *)-1;
|
||||||
|
|
|
@ -221,8 +221,7 @@ refreshservers()
|
||||||
ServerInfo *si, size_t i, bool *stop) {
|
ServerInfo *si, size_t i, bool *stop) {
|
||||||
if (si.address.host != ENET_HOST_ANY && si.ping != 9999) {
|
if (si.address.host != ENET_HOST_ANY && si.ping != 9999) {
|
||||||
if (si.protocol != PROTOCOL_VERSION)
|
if (si.protocol != PROTOCOL_VERSION)
|
||||||
si.full = [OFString
|
si.full = [OFString stringWithFormat:
|
||||||
stringWithFormat:
|
|
||||||
@"%@ [different cube protocol]",
|
@"%@ [different cube protocol]",
|
||||||
si.name];
|
si.name];
|
||||||
else
|
else
|
||||||
|
@ -232,8 +231,7 @@ refreshservers()
|
||||||
si.map.length > 0 ? si.map : @"[unknown]",
|
si.map.length > 0 ? si.map : @"[unknown]",
|
||||||
modestr(si.mode), si.name, si.sdesc];
|
modestr(si.mode), si.name, si.sdesc];
|
||||||
} else
|
} else
|
||||||
si.full = [OFString
|
si.full = [OFString stringWithFormat:
|
||||||
stringWithFormat:
|
|
||||||
(si.address.host != ENET_HOST_ANY
|
(si.address.host != ENET_HOST_ANY
|
||||||
? @"%@ [waiting for server response]"
|
? @"%@ [waiting for server response]"
|
||||||
: @"%@ [unknown host]\t"),
|
: @"%@ [unknown host]\t"),
|
||||||
|
|
|
@ -30,7 +30,7 @@ httpgetsend(ENetAddress *ad, OFString *hostname, OFString *req, OFString *ref,
|
||||||
@"Host: %@\n"
|
@"Host: %@\n"
|
||||||
@"Referer: %@\n"
|
@"Referer: %@\n"
|
||||||
@"User-Agent: %@\n\n",
|
@"User-Agent: %@\n\n",
|
||||||
req, hostname, ref, agent];
|
req, hostname, ref, agent];
|
||||||
buf.data = (void *)httpget.UTF8String;
|
buf.data = (void *)httpget.UTF8String;
|
||||||
buf.dataLength = httpget.UTF8StringLength;
|
buf.dataLength = httpget.UTF8StringLength;
|
||||||
[OFStdOut writeFormat:@"sending request to %@...\n", hostname];
|
[OFStdOut writeFormat:@"sending request to %@...\n", hostname];
|
||||||
|
@ -140,9 +140,8 @@ serverms(int mode, int numplayers, int minremain, OFString *smapname,
|
||||||
putint(&p, mode);
|
putint(&p, mode);
|
||||||
putint(&p, numplayers);
|
putint(&p, numplayers);
|
||||||
putint(&p, minremain);
|
putint(&p, minremain);
|
||||||
OFString *mname =
|
OFString *mname = [OFString stringWithFormat:@"%@%@",
|
||||||
[OFString stringWithFormat:@"%@%@",
|
(isfull ? @"[FULL] " : @""), smapname];
|
||||||
(isfull ? @"[FULL] " : @""), smapname];
|
|
||||||
sendstring(mname, &p);
|
sendstring(mname, &p);
|
||||||
sendstring(serverdesc, &p);
|
sendstring(serverdesc, &p);
|
||||||
buf.dataLength = p - pong;
|
buf.dataLength = p - pong;
|
||||||
|
|
|
@ -40,7 +40,7 @@ setnames(OFString *name)
|
||||||
cgzname = [[OFString alloc]
|
cgzname = [[OFString alloc]
|
||||||
initWithFormat:@"packages/%@/%@.cgz", pakname, mapname];
|
initWithFormat:@"packages/%@/%@.cgz", pakname, mapname];
|
||||||
bakname = [[OFString alloc] initWithFormat:@"packages/%@/%@_%d.BAK",
|
bakname = [[OFString alloc] initWithFormat:@"packages/%@/%@_%d.BAK",
|
||||||
pakname, mapname, lastmillis];
|
pakname, mapname, lastmillis];
|
||||||
pcfname = [[OFString alloc]
|
pcfname = [[OFString alloc]
|
||||||
initWithFormat:@"packages/%@/package.cfg", pakname];
|
initWithFormat:@"packages/%@/package.cfg", pakname];
|
||||||
mcfname = [[OFString alloc]
|
mcfname = [[OFString alloc]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue