forked from pvpgn/d2gs109
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcharlist.h
More file actions
44 lines (34 loc) · 1.08 KB
/
charlist.h
File metadata and controls
44 lines (34 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef INCLUDED_CHARLIST_H
#define INCLUDED_CHARLIST_H
#include "d2gs.h"
/*
* from bnet/common/introtate.h
* Copyright (C) 2000 Ross Combs ([email protected])
*/
/* ROTL(x,n,w) rotates "w" bit wide value "x" by "n" bits to the left */
#ifndef ROTL
#define ROTL(x,n,w) (((n)%(w)) ? (((x)<<((n)%(w))) | ((x)>>((w)-((n)%(w))))) : (x))
#endif
#ifndef ROTL32
#define ROTL32(x,n) ROTL(x,n,32)
#endif
/* const */
#define DEFAULT_HASHTBL_LEN 1000
#define CHARLIST_GET_CHARINFO 1
#define CHARLIST_GET_GAMEINFO 2
/* charlist info */
typedef struct RAW_D2CHARLIST {
unsigned char charname[MAX_CHARNAME_LEN];
void *pCharInfo;
void *pGameInfo;
struct RAW_D2CHARLIST *next;
} D2CHARLIST, *PD2CHARLIST, *LPD2CHARLIST;
/* functions */
unsigned int string_hash(char const *string);
int charlist_init(unsigned int tbllen);
int charlist_destroy(void);
void charlist_flush(void);
void *charlist_getdata(unsigned char const *charname, int type);
int charlist_insert(unsigned char *charname, void *pCharInfo, void *pGameInfo);
int charlist_delete(unsigned char *charname);
#endif /* INCLUDED_CHARLIST_H */