#include "config.h"
#include "externs.h"
#include "debug.h"
#include "glue.h"
#include "muxevent.h"
#include "mech.h"
#include "create.h"
#include "mux_tree.h"
#include "p.mux_tree.h"
#include "p.map.obj.h"
#include "p.mech.startup.h"
#include "p.mech.partnames.h"
Include dependency graph for debug.c:
Go to the source code of this file.
Functions | |
void | GoThruTree (Tree tree, int(*func)(Node *)) |
void | debug_list (dbref player, void *data, char *buffer) |
void | debug_savedb (dbref player, void *data, char *buffer) |
void | debug_loaddb (dbref player, void *data, char *buffer) |
static int | debug_check_stuff (Node *tmp) |
void | debug_memory (dbref player, void *data, char *buffer) |
void | ShutDownMap (dbref player, dbref mapnumber) |
void | debug_shutdown (dbref player, void *data, char *buffer) |
void | debug_setvrt (dbref player, void *data, char *buffer) |
Variables | |
static int * | number |
static int * | smallest |
static int * | largest |
static int * | total |
static dbref | cheat_player |
Tree | xcode_tree |
int | global_specials |
SpecialObjectStruct | SpecialObjects [] |
static int debug_check_stuff | ( | Node * | tmp | ) | [static] |
Definition at line 62 of file debug.c.
References bit_size(), SpecialObjectStruct::datasize, GTYPE_MAP, MAP::map, MAP::map_height, MAP::map_width, mech_size(), NodeData, NodeKey, NodeType, notify_printf(), and obj_size().
Referenced by debug_memory().
00063 { 00064 int osize, size, t; 00065 MAP *map; 00066 00067 t = NodeType(tmp); 00068 osize = size = SpecialObjects[t].datasize; 00069 switch (t) { 00070 case GTYPE_MAP: 00071 map = (MAP *) NodeData(tmp); 00072 if(map->map) { 00073 size += sizeof(map->map[0][0]) * map->map_width * map->map_height; 00074 size += bit_size(map); 00075 size += obj_size(map); 00076 size += mech_size(map); 00077 } 00078 break; 00079 } 00080 if(smallest[t] < 0 || size < smallest[t]) 00081 smallest[t] = size; 00082 if(largest[t] < 0 || size > largest[t]) 00083 largest[t] = size; 00084 total[t] += size; 00085 number[t]++; 00086 if(cheat_player > 0 && osize != size) 00087 notify_printf(cheat_player, "#%d: %s (%d bytes)", NodeKey(tmp), 00088 SpecialObjects[t].type, size); 00089 return 1; 00090 }
void debug_list | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 24 of file debug.c.
References args, DumpMaps(), DumpMechs(), and mech_parseattributes().
00025 { 00026 char *args[3]; 00027 int argc; 00028 00029 argc = mech_parseattributes(buffer, args, 3); 00030 if(argc == 0) 00031 return; 00032 else if(args[0][0] == 'M' || args[0][0] == 'm') 00033 if(args[0][1] == 'E' || args[0][1] == 'e') 00034 DumpMechs(player); 00035 if(args[0][1] == 'A' || args[0][1] == 'a') 00036 DumpMaps(player); 00037 }
void debug_loaddb | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 46 of file debug.c.
References LoadSpecialObjects(), and notify.
00047 { 00048 notify(player, "--- Loading ---"); 00049 LoadSpecialObjects(); 00050 notify(player, "--- Done ---"); 00051 }
void debug_memory | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 92 of file debug.c.
References Create, debug_check_stuff(), GoThruTree(), notify_printf(), skipws, and xcode_tree.
00093 { 00094 int i, gtotal = 0; 00095 00096 Create(number, int, global_specials); 00097 Create(smallest, int, global_specials); 00098 Create(largest, int, global_specials); 00099 Create(total, int, global_specials); 00100 00101 for(i = 0; i < global_specials; i++) { 00102 number[i] = 0; 00103 smallest[i] = -1; 00104 largest[i] = -1; 00105 total[i] = 0; 00106 } 00107 cheat_player = player; 00108 skipws(buffer); 00109 if(strcmp(buffer, "")) 00110 cheat_player = player; 00111 else 00112 cheat_player = -1; 00113 GoThruTree(xcode_tree, debug_check_stuff); 00114 for(i = 0; i < global_specials; i++) { 00115 if(number[i]) { 00116 if(smallest[i] == largest[i]) 00117 notify_printf(player, 00118 "%4d %-20s: %d bytes total, %d each", 00119 number[i], SpecialObjects[i].type, total[i], 00120 total[i] / number[i]); 00121 else 00122 notify_printf(player, 00123 "%4d %-20s: %d bytes total, %d avg, %d/%d small/large", 00124 number[i], SpecialObjects[i].type, total[i], 00125 total[i] / number[i], smallest[i], largest[i]); 00126 } 00127 gtotal += total[i]; 00128 } 00129 notify_printf(player, "Grand total: %d bytes.", gtotal); 00130 free((void *) number); 00131 free((void *) total); 00132 free((void *) smallest); 00133 free((void *) largest); 00134 }
void debug_savedb | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 39 of file debug.c.
References DUMP_NORMAL, notify, and SaveSpecialObjects().
00040 { 00041 notify(player, "--- Saving ---"); 00042 SaveSpecialObjects(DUMP_NORMAL); 00043 notify(player, "--- Done ---"); 00044 }
void debug_setvrt | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 177 of file debug.c.
References args, DOCHECK, mech_parseattributes(), and Readnum.
00178 { 00179 char *args[3]; 00180 int vrt; 00181 int id, brand; 00182 00183 DOCHECK(mech_parseattributes(buffer, args, 3) != 2, "Invalid arguments!"); 00184 DOCHECK(Readnum(vrt, args[1]), "Invalid value!"); 00185 DOCHECK(vrt <= 0, "VRT needs to be >0"); 00186 DOCHECK(vrt > 127, "VRT can be at max 127"); 00187 DOCHECK(!find_matching_vlong_part(args[0], NULL, &id, &brand), 00188 "That is no weapon!"); 00189 DOCHECK(!IsWeapon(id), "That is no weapon!"); 00190 MechWeapons[Weapon2I(id)].vrt = vrt; 00191 notify_printf(player, "VRT for %s set to %d.", 00192 MechWeapons[Weapon2I(id)].name, vrt); 00193 log_error(LOG_WIZARD, "WIZ", "CHANGE", "VRT for %s set to %d by #%d", 00194 MechWeapons[Weapon2I(id)].name, vrt, player); 00195 }
void debug_shutdown | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 167 of file debug.c.
References args, mech_parseattributes(), and ShutDownMap().
00168 { 00169 char *args[3]; 00170 int argc; 00171 00172 argc = mech_parseattributes(buffer, args, 3); 00173 if(argc > 0) 00174 ShutDownMap(player, atoi(args[0])); 00175 }
Definition at line 171 of file mux_tree.c.
Referenced by debug_memory(), heartbeat_run(), load_xcode(), mech_remove_from_all_maps(), mech_remove_from_all_maps_except(), SaveSpecialObjects(), UpdateSpecialObjects(), and zap_unneccessary_hcode().
Definition at line 136 of file debug.c.
References FindNode(), MAP::first_free, getMech(), GOD, mech_shutdown(), MechLastX, MechLastY, MAP::mechsOnMap, MechX, MechY, NodeData, notify_printf(), remove_mech_from_map(), and xcode_tree.
Referenced by debug_shutdown(), and map_clearmechs().
00137 { 00138 MAP *map; 00139 MECH *mech; 00140 int j; 00141 Node *tmp; 00142 00143 tmp = FindNode(xcode_tree, mapnumber); 00144 if(tmp) { 00145 map = (MAP *) NodeData(tmp); 00146 for(j = 0; j < map->first_free; j++) 00147 if(map->mechsOnMap[j] != -1) { 00148 mech = getMech(map->mechsOnMap[j]); 00149 if(mech) { 00150 notify_printf(player, 00151 "Shutting down Mech #%d and restting map index to -1....", 00152 map->mechsOnMap[j]); 00153 mech_shutdown(GOD, (void *) mech, ""); 00154 MechLastX(mech) = 0; 00155 MechLastY(mech) = 0; 00156 MechX(mech) = 0; 00157 MechY(mech) = 0; 00158 remove_mech_from_map(map, mech); 00159 } 00160 } 00161 map->first_free = 0; 00162 notify(player, "Map Cleared"); 00163 return; 00164 } 00165 }
dbref cheat_player [static] |
int global_specials |
int* total [static] |
Definition at line 56 of file debug.c.
Referenced by auto_eventstats(), char_rolld6(), fun_die(), mech_weight_sub_mech(), and mech_weight_sub_veh().
Definition at line 98 of file glue.c.
Referenced by debug_memory(), DisposeSpecialObject(), Dump_Mech(), DumpMaps(), FindObjectsNode(), HandledCommand_sub(), heartbeat_run(), load_xcode(), mech_remove_from_all_maps(), mech_remove_from_all_maps_except(), NewSpecialObject(), SaveSpecialObjects(), ShutDownMap(), UpdateSpecialObjects(), and zap_unneccessary_hcode().