[btech-checkins] CVS: btechmux/src/hcode glue.c,1.5.2.2,1.5.2.3 glue.hcode.c,1.1.1.1,1.1.1.1.2.1 glu
Brought to you by:
twouters
From: Thomas W. <two...@us...> - 2004-08-08 23:48:53
|
Update of /cvsroot/btech/btechmux/src/hcode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12777/src/hcode Modified Files: Tag: btmux_1_4-branch glue.c glue.hcode.c glue.scode.c Log Message: Annual (ahem) sync with the BitKeeper btechmux-stable tree (at btechmux.bkbits.net/btechmux-stable). I should sync more often but I've been short on time. If you want to keep in touch with the changes, consider using BK directly. This sync contains these BK changesets: # -------------------------------------------- # 03/09/30 th...@st... 1.26 # Skip sections that have no internals, when calculating weight of a unit. The MUX treats these sections as 'nonexistant' in all other places, too, but it's still possible (albeit difficult) to get something into those sections, eating up phantom weight. # # -------------------------------------------- # 03/10/01 th...@st... 1.27 # Safeguard against a 'shouldn't-happen' scenario that seems to have happened several times now on 3030MUX. (but was probably just generic memory corruption.) # -------------------------------------------- # 03/10/01 th...@st... 1.28.1.1 # Rather than safeguard against something, do the proper fix :) wcAmmoItems was incremented twice, in some circumstances. That's not very healthy. Remove the safeguard, it serves no purpose other than protect against hardware errors or memory corruption, both of which would cause other problems anyhow. # -------------------------------------------- # 03/10/01 th...@st... 1.30 # Merge stalker.xs4all.nl:/home/thomas/btsrc/bitkeeper/btechmux-stable # into stalker.xs4all.nl:/home/thomas/btsrc/btechmux-stable # -------------------------------------------- # 03/10/01 th...@ce... 1.31 # Ice glitchfixes: break through it while standing, and don't survive as tank breaking ice. # -------------------------------------------- # 03/10/01 th...@ce... 1.32 # More ice glitch fixes: properly break ice when picking a unit (but not a MechWarrior) up through it. # -------------------------------------------- # 03/10/01 th...@ce... 1.33 # Wups... don't sink hovertows. # -------------------------------------------- # 03/10/05 th...@st... 1.34 # Make MUX function 'btgetdbrefbyid' accept a map as well as a 'mech as its first argument. # -------------------------------------------- # 03/10/12 th...@st... 1.35 # - Fix bug in MechPrefs (MUX +bug #1152) and make sure it doesn't happen again. # - Add MechPrefs to xcodevalues. # # -------------------------------------------- # 03/10/12 th...@st... 1.36 # - Consider OOD-ing 'mechs as Jumping 'mechs where appropriate. # -------------------------------------------- # 03/10/14 th...@st... 1.37 # Add new 'c' option to LRS, for colorized terrain. # -------------------------------------------- # 03/10/14 th...@st... 1.38 # Don't cliff hovers that go from l0 bridge to l1 bridge. # -------------------------------------------- # 03/10/14 th...@st... 1.39 # Don't drown vehicles that manage to break l0 ice. # -------------------------------------------- # 03/10/15 th...@st... 1.40 # Add tactical/lrs-like argument handling to navigate. You can now say 'navigate 120 1' to see the hex bearing 120 of you as if you were in it, or 'navigate qq' to see the navigate for 'Mech 'qq'. Max range is the same as for 'tactical'. # -------------------------------------------- # 03/10/18 th...@st... 1.41 # - Add 'tactical b', for displaying valid DropShip landing zones # - Add the ability to run 'checklz x y' for hexes in TacRange. # -------------------------------------------- # 03/10/19 th...@st... 1.42 # - Add new 'btmechfreqs' function, returning the radio freqs on a 'Mech. It returns a comma separated list of entries, each of which is: # # <freqnum> | <frequency> | <freqflags> | <colorcode> # # Where freqnum starts at 1, frequency is the actual frequency set, colormode is the color setting for that channel (captial letters meaning bold), and freqflags is a bitvector-string with the following meaning: # # - 'a': Freq is digital # - 'b': Freq is muted # - 'c': Freq is set Relay # - 'd': Freq is set Info # - 'e': Freq is set Scan # # Comtitles are not returned because of escaping issues. # -------------------------------------------- # 03/10/19 th...@st... 1.43 # Make second argument to 'btstores' optional. When not passed, 'btstores' will return partname:amount pairs, separated by |'s, for all parts in the inventory of the object. # -------------------------------------------- # 03/10/19 th...@st... 1.44 # Patch from Tony to make tel() and @tel 'teleport' exits the same way the 'drop' command does. # -------------------------------------------- # 03/10/21 th...@st... 1.45 # Fix eternal loop when calling btdamagemech() with a 'clustersize' of 0. # -------------------------------------------- # 03/10/31 th...@st... 1.46 # Glitchfix. # -------------------------------------------- # 03/10/31 th...@st... 1.47 # Possibly fix memory corruption problems 3030 has been having, by fixing around tprintf (as suggested by Null @ 3029.) # -------------------------------------------- # 03/11/14 th...@ce... 1.44.1.1 # Fix buglet in btlostohex(): use proper range. # -------------------------------------------- # 03/11/15 th...@st... 1.48 # Fix possibly malicious crashing bug in macros. # -------------------------------------------- # 03/11/15 th...@ce... 1.49 # Merge http://btechmux.bkbits.net/btechmux-stable # into centurion.xs4all.nl:/home/thomas/btsrc/btechmux-stable # -------------------------------------------- # 03/11/20 th...@st... 1.50 # Misc cleanup fixes. Stuff that probably didn't cause any real-world bugs, but should be fixed anyway. # -------------------------------------------- # 03/11/23 th...@st... 1.51 # - Facilitate debugging by not closing stdin/stdout. Old behaviour can be had by defining CLOSE_STDIN somewhere, but I have no use for it yet. # - Zap rediculous 'filedecriptor caching' that just re-used fd0 for everything, brutally closing it if needed. I'm suprised this hasn't caused odd bugs where data went to the wrong file. Totally unnecessary. # - Various memory buglets found by Valgrind. Some things were obviously wrong but never went wrong thanks to the reliability of stack layout in GCC. Others were potentially wrong but probably never did any harm -- but I could be wrong. # # -------------------------------------------- # 04/02/09 th...@st... 1.52 # Fix off-by-one error in reading maps with an X size of MAPX (1000 by default.) # -------------------------------------------- # 04/02/10 th...@st... 1.53 # Open help/news files for reading, not writing. Oopsie from last changeset. # -------------------------------------------- # 04/02/12 th...@st... 1.54 # remove unused file. # -------------------------------------------- # 04/03/05 th...@ce... 1.49.1.1 # foobar changeset # -------------------------------------------- # 04/03/05 th...@ce... 1.49.1.2 # foobar2 # -------------------------------------------- # 04/05/08 th...@st... 1.55 # Properly display valid/invalid LZ's in 'tactical b' even when not using colours. Previously, the characters \240 and \241 (inverted exclamation mark and non-break space, respectively, in ISO 8859-1 and -15) were displayed. # # -------------------------------------------- # 04/05/08 th...@st... 1.56 # Protect some xcodevalues from being changed, to avoid memory corruption and the like. # -------------------------------------------- # 04/05/09 th...@st... 1.57 # Fix some buglets in previous fixes: don't close fd's that weren't opened, and when using memmove instead of strcpy, include the terminating NUL manually. # -------------------------------------------- # 04/05/09 th...@st... 1.58 # Fix typo in previous checkin, and compile before checking in. # -------------------------------------------- # 04/05/11 th...@ce... 1.59 # Merge http://btechmux.bkbits.net/btechmux-stable # into centurion.xs4all.nl:/home/thomas/btsrc/btechmux-stable # -------------------------------------------- # 04/05/11 th...@ce... 1.60 # Fix compiler warnings: # - Add a few missing include files # - Remove unused variables # -------------------------------------------- # 04/05/11 th...@ce... 1.61 # Fix small loophole where you could tell an out-of-LOS unit's approximate location by triangulating 'out of arc' messages. Always give the same 'out of los' message for mechID's that are not in LOS, even if the mechID's don't exist or if they are out of range or out of arc. # -------------------------------------------- # 04/05/11 th...@st... 1.62 # Fix off-by-one error in the kick-decision range check in autopilots. # -------------------------------------------- # 04/07/29 th...@st... 1.63 # Attempt to improve the dieroll's randomness somewhat. # -------------------------------------------- Index: glue.c =================================================================== RCS file: /cvsroot/btech/btechmux/src/hcode/glue.c,v retrieving revision 1.5.2.2 retrieving revision 1.5.2.3 diff -C2 -d -r1.5.2.2 -r1.5.2.3 *** glue.c 4 Apr 2002 13:13:08 -0000 1.5.2.2 --- glue.c 8 Aug 2004 23:48:13 -0000 1.5.2.3 *************** *** 178,182 **** } ! #define OkayHcode(a) (Hardcode(a) && !Zombie(a)) /* Main entry point */ --- 178,182 ---- } ! #define OkayHcode(a) (a >= 0 && Hardcode(a) && !Zombie(a)) /* Main entry point */ Index: glue.hcode.c =================================================================== RCS file: /cvsroot/btech/btechmux/src/hcode/glue.hcode.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -C2 -d -r1.1.1.1 -r1.1.1.1.2.1 *** glue.hcode.c 3 Jan 2002 01:00:27 -0000 1.1.1.1 --- glue.hcode.c 8 Aug 2004 23:48:14 -0000 1.1.1.1.2.1 *************** *** 114,118 **** int silly_parseattributes(char *buffer, char **args, int max) { ! char bufferi[LBUF_SIZE], foobuff[LBUF_SIZE]; char *a, *b; int count = 0; --- 114,118 ---- int silly_parseattributes(char *buffer, char **args, int max) { ! static char bufferi[LBUF_SIZE], foobuff[LBUF_SIZE]; char *a, *b; int count = 0; *************** *** 153,157 **** args[max - 1] = foobuff; } ! return (num_args); } --- 153,157 ---- args[max - 1] = foobuff; } ! return num_args; } *************** *** 172,175 **** /* buffer */ } ! return (num_args); } --- 172,175 ---- /* buffer */ } ! return num_args; } Index: glue.scode.c =================================================================== RCS file: /cvsroot/btech/btechmux/src/hcode/glue.scode.c,v retrieving revision 1.2.2.15 retrieving revision 1.2.2.16 diff -C2 -d -r1.2.2.15 -r1.2.2.16 *** glue.scode.c 30 Sep 2003 01:38:35 -0000 1.2.2.15 --- glue.scode.c 8 Aug 2004 23:48:14 -0000 1.2.2.16 *************** *** 44,47 **** --- 44,48 ---- #include "p.event.h" #include "p.mech.restrict.h" + #include "mech.partnames.h" extern SpecialObjectStruct SpecialObjects[]; *************** *** 56,59 **** --- 57,61 ---- int rel_addr; int type; + int size; } GMV; *************** *** 68,77 **** enum { TYPE_STRING, TYPE_CHAR, TYPE_SHORT, TYPE_INT, TYPE_FLOAT, TYPE_DBREF, TYPE_STRFUNC, TYPE_STRFUNC_S, TYPE_BV, ! TYPE_STRFUNC_BD, TYPE_CBV }; /* INDENT OFF */ ! /* st ch sh in fl db sf sfs bv sfb cbv */ ! static int scode_in_out[] = { 3, 3, 3, 3, 3, 3, 1, 2, 3, 3, 3 }; /* INDENT ON */ --- 70,81 ---- enum { TYPE_STRING, TYPE_CHAR, TYPE_SHORT, TYPE_INT, TYPE_FLOAT, TYPE_DBREF, TYPE_STRFUNC, TYPE_STRFUNC_S, TYPE_BV, ! TYPE_STRFUNC_BD, TYPE_CBV, TYPE_CHAR_RO, TYPE_SHORT_RO, TYPE_INT_RO, ! TYPE_FLOAT_RO, TYPE_DBREF_RO, TYPE_LAST_TYPE }; /* INDENT OFF */ ! static int scode_in_out[TYPE_LAST_TYPE] = ! /* st ch sh in fl db sf sfs bv sfb cbv ro-ch ro-sh ro-in ro-fl ro-db*/ ! { 3, 3, 3, 3, 3, 3, 1, 2, 3, 3, 3, 1, 1, 1, 1, 1 }; /* INDENT ON */ *************** *** 81,112 **** #define MeEntry(Name,Func,Type) \ ! {GTYPE_MECH,Name,Uglie(Func),Type} #define MeVEntry(Name,Func,Val,Type) \ ! {GTYPE_MECH,Name,UglieV(Func,Val),Type} #define UglieM(dat) ((int) &tmpmap.dat) - ((int) &tmpmap) #define MaEntry(Name,Func,Type) \ ! {GTYPE_MAP,Name,UglieM(Func),Type} #define UglieT(dat) ((int) &tmpturret.dat) - ((int) &tmpturret) #define TuEntry(Name,Func,Type) \ ! {GTYPE_TURRET,Name,UglieT(Func),Type} #define UglieC(dat) ((int) &tmpcustom.dat) - ((int) &tmpcustom) #define CuEntry(Name,Func,Type) \ ! {GTYPE_CUSTOM,Name,UglieC(Func),Type} #define UglieScen(dat) ((int) &tmpscen.dat) - ((int) &tmpscen) #define SEntry(Name,Func,Type) \ ! {GTYPE_SCEN,Name,UglieScen(Func),Type} #define UglieSside(dat) ((int) &tmpsside.dat) - ((int) &tmpsside) #define SSEntry(Name,Func,Type) \ ! {GTYPE_SSIDE,Name,UglieSside(Func),Type} #define UglieSsobj(dat) ((int) &tmpssobj.dat) - ((int) &tmpssobj) #define SSOEntry(Name,Func,Type) \ ! {GTYPE_SSOBJ,Name,UglieSsobj(Func),Type} --- 85,131 ---- #define MeEntry(Name,Func,Type) \ ! {GTYPE_MECH,Name,Uglie(Func),Type,0} ! ! #define MeEntryS(Name,Func,Type,Size) \ ! {GTYPE_MECH,Name,Uglie(Func),Type,Size} #define MeVEntry(Name,Func,Val,Type) \ ! {GTYPE_MECH,Name,UglieV(Func,Val),Type,0} #define UglieM(dat) ((int) &tmpmap.dat) - ((int) &tmpmap) #define MaEntry(Name,Func,Type) \ ! {GTYPE_MAP,Name,UglieM(Func),Type,0} ! #define MaEntryS(Name,Func,Type,Size) \ ! {GTYPE_MAP,Name,UglieM(Func),Type,Size} #define UglieT(dat) ((int) &tmpturret.dat) - ((int) &tmpturret) #define TuEntry(Name,Func,Type) \ ! {GTYPE_TURRET,Name,UglieT(Func),Type,0} ! #define TuEntryS(Name,Func,Type,Size) \ ! {GTYPE_TURRET,Name,UglieT(Func),Type,Size} #define UglieC(dat) ((int) &tmpcustom.dat) - ((int) &tmpcustom) #define CuEntry(Name,Func,Type) \ ! {GTYPE_CUSTOM,Name,UglieC(Func),Type,0} ! #define CuEntryS(Name,Func,Type,Size) \ ! {GTYPE_CUSTOM,Name,UglieC(Func),Type,Size} #define UglieScen(dat) ((int) &tmpscen.dat) - ((int) &tmpscen) #define SEntry(Name,Func,Type) \ ! {GTYPE_SCEN,Name,UglieScen(Func),Type,0} ! #define SEntryS(Name,Func,Type,Size) \ ! {GTYPE_SCEN,Name,UglieScen(Func),Type,Size} #define UglieSside(dat) ((int) &tmpsside.dat) - ((int) &tmpsside) #define SSEntry(Name,Func,Type) \ ! {GTYPE_SSIDE,Name,UglieSside(Func),Type,0} ! #define SSEntryS(Name,Func,Type,Size) \ ! {GTYPE_SSIDE,Name,UglieSside(Func),Type,Size} #define UglieSsobj(dat) ((int) &tmpssobj.dat) - ((int) &tmpssobj) #define SSOEntry(Name,Func,Type) \ ! {GTYPE_SSOBJ,Name,UglieSsobj(Func),Type,0} ! #define SSOEntryS(Name,Func,Type,Size) \ ! {GTYPE_SSOBJ,Name,UglieSsobj(Func),Type,Size} *************** *** 420,427 **** {GTYPE_MECH, "mapindex", ((int) &tmpm.mapindex) - ((int) &tmpm), ! TYPE_DBREF}, {GTYPE_MECH, "id", (int) mechIDfunc, TYPE_STRFUNC}, ! MeEntry("mechname", MechType_Name, TYPE_STRING), MeEntry("maxspeed", MechMaxSpeed, TYPE_FLOAT), MeEntry("pilotnum", MechPilot, TYPE_DBREF), --- 439,446 ---- {GTYPE_MECH, "mapindex", ((int) &tmpm.mapindex) - ((int) &tmpm), ! TYPE_DBREF_RO}, {GTYPE_MECH, "id", (int) mechIDfunc, TYPE_STRFUNC}, ! MeEntryS("mechname", MechType_Name, TYPE_STRING, 31), MeEntry("maxspeed", MechMaxSpeed, TYPE_FLOAT), MeEntry("pilotnum", MechPilot, TYPE_DBREF), *************** *** 441,454 **** MeEntry("team", MechTeam, TYPE_INT), MeEntry("tons", MechTons, TYPE_INT), ! MeEntry("towing", MechCarrying, TYPE_INT), MeEntry("heat", MechPlusHeat, TYPE_FLOAT), ! MeEntry("disabled_hs", MechDisabledHS, TYPE_INT), MeEntry("overheat", MechHeat, TYPE_FLOAT), MeEntry("dissheat", MechMinusHeat, TYPE_FLOAT), MeEntry("last_startup", MechLastStartup, TYPE_INT), ! MeEntry("C3iNetworkSize", MechC3iNetworkSize, TYPE_INT), MeEntry("MaxSuits", MechMaxSuits, TYPE_INT), MeEntry("realweight", MechRTonsV, TYPE_INT), ! MeEntry("StaggerDamage", StaggerDamage, TYPE_INT), #ifdef BT_ENABLED --- 460,474 ---- MeEntry("team", MechTeam, TYPE_INT), MeEntry("tons", MechTons, TYPE_INT), ! MeEntry("towing", MechCarrying, TYPE_INT_RO), MeEntry("heat", MechPlusHeat, TYPE_FLOAT), ! MeEntry("disabled_hs", MechDisabledHS, TYPE_INT_RO), MeEntry("overheat", MechHeat, TYPE_FLOAT), MeEntry("dissheat", MechMinusHeat, TYPE_FLOAT), MeEntry("last_startup", MechLastStartup, TYPE_INT), ! MeEntry("C3iNetworkSize", MechC3iNetworkSize, TYPE_INT_RO), MeEntry("MaxSuits", MechMaxSuits, TYPE_INT), MeEntry("realweight", MechRTonsV, TYPE_INT), ! MeEntry("StaggerDamage", StaggerDamage, TYPE_INT_RO), ! MeEntry("MechPrefs", MechPrefs, TYPE_BV), #ifdef BT_ENABLED *************** *** 465,469 **** MeEntry("fuel", AeroFuel, TYPE_INT), MeEntry("fuel_orig", AeroFuelOrig, TYPE_INT), ! MeEntry("cocoon", MechCocoon, TYPE_INT), MeEntry("numseen", MechNumSeen, TYPE_SHORT), --- 485,489 ---- MeEntry("fuel", AeroFuel, TYPE_INT), MeEntry("fuel_orig", AeroFuelOrig, TYPE_INT), ! MeEntry("cocoon", MechCocoon, TYPE_INT_RO), MeEntry("numseen", MechNumSeen, TYPE_SHORT), *************** *** 492,496 **** MeVEntry("turret2", AeroTurret, 2, TYPE_DBREF), ! MeEntry("unusablearcs", AeroUnusableArcs, TYPE_INT), MeEntry("maxjumpspeed", MechJumpSpeed, TYPE_FLOAT), MeEntry("jumpheading", MechJumpHeading, TYPE_SHORT), --- 512,516 ---- MeVEntry("turret2", AeroTurret, 2, TYPE_DBREF), ! MeEntry("unusablearcs", AeroUnusableArcs, TYPE_INT_RO), MeEntry("maxjumpspeed", MechJumpSpeed, TYPE_FLOAT), MeEntry("jumpheading", MechJumpHeading, TYPE_SHORT), *************** *** 498,512 **** MaEntry("buildflag", buildflag, TYPE_CHAR), ! MaEntry("buildonmap", onmap, TYPE_DBREF), MaEntry("cf", cf, TYPE_SHORT), MaEntry("cfmax", cfmax, TYPE_SHORT), MaEntry("gravity", grav, TYPE_CHAR), MaEntry("maxcf", cfmax, TYPE_SHORT), ! MaEntry("firstfree", first_free, TYPE_CHAR), ! MaEntry("mapheight", map_height, TYPE_SHORT), MaEntry("maplight", maplight, TYPE_CHAR), ! MaEntry("mapname", mapname, TYPE_STRING), MaEntry("mapvis", mapvis, TYPE_CHAR), ! MaEntry("mapwidth", map_width, TYPE_SHORT), MaEntry("maxvis", maxvis, TYPE_SHORT), MaEntry("temperature", temp, TYPE_CHAR), --- 518,532 ---- MaEntry("buildflag", buildflag, TYPE_CHAR), ! MaEntry("buildonmap", onmap, TYPE_DBREF_RO), MaEntry("cf", cf, TYPE_SHORT), MaEntry("cfmax", cfmax, TYPE_SHORT), MaEntry("gravity", grav, TYPE_CHAR), MaEntry("maxcf", cfmax, TYPE_SHORT), ! MaEntry("firstfree", first_free, TYPE_CHAR_RO), ! MaEntry("mapheight", map_height, TYPE_SHORT_RO), MaEntry("maplight", maplight, TYPE_CHAR), ! MaEntryS("mapname", mapname, TYPE_STRING, 30), MaEntry("mapvis", mapvis, TYPE_CHAR), ! MaEntry("mapwidth", map_width, TYPE_SHORT_RO), MaEntry("maxvis", maxvis, TYPE_SHORT), MaEntry("temperature", temp, TYPE_CHAR), *************** *** 535,539 **** SEntry("end", end_t, TYPE_INT), ! SSEntry("slet", slet, TYPE_STRING), SSOEntry("state", state, TYPE_INT), --- 555,559 ---- SEntry("end", end_t, TYPE_INT), ! SSEntryS("slet", slet, TYPE_STRING, 10), SSOEntry("state", state, TYPE_INT), *************** *** 574,578 **** break; case TYPE_STRING: ! strcpy((char *) bar, fargs[2]); break; case TYPE_DBREF: --- 594,599 ---- break; case TYPE_STRING: ! strncpy((char *) bar, fargs[2], xcode_data[i].size - 1); ! ((char *)bar)[xcode_data[i].size - 1] = '\0'; break; case TYPE_DBREF: *************** *** 621,636 **** --- 642,662 ---- break; case TYPE_DBREF: + case TYPE_DBREF_RO: sprintf(buf, "%d", (dbref) * ((dbref *) bar)); break; case TYPE_CHAR: + case TYPE_CHAR_RO: sprintf(buf, "%d", (char) *((char *) bar)); break; case TYPE_SHORT: + case TYPE_SHORT_RO: sprintf(buf, "%d", (short) *((short *) bar)); break; case TYPE_INT: + case TYPE_INT_RO: sprintf(buf, "%d", (int) *((int *) bar)); break; case TYPE_FLOAT: + case TYPE_FLOAT_RO: sprintf(buf, "%.2f", (float) *((float *) bar)); break; *************** *** 729,733 **** break; case TYPE_STRING: ! strcpy((char *) bar, args[1]); break; case TYPE_DBREF: --- 755,760 ---- break; case TYPE_STRING: ! strncpy((char *) bar, args[1], xcode_data[i].size - 1); ! ((char *)bar)[xcode_data[i].size - 1] = '\0'; break; case TYPE_DBREF: *************** *** 822,845 **** FUNCTION(fun_btstores) { ! /* fargs[0] = id of the bay */ ! /* fargs[1] = name of the part */ dbref it; ! int i, spec; ! void *foo; int p, b; - it = match_thing(player, fargs[0]); - FUNCHECK(it == NOTHING || !Examinable(player, it), "#-1"); - spec = WhichSpecial(it); - FUNCHECK(!(foo = FindObjectsData(it)), "#-1"); FUNCHECK(!WizR(player), "#-1 PERMISSION DENIED"); ! i = -1; ! if (!find_matching_long_part(fargs[1], &i, &p, &b)) { i = -1; ! FUNCHECK(!find_matching_vlong_part(fargs[1], &i, &p, &b), ! "#-1 INVALID PART NAME"); } - safe_tprintf_str(buff, bufc, "%d", econ_find_items(it, p, b)); - return; } --- 849,893 ---- FUNCTION(fun_btstores) { ! /* fargs[0] = id of the bay/mech */ ! /* fargs[1] = (optional) name of the part */ dbref it; ! int i, x = 0; int p, b; + int pile[BRANDCOUNT + 1][NUM_ITEMS]; + char *t; FUNCHECK(!WizR(player), "#-1 PERMISSION DENIED"); ! FUNCHECK(nfargs < 1 || nfargs > 2, ! "#-1 FUNCTION (BTSTORES) EXPECTS 1 OR 2 ARGUMENTS"); ! it = match_thing(player, fargs[0]); ! FUNCHECK(!Good_obj(it), "#-1 INVALID TARGET"); ! if (nfargs > 1) { i = -1; ! if (!find_matching_long_part(fargs[1], &i, &p, &b)) { ! i = -1; ! FUNCHECK(!find_matching_vlong_part(fargs[1], &i, &p, &b), ! "#-1 INVALID PART NAME"); ! } ! safe_tprintf_str(buff, bufc, "%d", econ_find_items(it, p, b)); ! } else { ! memset(pile, 0, sizeof(pile)); ! t = silly_atr_get(it, A_ECONPARTS); ! while (*t) { ! if (*t == '[') ! if ((sscanf(t, "[%d,%d,%d]", &i, &p, &b)) == 3) ! pile[p][i] += b; ! t++; ! } ! for (i = 0; i < object_count; i++) { ! UNPACK_PART(short_sorted[i]->index, p, b); ! if (pile[b][p]) { ! if (x) ! safe_str("|", buff, bufc); ! x = pile[b][p]; ! safe_tprintf_str(buff, bufc, "%s:%d", ! part_name_long(p, b), x); ! } ! } } } *************** *** 1089,1094 **** FUNCHECK(!IsMech(it), "#-1 NOT A MECH"); FUNCHECK(!(mech = FindObjectsData(it)), "#-1 UNABLE TO GET MECHDATA"); ! FUNCHECK(Readnum(totaldam, fargs[1]), "#-1 INVALID 2ND ARG"); ! FUNCHECK(Readnum(clustersize, fargs[2]), "#-1 INVALID 3RD ARG"); FUNCHECK(Readnum(direction, fargs[3]), "#-1 INVALID 4TH ARG"); FUNCHECK(Readnum(iscrit, fargs[4]), "#-1 INVALID 5TH ARG"); --- 1137,1144 ---- FUNCHECK(!IsMech(it), "#-1 NOT A MECH"); FUNCHECK(!(mech = FindObjectsData(it)), "#-1 UNABLE TO GET MECHDATA"); ! FUNCHECK(Readnum(totaldam, fargs[1]) || totaldam < 1, ! "#-1 INVALID 2ND ARG"); ! FUNCHECK(Readnum(clustersize, fargs[2]) || clustersize < 1, ! "#-1 INVALID 3RD ARG"); FUNCHECK(Readnum(direction, fargs[3]), "#-1 INVALID 4TH ARG"); FUNCHECK(Readnum(iscrit, fargs[4]), "#-1 INVALID 5TH ARG"); *************** *** 1207,1212 **** /* fargs[0] = mech fargs[1] = target ID */ - MECH *mech; MECH *target; dbref mechnum; --- 1257,1262 ---- /* fargs[0] = mech fargs[1] = target ID */ MECH *target; + MECH *mech = NULL; dbref mechnum; *************** *** 1214,1227 **** mechnum = match_thing(player, fargs[0]); FUNCHECK(mechnum == NOTHING || !Examinable(player, mechnum), ! "#-1 INVALID MECH"); ! FUNCHECK(!IsMech(mechnum), "#-1 INVALID MECH"); ! FUNCHECK(!(mech = getMech(mechnum)), "#-1 INVALID MECH"); FUNCHECK(strlen(fargs[1]) != 2, "#-1 INVALID TARGETID"); ! mechnum = FindTargetDBREFFromMapNumber(mech, fargs[1]); FUNCHECK(mechnum < 0, "#-1 INVALID TARGETID"); ! FUNCHECK(!(target = getMech(mechnum)), "#-1 INVALID TARGETID"); ! FUNCHECK(!InLineOfSight_NB(mech, target, MechX(target), MechY(target), ! FlMechRange(getMap(mech->mapindex), mech, target)), ! "#-1 INVALID TARGETID"); safe_tprintf_str(buff, bufc, "#%d", (int) mechnum); } --- 1264,1287 ---- mechnum = match_thing(player, fargs[0]); FUNCHECK(mechnum == NOTHING || !Examinable(player, mechnum), ! "#-1 INVALID MECH/MAP"); FUNCHECK(strlen(fargs[1]) != 2, "#-1 INVALID TARGETID"); ! if (IsMech(mechnum)) { ! FUNCHECK(!(mech = getMech(mechnum)), "#-1 INVALID MECH"); ! mechnum = FindTargetDBREFFromMapNumber(mech, fargs[1]); ! } else if (IsMap(mechnum)) { ! MAP *map; ! FUNCHECK(!(map = getMap(mechnum)), "#-1 INVALID MAP"); ! mechnum = FindMechOnMap(map, fargs[1]); ! } else { ! safe_str("#-1 INVALID MECH/MAP", buff, bufc); ! return; ! } FUNCHECK(mechnum < 0, "#-1 INVALID TARGETID"); ! if (mech) { ! FUNCHECK(!(target = getMech(mechnum)), "#-1 INVALID TARGETID"); ! FUNCHECK(!InLineOfSight_NB(mech, target, MechX(target), MechY(target), ! FlMechRange(getMap(mech->mapindex), mech, target)), ! "#-1 INVALID TARGETID"); ! } safe_tprintf_str(buff, bufc, "#%d", (int) mechnum); } *************** *** 1237,1240 **** --- 1297,1301 ---- MAP *map; int x = -1, y = -1, mechnum; + float fx, fy; FUNCHECK(!WizR(player), "#-1 PERMISSION DENIED"); *************** *** 1250,1255 **** FUNCHECK(x < 0 || x > map->map_width || y < 0 || y > map->map_height, "#-1 INVALID COORDINATES"); if (InLineOfSight_NB(mech, NULL, x, y, ! FindHexRange(MechFX(mech), MechFY(mech), x, y))) safe_tprintf_str(buff, bufc, "1"); else --- 1311,1317 ---- FUNCHECK(x < 0 || x > map->map_width || y < 0 || y > map->map_height, "#-1 INVALID COORDINATES"); + MapCoordToRealCoord(x, y, &fx, &fy); if (InLineOfSight_NB(mech, NULL, x, y, ! FindHexRange(MechFX(mech), MechFY(mech), fx, fy))) safe_tprintf_str(buff, bufc, "1"); else *************** *** 1305,1309 **** !find_matching_vlong_part(fargs[1], &index, &id, &brand) && !find_matching_long_part(fargs[1], &index, &id, &brand), "0"); - found: econ_change_items(loc, id, brand, count); SendEcon(tprintf("#%d added %d %s to #%d", player, count, --- 1367,1370 ---- *************** *** 1369,1372 **** } } ! #endif --- 1430,1464 ---- } } ! ! extern char radio_colorstr[]; ! ! FUNCTION(fun_btmechfreqs) ! { ! /* fargs[0] = mechobject ! */ ! int mechdbref; ! MECH * mech; ! int i; ! ! FUNCHECK(!WizR(player), "#-1 PERMISSION DENIED"); ! mechdbref = match_thing(player, fargs[0]); ! FUNCHECK(!Good_obj(mechdbref), "#-1 INVALID TARGET"); ! mech = getMech(mechdbref); ! FUNCHECK(!mech, "#-1 INVALID TARGET"); ! ! for (i = 0; i < MFreqs(mech); i++) { ! if (i) ! safe_str(",", buff, bufc); ! safe_tprintf_str(buff, bufc, "%d|%d|%s", ! i + 1, mech->freq[i], ! bv2text(mech->freqmodes[i] % FREQ_REST)); ! if (mech->freqmodes[i] / FREQ_REST) { ! safe_tprintf_str(buff, bufc, "|%c", ! radio_colorstr[mech->freqmodes[i] / FREQ_REST - 1]); ! } else { ! safe_str("|-", buff, bufc); ! } ! } ! } ! #endif |