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

Go to the source code of this file.
Defines | |
| #define | MPEDIT(fun) bool fun(CHAR_DATA *ch, char*argument) |
Functions | |
| void | do_mpedit (CHAR_DATA *ch, char *argument) |
| MPEDIT (mpedit_list) | |
| MPEDIT (mpedit_code) | |
| MPEDIT (mpedit_show) | |
| MPEDIT (mpedit_create) | |
| void | mpedit (CHAR_DATA *ch, char *argument) |
Variables | |
| const struct olc_cmd_type | mpedit_table [] |
|
|
Definition at line 19 of file olc_mpcode.c. |
|
||||||||||||
|
Definition at line 96 of file olc_mpcode.c. References ED_MPCODE, get_mprog_index(), get_vnum_area(), IS_BUILDER, is_number(), MAX_INPUT_LENGTH, one_argument(), send_to_char(), and str_cmp(). 00097 {
00098 MPROG_CODE *pMcode;
00099 char command[MAX_INPUT_LENGTH];
00100
00101 argument = one_argument (argument, command);
00102
00103 if (is_number (command))
00104 {
00105 int vnum = atoi (command);
00106 AREA_DATA *ad;
00107
00108 if ((pMcode = get_mprog_index (vnum)) == NULL)
00109 {
00110 send_to_char ("MPEdit : That vnum does not exist.\n\r", ch);
00111 return;
00112 }
00113
00114 ad = get_vnum_area (vnum);
00115
00116 if (ad == NULL)
00117 {
00118 send_to_char ("MPEdit : VNUM no asignado a ningun area.\n\r", ch);
00119 return;
00120 }
00121
00122 if (!IS_BUILDER (ch, ad))
00123 {
00124 send_to_char
00125 ("MPEdit : Insuficiente seguridad para editar area.\n\r", ch);
00126 return;
00127 }
00128
00129 ch->desc->pEdit = (void *) pMcode;
00130 ch->desc->editor = ED_MPCODE;
00131
00132 return;
00133 }
00134
00135 if (!str_cmp (command, "create"))
00136 {
00137 if (argument[0] == '\0')
00138 {
00139 send_to_char ("Sintaxis : mpedit create [vnum]\n\r", ch);
00140 return;
00141 }
00142
00143 mpedit_create (ch, argument);
00144 return;
00145 }
00146
00147 send_to_char ("Sintaxis : mpedit [vnum]\n\r", ch);
00148 send_to_char (" mpedit create [vnum]\n\r", ch);
00149
00150 return;
00151 }
|
Here is the call graph for this function:

|
|
Definition at line 228 of file olc_mpcode.c. References add_buf(), buf_string(), ENTRE, FALSE, free_buf(), get_vnum_area(), IS_BUILDER, MAX_STRING_LENGTH, new_buf(), mprog_code::next, page_to_char(), str_cmp(), and mprog_code::vnum. 00229 {
00230 int count = 1;
00231 MPROG_CODE *mprg;
00232 char buf[MAX_STRING_LENGTH];
00233 BUFFER *buffer;
00234 bool fAll = !str_cmp (argument, "all");
00235 char blah;
00236 AREA_DATA *ad;
00237
00238 buffer = new_buf ();
00239
00240 for (mprg = mprog_list; mprg != NULL; mprg = mprg->next)
00241 if (fAll
00242 || ENTRE (ch->in_room->area->min_vnum, mprg->vnum,
00243 ch->in_room->area->max_vnum))
00244 {
00245 ad = get_vnum_area (mprg->vnum);
00246
00247 if (ad == NULL)
00248 blah = '?';
00249 else if (IS_BUILDER (ch, ad))
00250 blah = '*';
00251 else
00252 blah = ' ';
00253
00254 sprintf (buf, "[%3d] (%c) %5d\n\r", count, blah, mprg->vnum);
00255 add_buf (buffer, buf);
00256
00257 count++;
00258 }
00259
00260 if (count == 1)
00261 {
00262 if (fAll)
00263 add_buf (buffer, "MobPrograms do not exist!\n\r");
00264 else
00265 add_buf (buffer, "MobPrograms do not exist in this area.\n\r");
00266 }
00267
00268 page_to_char (buf_string (buffer), ch);
00269 free_buf (buffer);
00270
00271 return FALSE;
00272 }
|
Here is the call graph for this function:

|
|
Definition at line 213 of file olc_mpcode.c. References mprog_code::code, EDIT_MPCODE, FALSE, send_to_char(), string_append(), and TRUE. 00214 {
00215 MPROG_CODE *pMcode;
00216 EDIT_MPCODE (ch, pMcode);
00217
00218 if (argument[0] == '\0')
00219 {
00220 string_append (ch, &pMcode->code);
00221 return TRUE;
00222 }
00223
00224 send_to_char ("Syntax: code\n\r", ch);
00225 return FALSE;
00226 }
|
Here is the call graph for this function:

