X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Fserver%2Fcommon.h;h=004fbf877e116f4d08ab61d81cda36bcd81b2546;hb=a1922dafee706200fef62e63718c206d2c3d9ba3;hp=a216dd5b4406307a2bf5a1dec4c68caf6d8a7dab;hpb=7aab29aca5fcb29bf86beb6602a721bec4ba1d08;p=tpg%2Fopendispense2.git diff --git a/src/server/common.h b/src/server/common.h index a216dd5..004fbf8 100644 --- a/src/server/common.h +++ b/src/server/common.h @@ -22,6 +22,8 @@ #define UNUSED(var) unused__##var __attribute__((__unused__)) +#define ASSERT(cnd) do{if(!(cnd)){fprintf(stderr, "ASSERT failed at "__FILE__":"EXPSTR(__LINE__)" - "EXPSTR(cnd)"\n");exit(-1);}}while(0) + // === STRUCTURES === typedef struct sItem tItem; typedef struct sUser tUser; @@ -33,6 +35,7 @@ struct sItem char *Name; //!< Display Name int Price; //!< Price int bHidden; //!< Hidden item? + int bDisabledi; //!< Disabled Item tHandler *Handler; //!< Handler for the item short ID; //!< Item ID @@ -75,6 +78,7 @@ extern int giDebugLevel; extern void Items_UpdateFile(void); // --- Helpers -- +extern void StartPeriodicThread(void); extern void AddPeriodicFunction(void (*Fcn)(void)); extern void CompileRegex(regex_t *Regex, const char *Pattern, int Flags); extern int RunRegex(regex_t *regex, const char *string, int nMatches, regmatch_t *matches, const char *errorMessage); @@ -94,4 +98,12 @@ extern int DispenseUpdateItem(int User, tItem *Item, const char *NewName, int Ne extern void Log_Error(const char *Format, ...); extern void Log_Info(const char *Format, ...); +// --- Config Database --- +extern void Config_ParseFile(const char *Filename); +extern void Config_AddValue(const char *Key, const char *Value); +extern int Config_GetValueCount(const char *KeyName); +extern const char *Config_GetValue(const char *KeyName, int Index); +extern int Config_GetValue_Bool(const char *KeyName, int Index); +extern int Config_GetValue_Int(const char *KeyName, int Index); + #endif