… | |
… | |
29 | #include <dirent.h> |
29 | #include <dirent.h> |
30 | |
30 | |
31 | /* Handles misc. input request - things like hash table, malloc, maps, |
31 | /* Handles misc. input request - things like hash table, malloc, maps, |
32 | * who, etc. |
32 | * who, etc. |
33 | */ |
33 | */ |
34 | |
|
|
35 | //TODO |
|
|
36 | #if 0 |
|
|
37 | void |
|
|
38 | map_info (object *op, char *search) |
|
|
39 | { |
|
|
40 | maptile *m; |
|
|
41 | char buf[MAX_BUF], map_path[31]; |
|
|
42 | long sec = time (0); |
|
|
43 | |
|
|
44 | new_draw_info_format (NDI_UNIQUE, 0, op, "Current time is: %02ld:%02ld:%02ld.", (sec % 86400) / 3600, (sec % 3600) / 60, sec % 60); |
|
|
45 | new_draw_info (NDI_UNIQUE, 0, op, "Path Pl PlM IM TO Dif Reset"); |
|
|
46 | |
|
|
47 | for (maps_container::iterator i = maps.begin (); i != maps.end (); ++i) |
|
|
48 | { |
|
|
49 | maptile *m = i->second; |
|
|
50 | |
|
|
51 | if (search && !strstr (m->path, search)) |
|
|
52 | continue; /* Skip unwanted maps */ |
|
|
53 | |
|
|
54 | /* Print out the last 30 characters of the map name... */ |
|
|
55 | strcpy (map_path, m->path + max (0, (int)strlen (m->path) - 30)); |
|
|
56 | |
|
|
57 | sprintf (buf, "%-30.30s %2d %2d %1d %4d %2d %02d:%02d:%02d", |
|
|
58 | map_path, m->players, players_on_map (m, FALSE), |
|
|
59 | m->in_memory, m->timeout, m->difficulty, |
|
|
60 | (m->reset_time % 86400) / 3600, (m->reset_time % 3600) / 60, m->reset_time % 60); |
|
|
61 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
|
|
62 | } |
|
|
63 | } |
|
|
64 | |
|
|
65 | int |
|
|
66 | command_style_map_info (object *op, char *params) |
|
|
67 | { |
|
|
68 | extern maptile *styles; |
|
|
69 | maptile *mp; |
|
|
70 | int maps_used = 0, mapmem = 0, objects_used = 0, x, y; |
|
|
71 | object *tmp; |
|
|
72 | |
|
|
73 | for (mp = styles; mp != NULL; mp = mp->next) |
|
|
74 | { |
|
|
75 | maps_used++; |
|
|
76 | mapmem += mp->width * mp->height * (sizeof (object *) + sizeof (mapspace)) + sizeof (maptile); |
|
|
77 | for (x = 0; x < mp->width; x++) |
|
|
78 | { |
|
|
79 | for (y = 0; y < mp->height; y++) |
|
|
80 | { |
|
|
81 | for (tmp = GET_MAP_OB (mp, x, y); tmp != NULL; tmp = tmp->above) |
|
|
82 | objects_used++; |
|
|
83 | } |
|
|
84 | } |
|
|
85 | } |
|
|
86 | new_draw_info_format (NDI_UNIQUE, 0, op, "Style maps loaded: %d", maps_used); |
|
|
87 | new_draw_info (NDI_UNIQUE, 0, op, "Memory used, not"); |
|
|
88 | new_draw_info_format (NDI_UNIQUE, 0, op, "including objects: %d", mapmem); |
|
|
89 | new_draw_info_format (NDI_UNIQUE, 0, op, "Style objects: %d", objects_used); |
|
|
90 | new_draw_info_format (NDI_UNIQUE, 0, op, "Mem for objects: %d", objects_used * sizeof (object)); |
|
|
91 | return 0; |
|
|
92 | } |
|
|
93 | #endif |
|
|
94 | |
34 | |
95 | /* This command dumps the body information for object *op. |
35 | /* This command dumps the body information for object *op. |
96 | * it doesn't care what the params are. |
36 | * it doesn't care what the params are. |
97 | * This is mostly meant as a debug command. |
37 | * This is mostly meant as a debug command. |
98 | */ |
38 | */ |