|
|
Definition at line 198 of file olc_mpcode.c. References mprog_code::code, EDIT_MPCODE, FALSE, MAX_STRING_LENGTH, send_to_char(), and mprog_code::vnum. 00199 {
00200 MPROG_CODE *pMcode;
00201 char buf[MAX_STRING_LENGTH];
00202
00203 EDIT_MPCODE (ch, pMcode);
00204
00205 sprintf (buf,
00206 "Vnum: [%d]\n\r"
00207 "Code:\n\r%s\n\r", pMcode->vnum, pMcode->code);
00208 send_to_char (buf, ch);
00209
00210 return FALSE;
00211 }
|
Here is the call graph for this function:

|
|
Definition at line 153 of file olc_mpcode.c. References ED_MPCODE, FALSE, get_mprog_index(), get_vnum_area(), IS_BUILDER, IS_NULLSTR, new_mpcode(), mprog_code::next, send_to_char(), TRUE, and mprog_code::vnum. 00154 {
00155 MPROG_CODE *pMcode;
00156 int value = atoi (argument);
00157 AREA_DATA *ad;
00158
00159 if (IS_NULLSTR (argument) || value < 1)
00160 {
00161 send_to_char ("Sintaxis : mpedit create [vnum]\n\r", ch);
00162 return FALSE;
00163 }
00164
00165 ad = get_vnum_area (value);
00166
00167 if (ad == NULL)
00168 {
00169 send_to_char ("MPEdit : VNUM no asignado a ningun area.\n\r", ch);
00170 return FALSE;
00171 }
00172
00173 if (!IS_BUILDER (ch, ad))
00174 {
00175 send_to_char
00176 ("MPEdit : Insuficiente seguridad para crear MobProgs.\n\r", ch);
00177 return FALSE;
00178 }
00179
00180 if (get_mprog_index (value))
00181 {
00182 send_to_char ("MPEdit: Code vnum already exists.\n\r", ch);
00183 return FALSE;
00184 }
00185
00186 pMcode = new_mpcode ();
00187 pMcode->vnum = value;
00188 pMcode->next = mprog_list;
00189 mprog_list = pMcode;
00190 ch->desc->pEdit = (void *) pMcode;
00191 ch->desc->editor = ED_MPCODE;
00192
00193 send_to_char ("MobProgram Code Created.\n\r", ch);
00194
00195 return TRUE;
00196 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 35 of file olc_mpcode.c. References AREA_CHANGED, area_data::area_flags, edit_done(), EDIT_MPCODE, get_vnum_area(), interpret(), IS_BUILDER, MAX_INPUT_LENGTH, mpedit_table, one_argument(), send_to_char(), SET_BIT, smash_tilde(), str_cmp(), str_prefix(), and mprog_code::vnum. Referenced by run_olc_editor(). 00036 {
00037 MPROG_CODE *pMcode;
00038 char arg[MAX_INPUT_LENGTH];
00039 char command[MAX_INPUT_LENGTH];
00040 int cmd;
00041 AREA_DATA *ad;
00042
00043 smash_tilde (argument);
00044 strcpy (arg, argument);
00045 argument = one_argument (argument, command);
00046
00047 EDIT_MPCODE (ch, pMcode);
00048
00049 if (pMcode)
00050 {
00051 ad = get_vnum_area (pMcode->vnum);
00052
00053 if (ad == NULL)
00054 { /* ??? */
00055 edit_done (ch);
00056 return;
00057 }
00058
00059 if (!IS_BUILDER (ch, ad))
00060 {
00061 send_to_char ("MPEdit: Insufficient security to modify code.\n\r",
00062 ch);
00063 edit_done (ch);
00064 return;
00065 }
00066 }
00067
00068 if (command[0] == '\0')
00069 {
00070 mpedit_show (ch, argument);
00071 return;
00072 }
00073
00074 if (!str_cmp (command, "done"))
00075 {
00076 edit_done (ch);
00077 return;
00078 }
00079
00080 for (cmd = 0; mpedit_table[cmd].name != NULL; cmd++)
00081 {
00082 if (!str_prefix (command, mpedit_table[cmd].name))
00083 {
00084 if ((*mpedit_table[cmd].olc_fun) (ch, argument) && pMcode)
00085 if ((ad = get_vnum_area (pMcode->vnum)) != NULL)
00086 SET_BIT (ad->area_flags, AREA_CHANGED);
00087 return;
00088 }
00089 }
00090
00091 interpret (ch, arg);
00092
00093 return;
00094 }
|
Here is the call graph for this function:

|
|
Initial value: {
{"commands", show_commands},
{"create", mpedit_create},
{"code", mpedit_code},
{"show", mpedit_show},
{"list", mpedit_list},
{"?", show_help},
{NULL, 0}
}
Definition at line 22 of file olc_mpcode.c. Referenced by mpedit(), and show_commands(). |
1.4.0