ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_misc.C
(Generate patch)

Comparing deliantra/server/server/c_misc.C (file contents):
Revision 1.36 by pippijn, Mon Jan 15 21:06:19 2007 UTC vs.
Revision 1.37 by root, Wed Jan 17 22:13:10 2007 UTC

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
37void
38map_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
65int
66command_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 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines