This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | commac |
Defines | |
#define | NUM_COMMAC 500 |
Functions | |
void | load_commac () |
void | save_commac () |
void | purge_commac () |
void | sort_com_aliases () |
commac * | get_commac () |
commac * | create_new_commac () |
void | destroy_commac () |
void | add_commac () |
void | del_commac () |
void | save_comsys_and_macros (char *) |
void | load_comsys_and_macros (char *) |
Variables | |
commac * | commac_table [NUM_COMMAC] |
#define NUM_COMMAC 500 |
Definition at line 23 of file commac.h.
Referenced by add_commac(), clear_macro_set(), del_commac(), get_commac(), load_comsys_and_macros(), mmdb_db_write(), purge_commac(), and save_commac().
void add_commac | ( | ) |
struct commac* create_new_commac | ( | ) |
Definition at line 204 of file commac.c.
References c, and coolmenu_type::next.
Referenced by get_commac(), load_commac(), and mmdb_db_read().
00205 { 00206 struct commac *c; 00207 int i; 00208 00209 c = (struct commac *) malloc(sizeof(struct commac)); 00210 00211 c->who = -1; 00212 c->numchannels = 0; 00213 c->maxchannels = 0; 00214 c->alias = NULL; 00215 c->channels = NULL; 00216 00217 c->curmac = -1; 00218 for(i = 0; i < 5; i++) 00219 c->macros[i] = -1; 00220 00221 c->next = NULL; 00222 return c; 00223 }
void del_commac | ( | ) |
void destroy_commac | ( | ) |
struct commac* get_commac | ( | ) |
void load_commac | ( | ) |
void load_comsys_and_macros | ( | char * | ) |
Definition at line 23 of file commac.c.
References commac_table, load_commac(), load_comsystem(), load_macros(), and NUM_COMMAC.
Referenced by load_game().
00024 { 00025 FILE *fp; 00026 int i; 00027 char buffer[200]; 00028 00029 for(i = 0; i < NUM_COMMAC; i++) 00030 commac_table[i] = NULL; 00031 00032 if(!(fp = fopen(filename, "r"))) { 00033 fprintf(stderr, "Error: Couldn't find %s.\n", filename); 00034 } else { 00035 fprintf(stderr, "LOADING: %s\n", filename); 00036 if(fscanf(fp, "*** Begin %s ***\n", buffer) == 1 && 00037 !strcmp(buffer, "COMMAC")) { 00038 load_commac(fp); 00039 } else { 00040 fprintf(stderr, "Error: Couldn't find Begin COMMAC in %s.", 00041 filename); 00042 return; 00043 } 00044 00045 if(fscanf(fp, "*** Begin %s ***\n", buffer) == 1 && 00046 !strcmp(buffer, "COMSYS")) { 00047 load_comsystem(fp); 00048 } else { 00049 fprintf(stderr, "Error: Couldn't find Begin COMSYS in %s.", 00050 filename); 00051 return; 00052 } 00053 00054 if(fscanf(fp, "*** Begin %s ***\n", buffer) == 1 && 00055 !strcmp(buffer, "MACRO")) { 00056 load_macros(fp); 00057 } else { 00058 fprintf(stderr, "Error: Couldn't find Begin MACRO in %s.", 00059 filename); 00060 return; 00061 } 00062 00063 fclose(fp); 00064 fprintf(stderr, "LOADING: %s (done)\n", filename); 00065 } 00066 }
void purge_commac | ( | ) |
Definition at line 134 of file commac.c.
References c, commac_table, commac::curmac, del_commac(), God, Going, commac::macros, commac::next, NUM_COMMAC, commac::numchannels, Owner, TYPE_PLAYER, Typeof, and commac::who.
Referenced by load_commac(), mmdb_db_read(), mmdb_db_write(), and save_commac().
00135 { 00136 struct commac *c; 00137 struct commac *d; 00138 int i; 00139 00140 #ifdef ABORT_PURGE_COMSYS 00141 return; 00142 #endif /* 00143 * * ABORT_PURGE_COMSYS 00144 */ 00145 00146 for(i = 0; i < NUM_COMMAC; i++) { 00147 c = commac_table[i]; 00148 while (c) { 00149 d = c; 00150 c = c->next; 00151 if(d->numchannels == 0 && d->curmac == -1 && 00152 d->macros[1] == -1 && d->macros[2] == -1 && 00153 d->macros[3] == -1 && d->macros[4] == -1 && 00154 d->macros[0] == -1) { 00155 del_commac(d->who); 00156 continue; 00157 } 00158 00159 /* 00160 * if ((Typeof(d->who) != TYPE_PLAYER) && (God(Owner(d->who))) && 00161 * * (Going(d->who))) 00162 */ 00163 if(Typeof(d->who) == TYPE_PLAYER) 00164 continue; 00165 if(God(Owner(d->who)) && Going(d->who)) { 00166 del_commac(d->who); 00167 continue; 00168 } 00169 } 00170 } 00171 }
void save_commac | ( | ) |
void save_comsys_and_macros | ( | char * | ) |
Definition at line 68 of file commac.c.
References save_commac(), save_comsystem(), and save_macros().
Referenced by dump_database_internal().
00069 { 00070 FILE *fp; 00071 char buffer[500]; 00072 00073 sprintf(buffer, "%s.#", filename); 00074 if(!(fp = fopen(buffer, "w"))) { 00075 fprintf(stderr, "Unable to open %s for writing.\n", buffer); 00076 return; 00077 } 00078 fprintf(fp, "*** Begin COMMAC ***\n"); 00079 save_commac(fp); 00080 00081 fprintf(fp, "*** Begin COMSYS ***\n"); 00082 save_comsystem(fp); 00083 00084 fprintf(fp, "*** Begin MACRO ***\n"); 00085 save_macros(fp); 00086 00087 fclose(fp); 00088 rename(buffer, filename); 00089 }
void sort_com_aliases | ( | ) |
struct commac* commac_table[NUM_COMMAC] |
Definition at line 25 of file commac.h.
Referenced by add_commac(), clear_macro_set(), del_commac(), get_commac(), load_comsys_and_macros(), mmdb_db_write(), purge_commac(), and save_commac().