src/hcode/include/p.glue.scode.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

char * mechIDfunc (int mode, MECH *mech)
char * mechTypefunc (int mode, MECH *mech, char *arg)
char * mechMovefunc (int mode, MECH *mech, char *arg)
char * mechTechTimefunc (int mode, MECH *mech)
void apply_mechDamage (MECH *omech, char *buf)
char * mechDamagefunc (int mode, MECH *mech, char *arg)
char * mechCentBearingfunc (int mode, MECH *mech, char *arg)
char * mechCentDistfunc (int mode, MECH *mech, char *arg)
void fun_btsetxcodevalue (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
void fun_btgetxcodevalue (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
void set_xcodestuff (dbref player, void *data, char *buffer)
void list_xcodestuff (dbref player, void *data, char *buffer)
void fun_btunderrepair (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
void fun_btstores (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
void fun_btmapterr (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
void fun_btmapelev (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
void list_xcodevalues (dbref player)
void fun_btdesignex (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
void fun_btdamages (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
void fun_btcritstatus (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
void fun_btarmorstatus (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)


Function Documentation

void apply_mechDamage ( MECH omech,
char *  buf 
)

Definition at line 154 of file glue.scode.c.

References CLASS_MECH, DestroyPart, do_magic(), FullAmmo(), GetPartData, GetPartType, GetSectArmor, GetSectInt, GetSectOArmor, GetSectOInt, GetSectORArmor, GetSectRArmor, IsAmmo, IsCrap, mech_RepairPart(), MechType, NUM_CRITICALS, NUM_SECTIONS, PartIsDestroyed, PartTempNuke, SetPartData, SetPartTempNuke, SetSectArmor, SetSectInt, SetSectRArmor, and UnDestroyPart.

Referenced by mechDamagefunc().

00155 {
00156         MECH mek;
00157         MECH *mech = &mek;
00158         int i, j, i1, i2, i3;
00159         char *s;
00160         int do_mag = 0;
00161 
00162         memcpy(mech, omech, sizeof(MECH));
00163         for(i = 0; i < NUM_SECTIONS; i++) {
00164                 SetSectInt(mech, i, GetSectOInt(mech, i));
00165                 SetSectArmor(mech, i, GetSectOArmor(mech, i));
00166                 SetSectRArmor(mech, i, GetSectORArmor(mech, i));
00167                 for(j = 0; j < NUM_CRITICALS; j++)
00168                         if(GetPartType(mech, i, j) && !IsCrap(GetPartType(mech, i, j))) {
00169                                 if(PartIsDestroyed(mech, i, j))
00170                                         UnDestroyPart(mech, i, j);
00171                                 if(IsAmmo(GetPartType(mech, i, j)))
00172                                         SetPartData(mech, i, j, FullAmmo(mech, i, j));
00173                                 else
00174                                         SetPartTempNuke(mech, i, j, 0);
00175                         }
00176         }
00177         s = buf;
00178         while (*s) {
00179                 while (*s && (*s == ' ' || *s == ','))
00180                         s++;
00181                 if(!(*s))
00182                         break;
00183                 /* Parse the keyword ; it's one of the many known types */
00184                 if(sscanf(s, "A:%d/%d", &i1, &i2) == 2) {
00185                         /* Ordinary armor damage */
00186                         if(i1 >= 0 && i1 < NUM_SECTIONS)
00187                                 SetSectArmor(mech, i1, GetSectOArmor(mech, i1) - i2);
00188                 } else if(sscanf(s, "A(R):%d/%d", &i1, &i2) == 2) {
00189                         /* Ordinary rear armor damage */
00190                         if(i1 >= 0 && i1 < NUM_SECTIONS)
00191                                 SetSectRArmor(mech, i1, GetSectORArmor(mech, i1) - i2);
00192                 } else if(sscanf(s, "I:%d/%d", &i1, &i2) == 2) {
00193                         /* Ordinary int damage */
00194                         if(i1 >= 0 && i1 < NUM_SECTIONS)
00195                                 SetSectInt(mech, i1, GetSectOInt(mech, i1) - i2);
00196                 } else if(sscanf(s, "C:%d/%d", &i1, &i2) == 2) {
00197                         /* Dest'ed crit */
00198                         if(i1 >= 0 && i1 < NUM_SECTIONS)
00199                                 DestroyPart(mech, i1, i2);
00200                 } else if(sscanf(s, "G:%d/%d(%d)", &i1, &i2, &i3) == 3) {
00201                         /* Glitch */
00202                         if(i1 >= 0 && i1 < NUM_SECTIONS)
00203                                 if(i2 >= 0 && i2 < NUM_CRITICALS)
00204                                         SetPartTempNuke(mech, i1, i2, i3);
00205                 } else if(sscanf(s, "R:%d/%d(%d)", &i1, &i2, &i3) == 3) {
00206                         /* Reload */
00207                         if(i1 >= 0 && i1 < NUM_SECTIONS)
00208                                 if(i2 >= 0 && i2 < NUM_CRITICALS)
00209                                         SetPartData(mech, i1, i2, FullAmmo(mech, i1, i2) - i3);
00210                 }
00211                 while (*s && (*s != ' ' && *s != ','))
00212                         s++;
00213         }
00214         for(i = 0; i < NUM_SECTIONS; i++) {
00215                 if(GetSectInt(mech, i) != GetSectInt(omech, i))
00216                         SetSectInt(omech, i, GetSectInt(mech, i));
00217                 if(GetSectArmor(mech, i) != GetSectArmor(omech, i))
00218                         SetSectArmor(omech, i, GetSectArmor(mech, i));
00219                 if(GetSectRArmor(mech, i) != GetSectRArmor(omech, i))
00220                         SetSectRArmor(omech, i, GetSectRArmor(mech, i));
00221                 for(j = 0; j < NUM_CRITICALS; j++)
00222                         if(GetPartType(mech, i, j) && !IsCrap(GetPartType(mech, i, j))) {
00223                                 if(PartIsDestroyed(mech, i, j) &&
00224                                    !PartIsDestroyed(omech, i, j)) {
00225                                         /* Blast a part */
00226                                         DestroyPart(omech, i, j);
00227                                         do_mag = 1;
00228                                 } else if(!PartIsDestroyed(mech, i, j) &&
00229                                                   PartIsDestroyed(omech, i, j)) {
00230                                         mech_RepairPart(omech, i, j);
00231                                         SetPartTempNuke(omech, i, j, 0);
00232                                         do_mag = 1;
00233                                 }
00234                                 if(IsAmmo(GetPartType(mech, i, j))) {
00235                                         if(GetPartData(mech, i, j) != GetPartData(omech, i, j))
00236                                                 SetPartData(omech, i, j, GetPartData(mech, i, j));
00237                                 } else {
00238                                         if(PartTempNuke(mech, i, j) != PartTempNuke(omech, i, j))
00239                                                 SetPartTempNuke(omech, i, j,
00240                                                                                 PartTempNuke(mech, i, j));
00241 
00242                                 }
00243                         }
00244         }
00245         if(do_mag && MechType(omech) == CLASS_MECH)
00246                 do_magic(omech);
00247 }

void fun_btarmorstatus ( char *  buff,
char **  bufc,
dbref  player,
dbref  cause,
char *  fargs[],
int  nfargs,
char *  cargs[],
int  ncargs 
)

Definition at line 966 of file glue.scode.c.

References armorstatus_func(), Examinable, FindObjectsData(), FUNCHECK, IsMech, match_thing(), NOTHING, safe_tprintf_str(), and WizR.

00968 {
00969         /* fargs[0] = id of the mech
00970          * fargs[1] = location to show
00971          */
00972         dbref it;
00973         char *infostr;
00974         MECH *mech;
00975 
00976         FUNCHECK(!WizR(player), "#-1 PERMISSION DENIED");
00977         it = match_thing(player, fargs[0]);
00978         FUNCHECK(it == NOTHING || !Examinable(player, it), "#-1 NOT A MECH");
00979         FUNCHECK(!IsMech(it), "#-1 NOT A MECH");
00980         FUNCHECK(!(mech = FindObjectsData(it)), "#-1");
00981         infostr = armorstatus_func(mech, fargs[1]);     /* fargs[1] unguaranteed ! */
00982         safe_tprintf_str(buff, bufc, infostr ? infostr : "#-1 ERROR");
00983 }

void fun_btcritstatus ( char *  buff,
char **  bufc,
dbref  player,
dbref  cause,
char *  fargs[],
int  nfargs,
char *  cargs[],
int  ncargs 
)

Definition at line 947 of file glue.scode.c.

References critstatus_func(), Examinable, FindObjectsData(), FUNCHECK, IsMech, match_thing(), NOTHING, safe_tprintf_str(), and WizR.

00949 {
00950         /* fargs[0] = id of the mech
00951          * fargs[1] = location to show
00952          */
00953         dbref it;
00954         char *critstr;
00955         MECH *mech;
00956 
00957         FUNCHECK(!WizR(player), "#-1 PERMISSION DENIED");
00958         it = match_thing(player, fargs[0]);
00959         FUNCHECK(it == NOTHING || !Examinable(player, it), "#-1 NOT A MECH");
00960         FUNCHECK(!IsMech(it), "#-1 NOT A MECH");
00961         FUNCHECK(!(mech = FindObjectsData(it)), "#-1");
00962         critstr = critstatus_func(mech, fargs[1]);      /* fargs[1] unguaranteed ! */
00963         safe_tprintf_str(buff, bufc, critstr ? critstr : "#-1 ERROR");
00964 }

void fun_btdamages ( char *  buff,
char **  bufc,
dbref  player,
dbref  cause,
char *  fargs[],
int  nfargs,
char *  cargs[],
int  ncargs 
)

Definition at line 929 of file glue.scode.c.

References damages_func(), Examinable, FindObjectsData(), FUNCHECK, IsMech, match_thing(), NOTHING, safe_tprintf_str(), and WizR.

00931 {
00932         /* fargs[0] = id of the mech
00933          */
00934         dbref it;
00935         char *damstr;
00936         MECH *mech;
00937 
00938         FUNCHECK(!WizR(player), "#-1 PERMISSION DENIED");
00939         it = match_thing(player, fargs[0]);
00940         FUNCHECK(it == NOTHING || !Examinable(player, it), "#-1 NOT A MECH");
00941         FUNCHECK(!IsMech(it), "#-1 NOT A MECH");
00942         FUNCHECK(!(mech = FindObjectsData(it)), "#-1");
00943         damstr = damages_func(mech);
00944         safe_tprintf_str(buff, bufc, damstr ? damstr : "#-1 ERROR");
00945 }

void fun_btdesignex ( char *  buff,
char **  bufc,
dbref  player,
dbref  cause,
char *  fargs[],
int  nfargs,
char *  cargs[],
int  ncargs 
)

Definition at line 918 of file glue.scode.c.

References mechref_path(), and safe_tprintf_str().

00920 {
00921         char *id = fargs[0];
00922 
00923         if(mechref_path(id)) {
00924                 safe_tprintf_str(buff, bufc, "1");
00925         } else
00926                 safe_tprintf_str(buff, bufc, "0");
00927 }

void fun_btgetxcodevalue ( char *  buff,
char **  bufc,
dbref  player,
dbref  cause,
char *  fargs[],
int  nfargs,
char *  cargs[],
int  ncargs 
)

Definition at line 630 of file glue.scode.c.

References Examinable, FindObjectsData(), FUNCHECK, match_thing(), name, GMV::name, NOTHING, RetrieveValue(), safe_tprintf_str(), scode_in_out, WhichSpecial(), WizR, and xcode_data.

00632 {
00633         /* fargs[0] = id of the mech
00634            fargs[1] = name of the value
00635          */
00636         dbref it;
00637         int i;
00638         void *foo;
00639         int spec;
00640 
00641         it = match_thing(player, fargs[0]);
00642         FUNCHECK(it == NOTHING || !Examinable(player, it), "#-1");
00643         spec = WhichSpecial(it);
00644         FUNCHECK(!(foo = FindObjectsData(it)), "#-1");
00645         FUNCHECK(!WizR(player), "#-1 PERMISSION DENIED");
00646         for(i = 0; xcode_data[i].name; i++)
00647                 if(!strcasecmp(fargs[1], xcode_data[i].name) &&
00648                    xcode_data[i].gtype == spec &&
00649                    (scode_in_out[xcode_data[i].type] & 1)) {
00650                         safe_tprintf_str(buff, bufc, "%s", RetrieveValue(foo, i));
00651                         return;
00652                 }
00653         safe_tprintf_str(buff, bufc, "#-1");
00654         return;
00655 }

void fun_btmapelev ( char *  buff,
char **  bufc,
dbref  player,
dbref  cause,
char *  fargs[],
int  nfargs,
char *  cargs[],
int  ncargs 
)

Definition at line 877 of file glue.scode.c.

References Elevation, Examinable, FindObjectsData(), FUNCHECK, GTYPE_MAP, MAP::map_height, MAP::map_width, match_thing(), NOTHING, Readnum, safe_tprintf_str(), WhichSpecial(), x, and y.

00879 {
00880         /* fargs[0] = reference of map
00881            fargs[1] = x
00882            fargs[2] = y
00883          */
00884         dbref it;
00885         int i;
00886         MAP *map;
00887         int x, y;
00888         int spec;
00889 
00890         it = match_thing(player, fargs[0]);
00891         FUNCHECK(it == NOTHING || !Examinable(player, it), "#-1");
00892         spec = WhichSpecial(it);
00893         FUNCHECK(spec != GTYPE_MAP, "#-1");
00894         FUNCHECK(!(map = FindObjectsData(it)), "#-1");
00895         FUNCHECK(Readnum(x, fargs[1]), "#-2");
00896         FUNCHECK(Readnum(y, fargs[2]), "#-2");
00897         FUNCHECK(x < 0 || y < 0 || x >= map->map_width
00898                          || y >= map->map_height, "?");
00899         i = Elevation(map, x, y);
00900         if(i < 0)
00901                 safe_tprintf_str(buff, bufc, "-%c", '0' + -i);
00902         else
00903                 safe_tprintf_str(buff, bufc, "%c", '0' + i);
00904 }

void fun_btmapterr ( char *  buff,
char **  bufc,
dbref  player,
dbref  cause,
char *  fargs[],
int  nfargs,
char *  cargs[],
int  ncargs 
)

Definition at line 848 of file glue.scode.c.

References Examinable, FindObjectsData(), FUNCHECK, GetTerrain, GRASSLAND, GTYPE_MAP, MAP::map_height, MAP::map_width, match_thing(), NOTHING, Readnum, safe_tprintf_str(), WhichSpecial(), x, and y.

00850 {
00851         /* fargs[0] = reference of map
00852            fargs[1] = x
00853            fargs[2] = y
00854          */
00855         dbref it;
00856         MAP *map;
00857         int x, y;
00858         int spec;
00859         char terr;
00860 
00861         it = match_thing(player, fargs[0]);
00862         FUNCHECK(it == NOTHING || !Examinable(player, it), "#-1");
00863         spec = WhichSpecial(it);
00864         FUNCHECK(spec != GTYPE_MAP, "#-1");
00865         FUNCHECK(!(map = FindObjectsData(it)), "#-1");
00866         FUNCHECK(Readnum(x, fargs[1]), "#-2");
00867         FUNCHECK(Readnum(y, fargs[2]), "#-2");
00868         FUNCHECK(x < 0 || y < 0 || x >= map->map_width ||
00869                          y >= map->map_height, "?");
00870         terr = GetTerrain(map, x, y);
00871         if(terr == GRASSLAND)
00872                 terr = '.';
00873 
00874         safe_tprintf_str(buff, bufc, "%c", terr);
00875 }

void fun_btsetxcodevalue ( char *  buff,
char **  bufc,
dbref  player,
dbref  cause,
char *  fargs[],
int  nfargs,
char *  cargs[],
int  ncargs 
)

Definition at line 523 of file glue.scode.c.

References Examinable, FindObjectsData(), FUNCHECK, match_thing(), name, GMV::name, NOTHING, safe_tprintf_str(), scode_in_out, GMV::size, text2bv(), TYPE_BV, TYPE_CBV, TYPE_CHAR, TYPE_DBREF, TYPE_FLOAT, TYPE_INT, TYPE_SHORT, TYPE_STRFUNC_BD, TYPE_STRFUNC_S, TYPE_STRING, WhichSpecial(), WizR, and xcode_data.

00525 {
00526         /* fargs[0] = id of the mech
00527            fargs[1] = name of the value
00528            fargs[2] = what the value's to be set as
00529          */
00530         dbref it;
00531         int i, spec;
00532         void *foo;
00533         void *bar;
00534         void *(*tempfun) ();
00535 
00536         it = match_thing(player, fargs[0]);
00537         FUNCHECK(it == NOTHING || !Examinable(player, it), "#-1");
00538         spec = WhichSpecial(it);
00539         FUNCHECK(!(foo = FindObjectsData(it)), "#-1");
00540         FUNCHECK(!WizR(player), "#-1 PERMISSION DENIED");
00541         for(i = 0; xcode_data[i].name; i++)
00542                 if(!strcasecmp(fargs[1], xcode_data[i].name) &&
00543                    xcode_data[i].gtype == spec &&
00544                    (scode_in_out[xcode_data[i].type] & 2)) {
00545                         bar = (void *) ((int) foo + xcode_data[i].rel_addr);
00546                         switch (xcode_data[i].type) {
00547                         case TYPE_STRFUNC_BD:
00548                         case TYPE_STRFUNC_S:
00549                                 tempfun = (void *) xcode_data[i].rel_addr;
00550                                 tempfun(1, (MECH *) foo, (char *) fargs[2]);
00551                                 break;
00552                         case TYPE_STRING:
00553                                 strncpy((char *) bar, fargs[2], xcode_data[i].size - 1);
00554                                 ((char *) bar)[xcode_data[i].size - 1] = '\0';
00555                                 break;
00556                         case TYPE_DBREF:
00557                                 *((dbref *) bar) = atoi(fargs[2]);
00558                                 break;
00559                         case TYPE_CHAR:
00560                                 *((char *) bar) = atoi(fargs[2]);
00561                                 break;
00562                         case TYPE_SHORT:
00563                                 *((short *) bar) = atoi(fargs[2]);
00564                                 break;
00565                         case TYPE_INT:
00566                                 *((int *) bar) = atoi(fargs[2]);
00567                                 break;
00568                         case TYPE_FLOAT:
00569                                 *((float *) bar) = atof(fargs[2]);
00570                                 break;
00571                         case TYPE_BV:
00572                                 *((int *) bar) = text2bv(fargs[2]);
00573                                 break;
00574                         case TYPE_CBV:
00575                                 *((byte *) bar) = (byte) text2bv(fargs[2]);
00576                                 break;
00577                         }
00578                         safe_tprintf_str(buff, bufc, "1");
00579                         return;
00580                 }
00581         safe_tprintf_str(buff, bufc, "#-1");
00582         return;
00583 }

void fun_btstores ( char *  buff,
char **  bufc,
dbref  player,
dbref  cause,
char *  fargs[],
int  nfargs,
char *  cargs[],
int  ncargs 
)

Definition at line 802 of file glue.scode.c.

References A_ECONPARTS, BRANDCOUNT, econ_find_items(), find_matching_long_part(), find_matching_vlong_part(), FUNCHECK, Good_obj, match_thing(), NUM_ITEMS, object_count, part_name_long(), safe_str, safe_tprintf_str(), short_sorted, silly_atr_get(), UNPACK_PART, WizR, and x.

00804 {
00805         /* fargs[0] = id of the bay/mech */
00806         /* fargs[1] = (optional) name of the part */
00807         dbref it;
00808         int i = -1, x = 0;
00809         int p, b;
00810         int pile[BRANDCOUNT + 1][NUM_ITEMS];
00811         char *t;
00812 
00813         FUNCHECK(!WizR(player), "#-1 PERMISSION DENIED");
00814         FUNCHECK(nfargs < 1 || nfargs > 2,
00815                          "#-1 FUNCTION (BTSTORES) EXPECTS 1 OR 2 ARGUMENTS");
00816         it = match_thing(player, fargs[0]);
00817         FUNCHECK(!Good_obj(it), "#-1 INVALID TARGET");
00818         if(nfargs > 1) {
00819                 i = -1;
00820                 if(!find_matching_long_part(fargs[1], &i, &p, &b)) {
00821                         i = -1;
00822                         FUNCHECK(!find_matching_vlong_part(fargs[1], &i, &p, &b),
00823                                          "#-1 INVALID PART NAME");
00824                 }
00825                 safe_tprintf_str(buff, bufc, "%d", econ_find_items(it, p, b));
00826         } else {
00827                 memset(pile, 0, sizeof(pile));
00828                 t = silly_atr_get(it, A_ECONPARTS);
00829                 while (*t) {
00830                         if(*t == '[')
00831                                 if((sscanf(t, "[%d,%d,%d]", &i, &p, &b)) == 3)
00832                                         pile[p][i] += b;
00833                         t++;
00834                 }
00835                 for(i = 0; i < object_count; i++) {
00836                         UNPACK_PART(short_sorted[i]->index, p, b);
00837                         if(pile[b][p]) {
00838                                 if(x)
00839                                         safe_str("|", buff, bufc);
00840                                 x = pile[b][p];
00841                                 safe_tprintf_str(buff, bufc, "%s:%d",
00842                                                                  part_name_long(p, b), x);
00843                         }
00844                 }
00845         }
00846 }

void fun_btunderrepair ( char *  buff,
char **  bufc,
dbref  player,
dbref  cause,
char *  fargs[],
int  nfargs,
char *  cargs[],
int  ncargs 
)

Definition at line 786 of file glue.scode.c.

References Examinable, figure_latest_tech_event(), FindObjectsData(), FUNCHECK, IsMech, match_thing(), NOTHING, and safe_tprintf_str().

00788 {
00789         /* fargs[0] = ref of the mech to be checked */
00790         int n;
00791         MECH *mech;
00792         dbref it;
00793 
00794         it = match_thing(player, fargs[0]);
00795         FUNCHECK(it == NOTHING || !Examinable(player, it), "#-1");
00796         FUNCHECK(!IsMech(it), "#-2");
00797         mech = FindObjectsData(it);
00798         n = figure_latest_tech_event(mech);
00799         safe_tprintf_str(buff, bufc, "%d", n > 0);
00800 }

void list_xcodestuff ( dbref  player,
void *  data,
char *  buffer 
)

Definition at line 741 of file glue.scode.c.

References addline, c, cent, CM_FOUR, CM_ONE, CM_TWO, DOCHECK, flag, KillCoolMenu(), Location, Name(), name, GMV::name, RetrieveValue(), SBUF_SIZE, scode_in_out, ShowCoolMenu(), sim, tprintf(), WhichSpecial(), and xcode_data.

00742 {
00743         int t, i, flag = CM_TWO, se_len = 37;
00744         coolmenu *c = NULL;
00745 
00746         t = WhichSpecial(Location(player));
00747         for(i = 0; xcode_data[i].name; i++)
00748                 if(xcode_data[i].gtype == t && (scode_in_out[xcode_data[i].type] & 1))
00749                         break;
00750         DOCHECK(!xcode_data[i].name,
00751                         "Error: No xcode values for this type of object found.");
00752         addline();
00753         cent(tprintf("Data for %s (%s)", Name(Location(player)),
00754                                  SpecialObjects[t].type));
00755         addline();
00756         if(*buffer == '1') {
00757                 flag = CM_ONE;
00758                 se_len = se_len * 2;
00759         };
00760         if(*buffer == '4') {
00761                 flag = CM_FOUR;
00762                 se_len = se_len / 2;
00763         };
00764         if(*buffer == '1' || *buffer == '4')
00765                 buffer++;
00766         for(i = 0; xcode_data[i].name; i++) {
00767                 if(xcode_data[i].gtype == t && (scode_in_out[xcode_data[i].type] & 1)) {
00768                         /* 1/3(left) = name, 2/3(right)=value */
00769                         char mask[SBUF_SIZE];
00770                         char lab[SBUF_SIZE];
00771 
00772                         if(*buffer)
00773                                 if(strncasecmp(xcode_data[i].name, buffer, strlen(buffer)))
00774                                         continue;
00775                         strcpy(lab, xcode_data[i].name);
00776                         lab[se_len / 3] = 0;
00777                         sprintf(mask, "%%-%ds%%%ds", se_len / 3, se_len * 2 / 3);
00778                         sim(tprintf(mask, lab, RetrieveValue(data, i)), flag);
00779                 }
00780         }
00781         addline();
00782         ShowCoolMenu(player, c);
00783         KillCoolMenu(c);
00784 }

void list_xcodevalues ( dbref  player  ) 

Definition at line 906 of file glue.scode.c.

References name, GMV::name, notify, tprintf(), and xcode_data.

Referenced by do_show().

00907 {
00908         int i;
00909 
00910         notify(player, "Xcode attributes accessible thru get/setxcodevalue:");
00911         for(i = 0; xcode_data[i].name; i++)
00912                 notify(player, tprintf("\t%d\t%s", xcode_data[i].gtype,
00913                                                            xcode_data[i].name));
00914 }

char* mechCentBearingfunc ( int  mode,
MECH mech,
char *  arg 
)

Definition at line 299 of file glue.scode.c.

References FindBearing(), MapCoordToRealCoord(), MechFX, MechFY, MechX, MechY, SBUF_SIZE, x, and y.

00300 {
00301         int x = MechX(mech);
00302         int y = MechY(mech);
00303         float fx, fy;
00304         static char buf[SBUF_SIZE];
00305 
00306         MapCoordToRealCoord(x, y, &fx, &fy);
00307         sprintf(buf, "%d", FindBearing(MechFX(mech), MechFY(mech), fx, fy));
00308         return buf;
00309 }

char* mechCentDistfunc ( int  mode,
MECH mech,
char *  arg 
)

Definition at line 311 of file glue.scode.c.

References FindHexRange(), MapCoordToRealCoord(), MechFX, MechFY, MechX, MechY, SBUF_SIZE, x, and y.

00312 {
00313         int x = MechX(mech);
00314         int y = MechY(mech);
00315         float fx, fy;
00316         static char buf[SBUF_SIZE];
00317 
00318         MapCoordToRealCoord(x, y, &fx, &fy);
00319         sprintf(buf, "%.2f", FindHexRange(fx, fy, MechFX(mech), MechFY(mech)));
00320         return buf;
00321 }

char* mechDamagefunc ( int  mode,
MECH mech,
char *  arg 
)

Definition at line 251 of file glue.scode.c.

References ADD, apply_mechDamage(), CritsInLoc(), FullAmmo(), GetPartData, GetPartType, GetSectArmor, GetSectInt, GetSectOArmor, GetSectOInt, GetSectORArmor, GetSectRArmor, IsAmmo, IsCrap, LBUF_SIZE, NUM_SECTIONS, PartIsDestroyed, and PartTempNuke.

00252 {
00253         /* Lists damage in form:
00254            A:LOC/num[,LOC/num[,LOC(R)/num]],I:LOC/num
00255            C:LOC/num,R:LOC/num(num),G:LOC/num(num) */
00256         int i, j;
00257         static char buf[LBUF_SIZE];
00258         int count = 0;
00259 
00260         if(mode) {
00261                 apply_mechDamage(mech, arg);
00262                 return "?";
00263         };
00264         buf[0] = 0;
00265         for(i = 0; i < NUM_SECTIONS; i++)
00266                 if(GetSectOInt(mech, i)) {
00267                         if(GetSectArmor(mech, i) != GetSectOArmor(mech, i))
00268                                 ADD("A:%d/%d", i, GetSectOArmor(mech,
00269                                                                                                 i) - GetSectArmor(mech, i));
00270                         if(GetSectRArmor(mech, i) != GetSectORArmor(mech, i))
00271                                 ADD("A(R):%d/%d", i, GetSectORArmor(mech,
00272                                                                                                         i) - GetSectRArmor(mech,
00273                                                                                                                                            i));
00274                 }
00275         for(i = 0; i < NUM_SECTIONS; i++)
00276                 if(GetSectOInt(mech, i))
00277                         if(GetSectInt(mech, i) != GetSectOInt(mech, i))
00278                                 ADD("I:%d/%d", i, GetSectOInt(mech, i) - GetSectInt(mech, i));
00279         for(i = 0; i < NUM_SECTIONS; i++)
00280                 for(j = 0; j < CritsInLoc(mech, i); j++) {
00281                         if(GetPartType(mech, i, j) && !IsCrap(GetPartType(mech, i, j))) {
00282                                 if(PartIsDestroyed(mech, i, j)) {
00283                                         ADD("C:%d/%d", i, j);
00284                                 } else {
00285                                         if(IsAmmo(GetPartType(mech, i, j))) {
00286                                                 if(GetPartData(mech, i, j) != FullAmmo(mech, i, j))
00287                                                         ADD("R:%d/%d(%d)", i, j, FullAmmo(mech,
00288                                                                                                                           i,
00289                                                                                                                           j) -
00290                                                                 GetPartData(mech, i, j));
00291                                         } else if(PartTempNuke(mech, i, j))
00292                                                 ADD("G:%d/%d(%d)", i, j, PartTempNuke(mech, i, j));
00293                                 }
00294                         }
00295                 }
00296         return buf;
00297 }

char* mechIDfunc ( int  mode,
MECH mech 
)

Definition at line 99 of file glue.scode.c.

References MechID.

00100 {
00101         static char buf[3];
00102 
00103         buf[0] = MechID(mech)[0];
00104         buf[1] = MechID(mech)[1];
00105         buf[2] = 0;
00106         return buf;
00107 }

char* mechMovefunc ( int  mode,
MECH mech,
char *  arg 
)

Definition at line 134 of file glue.scode.c.

References compare_array(), MechMove, and move_types.

00135 {
00136         int i;
00137 
00138         if(!mode)
00139                 return move_types[(short) MechMove(mech)];
00140         if((i = compare_array(move_types, arg)) >= 0)
00141                 MechMove(mech) = i;
00142         return NULL;
00143 }

char* mechTechTimefunc ( int  mode,
MECH mech 
)

Definition at line 145 of file glue.scode.c.

References figure_latest_tech_event(), and MBUF_SIZE.

00146 {
00147         static char buf[MBUF_SIZE];
00148         int n = figure_latest_tech_event(mech);
00149 
00150         sprintf(buf, "%d", n);
00151         return buf;
00152 }

char* mechTypefunc ( int  mode,
MECH mech,
char *  arg 
)

Definition at line 122 of file glue.scode.c.

References compare_array(), mech_types, and MechType.

00123 {
00124         int i;
00125 
00126         if(!mode)
00127                 return mech_types[(short) MechType(mech)];
00128         /* Should _alter_ mechtype.. weeeel. */
00129         if((i = compare_array(mech_types, arg)) >= 0)
00130                 MechType(mech) = i;
00131         return NULL;
00132 }

void set_xcodestuff ( dbref  player,
void *  data,
char *  buffer 
)

Definition at line 682 of file glue.scode.c.

References args, DOCHECK, FindObjectsData(), getMech(), Location, name, GMV::name, scode_in_out, silly_parseattributes(), GMV::size, text2bv(), TYPE_BV, TYPE_CBV, TYPE_CHAR, TYPE_DBREF, TYPE_FLOAT, TYPE_INT, TYPE_SHORT, TYPE_STRFUNC_BD, TYPE_STRFUNC_S, TYPE_STRING, WhichSpecial(), and xcode_data.

00683 {
00684         char *args[2];
00685         int t, i;
00686         void *bar;
00687         void *(*tempfun) ();
00688 
00689         memset(args, 0, sizeof(char *) * 2);
00690 
00691         DOCHECK(silly_parseattributes(buffer, args, 2) != 2,
00692                         "Invalid arguments!");
00693         t = WhichSpecial(Location(player));
00694         for(i = 0; xcode_data[i].name; i++)
00695                 if(xcode_data[i].gtype == t)
00696                         break;
00697         DOCHECK(!xcode_data[i].name,
00698                         "Error: No xcode values for this type of object found.");
00699         for(i = 0; xcode_data[i].name; i++)
00700                 if(!strcasecmp(args[0], xcode_data[i].name) &&
00701                    xcode_data[i].gtype == t && (scode_in_out[xcode_data[i].type] & 2))
00702                         break;
00703         DOCHECK(!xcode_data[i].name,
00704                         "Error: No matching xcode value for this type of object found.");
00705         bar =
00706                 (void *) ((int) FindObjectsData(Location(player)) +
00707                                   xcode_data[i].rel_addr);
00708         switch (xcode_data[i].type) {
00709         case TYPE_STRFUNC_BD:
00710         case TYPE_STRFUNC_S:
00711                 tempfun = (void *) xcode_data[i].rel_addr;
00712                 tempfun(1, getMech(Location(player)), (char *) args[1]);
00713                 break;
00714         case TYPE_STRING:
00715                 strncpy((char *) bar, args[1], xcode_data[i].size - 1);
00716                 ((char *) bar)[xcode_data[i].size - 1] = '\0';
00717                 break;
00718         case TYPE_DBREF:
00719                 *((dbref *) bar) = atoi(args[1]);
00720                 break;
00721         case TYPE_CHAR:
00722                 *((char *) bar) = atoi(args[1]);
00723                 break;
00724         case TYPE_SHORT:
00725                 *((short *) bar) = atoi(args[1]);
00726                 break;
00727         case TYPE_INT:
00728                 *((int *) bar) = atoi(args[1]);
00729                 break;
00730         case TYPE_FLOAT:
00731                 *((float *) bar) = atof(args[1]);
00732                 break;
00733         case TYPE_BV:
00734                 *((int *) bar) = text2bv(args[1]);
00735                 break;
00736         case TYPE_CBV:
00737                 *((byte *) bar) = (byte) text2bv(args[1]);
00738         }
00739 }


Generated on Mon May 28 04:25:45 2007 for BattletechMUX by  doxygen 1.4.7