36 lines
1.0 KiB
C
36 lines
1.0 KiB
C
#ifndef CONSOLE_H
|
|
#define CONSOLE_H
|
|
#define COMMAND_HASH_SIZE 256
|
|
#include "helper.h"
|
|
/*** ConsoleEntry
|
|
ConsoleEntry, akin to Tiles, stores pointers to the previous and next ConsoleEntry structs in a chain.
|
|
***/
|
|
struct ConsoleEntry {
|
|
int size;
|
|
struct ConsoleEntry *prev;
|
|
struct ConsoleEntry *next;
|
|
char *string; // alloc'd
|
|
};
|
|
|
|
void consoleAppendEntry(const struct ConsoleEntry entry);
|
|
void consoleLog(const char *string);
|
|
void consoleProcessCommand(const char *command_string);
|
|
|
|
const char *consoleGetEntryString(const struct ConsoleEntry *entry);
|
|
|
|
struct ConsoleEntry *console_first_entry;
|
|
struct ConsoleEntry *console_last_entry;
|
|
|
|
void (*console_commands_table[COMMAND_HASH_SIZE]) ();
|
|
|
|
int consoleGenerateHash(const char *command_string);
|
|
void consoleAddCommand(const char *command_string, void(*function));
|
|
void consoleFreeCommand(char **command_array);
|
|
char** consoleGetCommand(const char* string);
|
|
|
|
char console_cmd[31];
|
|
int console_cmd_offset;
|
|
int console_cmd_size; // the size in chars of our command
|
|
|
|
#endif
|