summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohannes <johannes.herman@gmail.com>2024-04-14 19:47:39 +0200
committerjohannes <johannes.herman@gmail.com>2024-04-14 19:47:39 +0200
commit4b9c34fa745ef22304899dfaf52b6a10c24cb86c (patch)
treeeed52d404ce6da0a27fa6bb6155e996527ec417c
parent8de23299d96c642ec39ec73d12322cc78865136c (diff)
removed old command system
-rw-r--r--inc/commands.h11
-rw-r--r--src/commands.c41
2 files changed, 1 insertions, 51 deletions
diff --git a/inc/commands.h b/inc/commands.h
index b48b28c..ef57009 100644
--- a/inc/commands.h
+++ b/inc/commands.h
@@ -3,15 +3,6 @@
#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);
@@ -26,6 +17,4 @@ int changemap(FILE *map, char *mapname, demo *demo);
/* Writes the map in demo to out */
int exportmap(FILE *out, demo *demo);
-void runcommand(cmdinput *cmd, demo *demo);
-
#endif // COMMANDS_H
diff --git a/src/commands.c b/src/commands.c
index 337b0d3..23ab0de 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -173,48 +173,9 @@ int changemap(FILE *map, char *mapname, demo *demo)
int exportmap(FILE *out, demo *demo)
{
- if (fwrite(demo->map.data, 1, demo->header.mapsize, out) < (unsigned int) demo->header.mapsize)
+ if (fwrite(demo->map.data, 1, demo->header.mapsize, out) < (unsigned int)demo->header.mapsize)
return -1;
return 1;
}
-void runcommand(cmdinput *cmd, demo *demo)
-{
- switch (cmd->cmdtype)
- {
- case 'n':
- switch (cmd->settype)
- {
- case 'i':
- if (setnamebyid(cmd->id, cmd->to, demo) < 0)
- printf("WARNING: Could not set name '%s' because it exeeds max limit of 15 characters\n", cmd->to);
- break;
- case 'n':
- if (setnamebyname(cmd->from, cmd->to, demo) < 0)
- printf("WARNING: Could not set name '%s' because it exeeds max limit of 15 characters\n", cmd->to);
- break;
- default:
- printf("WARNING: Unknown modifier for name\n");
- }
- break;
- case 's':
- switch (cmd->settype)
- {
- case 'i':
- if (setskinbyid(cmd->id, cmd->to, demo) < 0)
- printf("WARNING: Could not set skin '%s' because it exeeds max limit of 23 characters\n", cmd->to);
- break;
- case 'n':
- if (setskinbyname(cmd->from, cmd->to, demo) < 0)
- printf("WARNING: Could not set skin '%s' because it exeeds max limit of 23 characters\n", cmd->to);
- break;
- default:
- printf("WARNING: Unknown modifier for skin\n");
- }
- break;
- default:
- printf("WARNING: Unknown command type\n");
- break;
- }
-}