From c2e349569fcf796412b376db89304a19648f18b8 Mon Sep 17 00:00:00 2001 From: johannes Date: Sun, 11 Feb 2024 02:00:20 +0100 Subject: added argument parser and run function --- inc/args.h | 22 ++++++++++++++++++++++ inc/commands.h | 11 +++++++++++ 2 files changed, 33 insertions(+) create mode 100644 inc/args.h (limited to 'inc') diff --git a/inc/args.h b/inc/args.h new file mode 100644 index 0000000..6c06fb2 --- /dev/null +++ b/inc/args.h @@ -0,0 +1,22 @@ +#ifndef ARGS_H +#define ARGS_H + +#include "../inc/commands.h" + +#define MAX_COMMANDS 64 + +typedef struct +{ + char *demopath; + char *mappath; + char *outpath; + char *extractmap; + char print; + + int numcmds; + cmdinput commands[MAX_COMMANDS]; +} input; + +void parseargs(input *in, int argc, char *argv[]); + +#endif // ARGS_H diff --git a/inc/commands.h b/inc/commands.h index 654d8b7..9761151 100644 --- a/inc/commands.h +++ b/inc/commands.h @@ -3,6 +3,15 @@ #include "demo.h" +typedef struct +{ + char cmdtype; + char settype; + int id; + char from[24]; + char to[24]; +} cmdinput; + int setnamebyid(int id, char *newname, demo *demo); int setnamebyname(char *oldname, char *newname, demo *demo); @@ -14,4 +23,6 @@ int setskinbyname(char *name, char *skin, demo *demo); /* Will fail if mapname >= 31, or map is not a teeworlds datafile */ int changemap(FILE *map, char *mapname, demo *demo); +void runcommand(cmdinput *cmd, demo *demo); + #endif // COMMANDS_H -- cgit v1.2.3