Clean up identifiers, use blocks for commands

FossilOrigin-Name: d7661be1b1dc8fda8e4de50f9a9d75907f498e6e07530241fb04be015ca3d9ae
This commit is contained in:
Jonathan Schleifer 2025-03-23 19:40:00 +00:00
parent e995b95a84
commit daa4c19312
25 changed files with 391 additions and 535 deletions

View file

@ -2,6 +2,7 @@
#include "cube.h"
#import "Command.h"
#import "DynamicEntity.h"
#import "Monster.h"
@ -177,9 +178,7 @@ renderscores()
// sendmap/getmap commands, should be replaced by more intuitive map downloading
void
sendmap(OFString *mapname)
{
COMMAND(sendmap, ARG_1STR, (^(OFString *mapname) {
if (mapname.length > 0)
save_world(mapname);
changemap(mapname);
@ -210,11 +209,9 @@ sendmap(OFString *mapname)
@"\"getmap\" to receive it]",
mapname];
toserver(msg);
}
}))
void
getmap()
{
COMMAND(getmap, ARG_NONE, ^{
ENetPacket *packet =
enet_packet_create(NULL, MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
unsigned char *start = packet->data;
@ -224,7 +221,4 @@ getmap()
enet_packet_resize(packet, p - start);
sendpackettoserv(packet);
conoutf(@"requesting map from server...");
}
COMMAND(sendmap, ARG_1STR)
COMMAND(getmap, ARG_NONE)
})