#include "copyright.h"
#include "config.h"
#include "db.h"
#include "externs.h"
#include "mech.h"
#include "macros.h"
#include "p.glue.h"
Include dependency graph for glue.hcode.c:
Go to the source code of this file.
Functions | |
void | set_attr_internal (dbref player, dbref thing, int attrnum, char *attrtext, int key) |
int | bt_get_attr (char *tbuf, int obj, char *name) |
char * | silly_atr_get (int id, int flag) |
void | silly_atr_set (int id, int flag, char *dat) |
void | bt_set_attr (dbref obj, char *attri, char *value) |
void | KillText (char **mapt) |
void | ShowText (char **mapt, dbref player) |
int | BOUNDED (int min, int val, int max) |
float | FBOUNDED (float min, float val, float max) |
int | MAX (int v1, int v2) |
int | MIN (int v1, int v2) |
char * | first_parseattribute (char *buffer) |
int | proper_parseattributes (char *buffer, char **args, int max) |
int | silly_parseattributes (char *buffer, char **args, int max) |
int | proper_explodearguments (char *buffer, char **args, int max) |
int | mech_parseattributes (char *buffer, char **args, int maxargs) |
int BOUNDED | ( | int | min, | |
int | val, | |||
int | max | |||
) |
Definition at line 89 of file glue.hcode.c.
00090 { 00091 if(val < min) 00092 return min; 00093 if(val > max) 00094 return max; 00095 return val; 00096 }
int bt_get_attr | ( | char * | tbuf, | |
int | obj, | |||
char * | name | |||
) |
Definition at line 29 of file glue.hcode.c.
References atr_get_str(), atr_str(), and attr::number.
00030 { 00031 ATTR *a; 00032 int ao, af; 00033 00034 if(!name) 00035 return 0; 00036 if(!(a = atr_str(name))) 00037 return 0; 00038 atr_get_str(tbuf, obj, a->number, &ao, &af); 00039 if(*tbuf) 00040 return 1; 00041 return 0; 00042 }
void bt_set_attr | ( | dbref | obj, | |
char * | attri, | |||
char * | value | |||
) |
Definition at line 61 of file glue.hcode.c.
References atr_str(), GOD, mkattr(), attr::number, set_attr_internal(), and SET_QUIET.
00062 { 00063 int attr; 00064 00065 ATTR *atr; 00066 00067 atr = atr_str(attri); 00068 attr = atr ? atr->number : mkattr(attri); 00069 set_attr_internal(GOD, obj, attr, value, SET_QUIET); 00070 }
float FBOUNDED | ( | float | min, | |
float | val, | |||
float | max | |||
) |
Definition at line 98 of file glue.hcode.c.
Referenced by ai_set_speed().
00099 { 00100 if(val < min) 00101 return min; 00102 if(val > max) 00103 return max; 00104 return val; 00105 }
char* first_parseattribute | ( | char * | buffer | ) |
Definition at line 125 of file glue.hcode.c.
References SBUF_SIZE, and strndup().
Referenced by auto_addcommand().
00126 { 00127 00128 int length; 00129 char *start, *first; 00130 00131 /* Look for the first parameter */ 00132 start = buffer; 00133 length = strcspn(start, " \t="); 00134 00135 /* If the first parameter is to big set the size */ 00136 if(length > SBUF_SIZE) 00137 length = SBUF_SIZE; 00138 00139 /* Make it and return it */ 00140 first = (char *) strndup(start, length); 00141 00142 return first; 00143 00144 }
void KillText | ( | char ** | mapt | ) |
Definition at line 72 of file glue.hcode.c.
00073 { 00074 int i; 00075 00076 for(i = 0; mapt[i]; i++) 00077 free(mapt[i]); 00078 free(mapt); 00079 }
int MAX | ( | int | v1, | |
int | v2 | |||
) |
int mech_parseattributes | ( | char * | buffer, | |
char ** | args, | |||
int | maxargs | |||
) |
Definition at line 298 of file glue.hcode.c.
References strtok().
Referenced by add_entrances(), add_links(), addtic_sub(), aero_checklz(), aero_thrust(), aero_vheading(), cleartic_sub(), debug_list(), debug_makemechs(), debug_setvrt(), debug_setxplevel(), debug_shutdown(), deltic_sub(), FindBSuitTarget(), firetic_sub(), initiate_ood(), listtic_sub(), map_add_block(), map_add_mine(), map_addfire(), map_addhex(), map_addice(), map_addsmoke(), map_delice(), map_delobj(), map_listmechs(), map_loadmap(), map_pathfind(), map_savemap(), map_setconditions(), map_setmapsize(), map_view(), mech_attachcables(), mech_axe(), mech_bearing(), mech_bomb(), mech_bootlegger(), mech_c3_join_leave(), mech_c3i_join_leave(), mech_charge(), mech_club(), mech_contacts(), mech_createbays(), mech_critstatus(), mech_damage(), mech_detachcables(), mech_disableweap(), mech_dump(), mech_embark(), mech_enterbase(), mech_enterbay(), mech_eta(), mech_explode(), mech_fireweapon(), mech_grabclub(), mech_heading(), mech_hulldown(), mech_inarc_ammo_toggle(), mech_jump(), mech_kickortrip(), mech_lrsmap(), mech_mace(), mech_mechprefs(), mech_navigate(), mech_pickup(), mech_punch(), mech_rac(), mech_range(), mech_report(), mech_rotatetorso(), mech_Rsetmapindex(), mech_Rsetteam(), mech_Rsetxy(), mech_saw(), mech_scan(), mech_sensor(), mech_settarget(), mech_sight(), mech_snipe(), mech_speed(), mech_spot(), mech_sword(), mech_tacmap(), mech_tag(), mech_target(), mech_toggle_mode_sub(), mech_turret(), mech_unjamammo(), mech_usebin(), mech_vector(), mech_vertical(), mech_view(), mechrep_Raddspecial(), mechrep_Raddweap(), mechrep_Rdisplaysection(), mechrep_Rfiremode(), mechrep_Rloadnew(), mechrep_Rreload(), mechrep_Rrepair(), mechrep_Rsavetemp(), mechrep_Rsavetemp2(), mechrep_Rsetarmor(), mechrep_Rsetmove(), mechrep_Rsetradio(), mechrep_Rsettarget(), mechrep_Rsettype(), mechrep_setcargospace(), remove_inarc_pods_mech(), stuff_change_sub(), tech_parsegun(), and tech_parsepart_advanced().
00299 { 00300 int count = 0; 00301 char *parsed = buffer; 00302 int num_args = 0; 00303 00304 memset(args, 0, sizeof(char *) * maxargs); 00305 00306 while ((count < maxargs) && parsed) { 00307 parsed = strtok(!count ? buffer : NULL, " \t"); 00308 args[count] = parsed; /* Set the args pointer */ 00309 if(parsed) 00310 num_args++; /* Actual count of arguments */ 00311 count++; /* Loop to make sure we don't overrun our */ 00312 /* buffer */ 00313 } 00314 return num_args; 00315 }
int MIN | ( | int | v1, | |
int | v2 | |||
) |
int proper_explodearguments | ( | char * | buffer, | |
char ** | args, | |||
int | max | |||
) |
Definition at line 276 of file glue.hcode.c.
References strndup().
Referenced by auto_addcommand(), auto_command_autogun(), auto_command_roam(), auto_parse_command(), and mech_stand().
00277 { 00278 int count = 0, iterator = 0, length; 00279 char *start, *finish; 00280 00281 memset(args, 0, sizeof(char *) * max); 00282 00283 start = buffer; 00284 while (count < max - 1 && *start) { 00285 length = strcspn(start, " \t"); 00286 args[count++] = strndup(start, length); 00287 start += length; 00288 if(*start != '\x0') 00289 start++; 00290 } 00291 if(*start) { 00292 args[max - 1] = strdup(start); 00293 count++; 00294 } 00295 return count; 00296 }
int proper_parseattributes | ( | char * | buffer, | |
char ** | args, | |||
int | max | |||
) |
Definition at line 175 of file glue.hcode.c.
References strndup().
Referenced by mech_radio(), and mech_sendchannel().
00176 { 00177 int count = 0, iterator = 0, length; 00178 char *start, *finish; 00179 00180 memset(args, 0, sizeof(char *) * max); 00181 00182 start = buffer; 00183 while (count < (max - 1) && *start) { 00184 if(*start == '=') { 00185 args[count++] = strndup(start, 1); 00186 start++; 00187 continue; 00188 } 00189 length = strcspn(start, " \t="); 00190 args[count++] = strndup(start, length); 00191 start += length; 00192 if(*start != '=' && *start != '\x0') 00193 start++; 00194 } 00195 if(*start) { 00196 args[max - 1] = strdup(start); 00197 count++; 00198 } 00199 return count; 00200 }
Definition at line 675 of file set.c.
References atr_add(), atr_num(), atr_pget_info(), attr, attr::check, handle_ears(), handle_xcode(), Hardcode, confdata::have_specials, Hearer(), mudconf, Name(), attr::name, notify_printf(), notify_quiet, Owner, Quiet, Set_attr, and SET_QUIET.
00677 { 00678 dbref aowner; 00679 int aflags, could_hear, have_xcode; 00680 ATTR *attr; 00681 00682 attr = atr_num(attrnum); 00683 atr_pget_info(thing, attrnum, &aowner, &aflags); 00684 if(attr && Set_attr(player, thing, attr, aflags)) { 00685 if((attr->check != NULL) && 00686 (!(*attr->check) (0, player, thing, attrnum, attrtext))) 00687 return; 00688 have_xcode = Hardcode(thing); 00689 atr_add(thing, attrnum, attrtext, Owner(player), aflags); 00690 if(mudconf.have_specials) 00691 handle_xcode(player, thing, have_xcode, Hardcode(thing)); 00692 if(!(key & SET_QUIET) && !Quiet(player) && !Quiet(thing)) 00693 notify_printf(player, "%s/%s - %s", Name(thing), 00694 attr->name, strlen(attrtext) ? "Set." : "Cleared."); 00695 could_hear = Hearer(thing); 00696 handle_ears(thing, could_hear, Hearer(thing)); 00697 } else { 00698 notify_quiet(player, "Permission denied."); 00699 } 00700 }
void ShowText | ( | char ** | mapt, | |
dbref | player | |||
) |
Definition at line 81 of file glue.hcode.c.
References notify.
00082 { 00083 int i; 00084 00085 for(i = 0; mapt[i]; i++) 00086 notify(player, mapt[i]); 00087 }
char* silly_atr_get | ( | int | id, | |
int | flag | |||
) |
Definition at line 44 of file glue.hcode.c.
References atr_get_str(), atr_pget(), and LBUF_SIZE.
00045 { 00046 int i, j; 00047 static char buf[LBUF_SIZE]; 00048 00049 atr_get_str(buf, id, flag, &i, &j); 00050 return buf; 00051 #if 0 /* This would waste memory, so.. :P */ 00052 return atr_pget(id, flag, &i, &j); 00053 #endif 00054 }
void silly_atr_set | ( | int | id, | |
int | flag, | |||
char * | dat | |||
) |
Definition at line 56 of file glue.hcode.c.
References atr_add_raw().
00057 { 00058 atr_add_raw(id, flag, dat); 00059 }
int silly_parseattributes | ( | char * | buffer, | |
char ** | args, | |||
int | max | |||
) |
Definition at line 202 of file glue.hcode.c.
References LBUF_SIZE, and strtok().
Referenced by set_xcodestuff().
00203 { 00204 char bufferi[LBUF_SIZE], foobuff[LBUF_SIZE]; 00205 char *a, *b; 00206 int count = 0; 00207 char *parsed = buffer; 00208 int num_args = 0; 00209 00210 memset(args, 0, sizeof(char *) * max); 00211 00212 b = bufferi; 00213 for(a = buffer; *a && a; a++) 00214 if(*a == '=') { 00215 *(b++) = ' '; 00216 *(b++) = '='; 00217 *(b++) = ' '; 00218 } else 00219 *(b++) = *a; 00220 *b = 0; 00221 /* Got da silly string in bufferi variable */ 00222 00223 while ((count < max) && parsed) { 00224 if(!count) { 00225 /* first time through */ 00226 parsed = strtok(bufferi, " \t"); 00227 } else { 00228 parsed = strtok(NULL, " \t"); 00229 } 00230 args[count] = parsed; /* Set the args pointer */ 00231 if(parsed) 00232 num_args++; /* Actual count of arguments */ 00233 count++; /* Loop to make sure we don't overrun our */ 00234 /* buffer */ 00235 } 00236 /* Hrm. Now all we gotta do is append -rest- of data to end of _last_ arg */ 00237 if(args[max - 1] && args[max - 1][0]) { 00238 strcpy(foobuff, args[max - 1]); 00239 while ((parsed = strtok(NULL, " \t"))) 00240 sprintf(foobuff + strlen(foobuff), " %s", parsed); 00241 args[max - 1] = foobuff; 00242 } 00243 return num_args; 00244 }