Skip to content

Commit

Permalink
Extract json support to its own files
Browse files Browse the repository at this point in the history
Extract json support into its own files so we don't get yet more functionality in the main qstat files.

Also:
* Created basic armyops files to facilitate the above.
  • Loading branch information
stevenh committed Nov 27, 2016
1 parent 1bfa280 commit ad6588e
Show file tree
Hide file tree
Showing 8 changed files with 1,302 additions and 1,284 deletions.
4 changes: 3 additions & 1 deletion Makefile.am
Expand Up @@ -14,6 +14,7 @@ qstat_SOURCES = \
qserver.c qserver.h \
qstat.c qstat.h \
template.c \
display_json.c display_json.h \
a2s.c a2s.h \
packet_manip.c packet_manip.h \
ut2004.c ut2004.h \
Expand All @@ -39,7 +40,8 @@ qstat_SOURCES = \
starmade.c starmade.h \
farmsim.c farmsim.h \
ksp.c ksp.h \
tf.c tf.h
tf.c tf.h \
armyops.c armyops.h

dist_configfiles_DATA = qstat.cfg
configfilesdir = $(sysconfdir)
Expand Down
40 changes: 39 additions & 1 deletion Makefile.noauto
Expand Up @@ -10,7 +10,45 @@ CFLAGS = -DDEBUG=1 -DENABLE_DUMP=1
## NOTE: if you get errors when linking qstat (missing symbols or
## libraries), then modify LDFLAGS or LDLIBS

SRC = utils.c xform.c config.c debug.c hcache.c md5.c qserver.c qstat.c template.c ut2004.c a2s.c packet_manip.c gs3.c gs2.c gps.c ts2.c doom3.c tm.c haze.c wic.c ottd.c fl.c tee.c ts3.c bfbc2.c ventrilo.c cube2.c mumble.c terraria.c crysis.c dirtybomb.c starmade.c farmsim.c ksp.c tf.c
SRC = \
utils.c \
xform.c \
config.c \
debug.c \
hcache.c \
md5.c \
qserver.c \
qstat.c \
template.c \
display_json.c \
ut2004.c \
a2s.c \
packet_manip.c \
gs3.c \
gs2.c \
gps.c \
ts2.c \
doom3.c \
tm.c \
haze.c \
wic.c \
ottd.c \
fl.c \
tee.c \
ts3.c \
bfbc2.c \
ventrilo.c \
cube2.c \
mumble.c \
terraria.c \
crysis.c \
dirtybomb.c \
starmade.c \
farmsim.c \
ksp.c \
tf.c \
armyops.c

OBJ = $(SRC:.c=.obj)
O = $(SRC:.c=.o)

Expand Down
26 changes: 26 additions & 0 deletions armyops.c
@@ -0,0 +1,26 @@
/*
* qstat
*
* Armyops Protocol
* Copyright 2005 Omnix
*
* Licensed under the Artistic License, see LICENSE.txt for license terms
*
*/

#include "qstat.h"

void
json_display_armyops_player_info(struct qserver *server)
{
struct player *player;

player = server->players;
for (; player != NULL; player = player->next) {
player->score = calculate_armyops_score(player);
}

json_display_player_info(server);
}

// vim: sw=4 ts=4 noet
15 changes: 15 additions & 0 deletions armyops.h
@@ -0,0 +1,15 @@
/*
* qstat
*
* Armyops Protocol
* Copyright 2005 Omnix
*
* Licensed under the Artistic License, see LICENSE.txt for license terms
*/
#ifndef QSTAT_ARMOPS_H
#define QSTAT_ARMOPS_H

int calculate_armyops_score(struct player *player);
void json_display_armyops_player_info(struct qserver *server);

#endif

0 comments on commit ad6588e

Please sign in to comment.