#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "tables.h"
#include "enhanced_disable.h"
Include dependency graph for enhanced_disable.c:

Go to the source code of this file.
Functions | |
| bool | check_enhanced_disabled (CHAR_DATA *ch, const struct cmd_type *command) |
| EDISABLED_DATA * | create_disable_thread (CHAR_DATA *ch, char *type, int runner, char *who) |
| void | destroy_disable_thread (EDISABLED_DATA *p) |
| void | do_enhanced_disable (CHAR_DATA *ch, char *argument) |
| void | load_enhanced_disable (void) |
| void | save_enhanced_disabled (void) |
Variables | |
| EDISABLED_DATA * | e_disabled_first |
|
||||||||||||
|
Definition at line 308 of file enhanced_disable.c. References clan_table, e_disabled_data::command, cmd_type::do_fun, e_disabled_first, FALSE, kingdom_table, kingdom_type::name, clan_type::name, race_type::name, e_disabled_data::next, race_table, str_cmp(), TRUE, e_disabled_data::type, and e_disabled_data::who. Referenced by interpret(). 00309 {
00310 EDISABLED_DATA *p;
00311 for(p = e_disabled_first;p;p = p->next)
00312 {
00313 if (!str_cmp(p->type, "race") && !str_cmp(race_table[ch->race].name, p->who)
00314 && p->command->do_fun == command->do_fun)
00315 return TRUE;
00316 if (!str_cmp(p->type, "clan") && !str_cmp(clan_table[ch->clan].name, p->who)
00317 && p->command->do_fun == command->do_fun)
00318 return TRUE;
00319 if (!str_cmp(p->type, "kingdom") && !str_cmp(kingdom_table[ch->king].name, p->who)
00320 && p->command->do_fun == command->do_fun)
00321 return TRUE;
00322 if (!str_cmp(p->type, "character") && !str_cmp(ch->name, p->who)
00323 && p->command->do_fun == command->do_fun)
00324 return TRUE;
00325 if (!str_cmp(p->type, "all") && p->command->do_fun == command->do_fun)
00326 return TRUE;
00327 return FALSE;
00328 }
00329 return FALSE;
00330 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 112 of file enhanced_disable.c. References alloc_mem(), cmd_table, e_disabled_data::command, e_disabled_first, e_disabled_data::next, save_enhanced_disabled(), str_dup(), e_disabled_data::type, e_disabled_data::who, e_disabled_data::who_disabled, and e_disabled_data::who_level. Referenced by do_enhanced_disable(). 00113 {
00114 EDISABLED_DATA *p;
00115
00116 p=NULL;
00117 p = alloc_mem(sizeof(EDISABLED_DATA));
00118 p->who_disabled = str_dup(ch->name);
00119 p->who_level = ch->level;
00120 p->command = &cmd_table[runner];
00121 p->type = str_dup(type);
00122 p->who = str_dup(who);
00123 p->next = e_disabled_first;
00124 e_disabled_first = p;
00125 save_enhanced_disabled();
00126
00127
00128 return p;
00129
00130 }
|
Here is the call graph for this function:

|
|
Definition at line 93 of file enhanced_disable.c. References e_disabled_first, free_mem(), free_string(), e_disabled_data::next, and save_enhanced_disabled(). Referenced by do_enhanced_disable(). 00094 {
00095 EDISABLED_DATA *p_run;
00096
00097 if (e_disabled_first == p)
00098 e_disabled_first = p->next;
00099 else
00100 {
00101 for (p_run = e_disabled_first; p_run->next != p; p_run = p_run->next)
00102 p_run->next = p->next;
00103 }
00104 free_string(p->who_disabled);
00105 free_string(p->who);
00106 free_string(p->type);
00107 free_mem(p, sizeof(EDISABLED_DATA));
00108 save_enhanced_disabled();
00109 p = NULL;
00110 return;
00111 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 134 of file enhanced_disable.c. References clan_lookup(), clan_table, cmd_table, e_disabled_data::command, create_disable_thread(), destroy_disable_thread(), e_disabled_first, get_char_world(), kingdom_lookup(), kingdom_table, MAX_STRING_LENGTH, char_data::name, cmd_type::name, e_disabled_data::next, one_argument(), race_lookup(), race_table, send_to_char(), str_cmp(), str_dup(), str_prefix(), TRUE, e_disabled_data::type, e_disabled_data::who, e_disabled_data::who_disabled, and e_disabled_data::who_level. 00135 {
00136 char arg[MAX_STRING_LENGTH];
00137 char buf[MAX_STRING_LENGTH];
00138 char arg1[MAX_STRING_LENGTH];
00139 char *type;
00140 EDISABLED_DATA *p,*q;
00141 CHAR_DATA *victim;
00142 bool found,multi;
00143 int runner=0;
00144
00145 argument = one_argument(argument, arg);
00146 argument = one_argument(argument, arg1);
00147
00148 if (arg[0] == '\0')
00149 {
00150 send_to_char("Syntax: edisable [ALL|CLAN|KINGDOM|RACE|CHARACTER] [who] <command>\n\r",ch);
00151
00152 }
00153
00154 if (arg[0] == '\0' || arg1[0] == '\0')
00155 {
00156 send_to_char("Enhanced Disabled Commands:\n\r\n\r",ch);
00157 sprintf(buf, "%-20s %-8s %-12s %-10s Level\n\r", "Command", "Type", "Who", "By who");
00158 send_to_char(buf,ch);
00159 send_to_char("--------------------------------------------------------------\n\r",ch);
00160
00161 for (p = e_disabled_first;p;p = p->next)
00162 {
00163 found = TRUE;
00164 sprintf(buf, "%-20s %-8s %-12s %-10s %-3d\n\r", p->command->name, p->type, p->who,p->who_disabled, p->who_level);
00165 send_to_char(buf,ch);
00166 }
00167 if (!found)
00168 send_to_char("No enhanced disabled commands found.\n\r",ch);
00169 return;
00170 }
00171 if (!str_prefix(arg, "clan") || !str_prefix(arg, "kingdom")
00172 || !str_prefix(arg, "race") || !str_prefix(arg, "character"))
00173 {
00174 multi=TRUE;/* do -NOTHING- ;) */
00175 }
00176 else
00177 argument = arg1;
00178
00179
00180 if (!str_prefix(arg, "all"))
00181 type = str_dup("ALL");
00182 if (!str_prefix(arg, "clan"))
00183 type = str_dup("CLAN");
00184 if (!str_prefix(arg, "kingdom"))
00185 type = str_dup("KINGDOM");
00186 if (!str_prefix(arg, "race"))
00187 type = str_dup("RACE");
00188 if (!str_prefix(arg, "character"))
00189 type = str_dup("CHARACTER");
00190
00191 for (p = e_disabled_first; p != NULL; p = p->next)
00192 {
00193
00194
00195 if (!str_prefix(arg, "all") && !str_cmp(p->type, "all") && !str_cmp(arg1, p->command->name))
00196 {
00197 send_to_char("Command enabled.\n\r",ch);
00198 destroy_disable_thread(p);
00199 return;
00200 }
00201
00202 if (!str_prefix(arg, "clan") && !str_cmp(p->type, "clan")
00203 && !str_cmp(clan_table[clan_lookup(arg1)].name, p->who)
00204 && !str_cmp(argument, p->command->name))
00205 {
00206 send_to_char("Command enabled.\n\r",ch);
00207 destroy_disable_thread(p);
00208 return;
00209 }
00210 if (!str_prefix(arg, "kingdom") && !str_cmp(p->type, "kingdom")
00211 && !str_cmp(kingdom_table[kingdom_lookup(arg1)].name, p->who)
00212 && !str_cmp(argument, p->command->name))
00213 {
00214 send_to_char("Command enabled.\n\r",ch);
00215 destroy_disable_thread(p);
00216 return;
00217 }
00218 if (!str_prefix(arg, "race") && !str_cmp(p->type, "race")
00219 && !str_cmp(race_table[race_lookup(arg1)].name, p->who)
00220 && !str_cmp(argument, p->command->name))
00221 {
00222 send_to_char("Command enabled.\n\r",ch);
00223 destroy_disable_thread(p);
00224 return;
00225 }
00226 if (!str_prefix(arg, "character") && !str_cmp(p->type, "character")
00227 && !str_cmp(arg1, p->who) && !str_cmp(argument, p->command->name))
00228 {
00229 send_to_char("Command enabled.\n\r",ch);
00230 destroy_disable_thread(p);
00231 return;
00232 }
00233
00234 }
00235
00236
00237 for (runner = 0;cmd_table[runner].name[0] != '\0';runner++)
00238 if (!str_cmp(cmd_table[runner].name, argument))
00239 break;
00240
00241 if (cmd_table[runner].name[0] == '\0')
00242 {
00243 send_to_char("No such command found.\n\r",ch);
00244 return;
00245 }
00246
00247 if (!str_prefix(arg, "clan"))
00248 {
00249 if (arg1[0] == '\0' || argument[0] == '\0')
00250 do_enhanced_disable(ch, "");
00251 if (!clan_lookup(arg1))
00252 {
00253 send_to_char("No such clan exists.\n\r",ch);
00254 return;
00255 }
00256 q = create_disable_thread(ch, type, runner, str_dup(clan_table[clan_lookup(arg1)].name));
00257
00258 }
00259 else if (!str_prefix(arg, "kingdom"))
00260 {
00261 if (arg1[0] == '\0' || argument[0] == '\0')
00262 do_enhanced_disable(ch, "");
00263 if (!kingdom_lookup(arg1))
00264 {
00265 send_to_char("No such kingdom exists.\n\r",ch);
00266 return;
00267 }
00268 q = create_disable_thread(ch,type,runner,str_dup(kingdom_table[kingdom_lookup(arg1)].name));
00269
00270 }
00271 else if (!str_prefix(arg, "character"))
00272 {
00273 if (arg1[0] == '\0' || argument[0] == '\0')
00274 do_enhanced_disable(ch, "");
00275 if ((victim = get_char_world(ch, arg1)) == NULL)
00276 {
00277 send_to_char("That person is not playing at the moment.\n\r",ch);
00278 return;
00279 }
00280 q=create_disable_thread(ch,type,runner,str_dup (victim->name));
00281
00282 }
00283 else if (!str_prefix(arg, "race"))
00284 {
00285 if (arg1[0] == '\0' || argument[0] == '\0')
00286 do_enhanced_disable(ch, "");
00287 if (!race_lookup(arg1))
00288 {
00289 send_to_char("No such race exists.\n\r",ch);
00290 return;
00291 }
00292
00293 q=create_disable_thread(ch,type,runner,str_dup(race_table[race_lookup(arg1)].name));
00294 }
00295 else if (!str_prefix(arg, "all"))
00296 {
00297 q=create_disable_thread(ch, type, runner,str_dup("None"));
00298 }
00299 else
00300 do_enhanced_disable(ch, "");
00301
00302 sprintf(buf, "Command %s disabled for %s\n\r", q->command->name, q->type);
00303
00304
00305 send_to_char(buf,ch);
00306 }
|
Here is the call graph for this function:

|
|
Definition at line 43 of file enhanced_disable.c. References alloc_mem(), bug(), cmd_table, e_disabled_data::command, E_DISABLED_FILE, e_disabled_first, fread_number(), fread_word(), e_disabled_data::next, str_cmp(), str_dup(), twiddle(), e_disabled_data::type, e_disabled_data::who, e_disabled_data::who_disabled, and e_disabled_data::who_level. Referenced by boot_db(). 00044 {
00045 EDISABLED_DATA *pDisabled;
00046 FILE *fp;
00047 char *command;
00048 int runner;
00049
00050 e_disabled_first = NULL;
00051
00052
00053 if ((fp = fopen(E_DISABLED_FILE, "r")) == NULL)
00054 {
00055 bug("Unable to open enhanced disabled file for reading.",0);
00056 return;
00057 }
00058
00059 command = fread_word(fp);
00060
00061 while (str_cmp(command, "#END"))
00062 {
00063 twiddle();
00064 for (runner=0;cmd_table[runner].name[0];runner++)
00065 if (!str_cmp(cmd_table[runner].name, command))
00066 break;
00067
00068 if (!cmd_table[runner].name[0])
00069 {
00070 bug("load_enhanced_disabled: Unknown command, skipping",0);
00071 fread_word(fp);
00072 fread_word(fp);
00073 fread_word(fp);
00074 fread_number(fp);
00075 }
00076 else
00077 {
00078 pDisabled = alloc_mem(sizeof(EDISABLED_DATA));
00079 pDisabled->command = &cmd_table[runner];
00080 pDisabled->type = str_dup(fread_word(fp));
00081 pDisabled->who_disabled = str_dup(fread_word(fp));
00082 pDisabled->who = str_dup(fread_word(fp));
00083 pDisabled->who_level = fread_number(fp);
00084 pDisabled->next = e_disabled_first;
00085 e_disabled_first = pDisabled;
00086
00087 }
00088 command = fread_word(fp);
00089 }
00090 fclose(fp);
00091 }
|
Here is the call graph for this function:

|
|
Definition at line 18 of file enhanced_disable.c. References bug(), e_disabled_data::command, E_DISABLED_FILE, e_disabled_first, MAX_STRING_LENGTH, cmd_type::name, e_disabled_data::next, e_disabled_data::type, e_disabled_data::who, e_disabled_data::who_disabled, and e_disabled_data::who_level. Referenced by create_disable_thread(), and destroy_disable_thread(). 00019 {
00020 EDISABLED_DATA *pDisabled;
00021 FILE *fp;
00022 char buf[MAX_STRING_LENGTH];
00023
00024
00025 if ((fp = fopen(E_DISABLED_FILE, "w")) == NULL)
00026 {
00027 bug("Unable to open enhanced disable file for writing.",0);
00028 return;
00029 }
00030
00031 for (pDisabled = e_disabled_first; pDisabled != NULL; pDisabled = pDisabled->next)
00032 {
00033 sprintf(buf, "%s %s %s %s %d\n", pDisabled->command->name, pDisabled->type, pDisabled->who_disabled,
00034 pDisabled->who, pDisabled->who_level);
00035 fprintf(fp, buf);
00036 }
00037 fprintf(fp, "#END\n");
00038 fclose(fp);
00039 return;
00040
00041 }
|
Here is the call graph for this function:

|
|
Definition at line 16 of file enhanced_disable.c. Referenced by check_enhanced_disabled(), create_disable_thread(), destroy_disable_thread(), do_enhanced_disable(), load_enhanced_disable(), and save_enhanced_disabled(). |
1.4.0