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.27 by root, Fri Dec 22 16:34:00 2006 UTC vs.
Revision 1.31 by root, Wed Dec 27 09:28:02 2006 UTC

40 char buf[MAX_BUF], map_path[MAX_BUF]; 40 char buf[MAX_BUF], map_path[MAX_BUF];
41 long sec = time (0); 41 long sec = time (0);
42 42
43 new_draw_info_format (NDI_UNIQUE, 0, op, "Current time is: %02ld:%02ld:%02ld.", (sec % 86400) / 3600, (sec % 3600) / 60, sec % 60); 43 new_draw_info_format (NDI_UNIQUE, 0, op, "Current time is: %02ld:%02ld:%02ld.", (sec % 86400) / 3600, (sec % 3600) / 60, sec % 60);
44 new_draw_info (NDI_UNIQUE, 0, op, "Path Pl PlM IM TO Dif Reset"); 44 new_draw_info (NDI_UNIQUE, 0, op, "Path Pl PlM IM TO Dif Reset");
45 for (m = first_map; m != NULL; m = m->next)
46 {
47 45
46 for_all_maps (m)
47 {
48 if (search && strstr (m->path, search) == NULL) 48 if (search && !strstr (m->path, search))
49 continue; /* Skip unwanted maps */ 49 continue; /* Skip unwanted maps */
50
50 /* Print out the last 18 characters of the map name... */ 51 /* Print out the last 18 characters of the map name... */
51 if (strlen (m->path) <= 18) 52 if (strlen (m->path) <= 18)
52 strcpy (map_path, m->path); 53 strcpy (map_path, m->path);
53 else 54 else
54 strcpy (map_path, m->path + strlen (m->path) - 18); 55 strcpy (map_path, m->path + strlen (m->path) - 18);
56
55 sprintf (buf, "%-18.18s %2d %2d %1d %4d %2d %02d:%02d:%02d", 57 sprintf (buf, "%-18.18s %2d %2d %1d %4d %2d %02d:%02d:%02d",
56 map_path, m->players, players_on_map (m, FALSE), 58 map_path, m->players, players_on_map (m, FALSE),
57 m->in_memory, m->timeout, m->difficulty, 59 m->in_memory, m->timeout, m->difficulty,
58 (MAP_WHEN_RESET (m) % 86400) / 3600, (MAP_WHEN_RESET (m) % 3600) / 60, MAP_WHEN_RESET (m) % 60); 60 (m->reset_time % 86400) / 3600, (m->reset_time % 3600) / 60, m->reset_time % 60);
59 new_draw_info (NDI_UNIQUE, 0, op, buf); 61 new_draw_info (NDI_UNIQUE, 0, op, buf);
60 } 62 }
61} 63}
62 64
63/* This command dumps the body information for object *op. 65/* This command dumps the body information for object *op.
155 157
156 if (QUERY_FLAG (op, FLAG_WIZ)) 158 if (QUERY_FLAG (op, FLAG_WIZ))
157 { 159 {
158 new_draw_info_format (NDI_UNIQUE, 0, op, 160 new_draw_info_format (NDI_UNIQUE, 0, op,
159 "players:%d difficulty:%d size:%dx%d start:%dx%d timeout %ld", 161 "players:%d difficulty:%d size:%dx%d start:%dx%d timeout %ld",
160 m->players, m->difficulty, MAP_WIDTH (m), MAP_HEIGHT (m), MAP_ENTER_X (m), MAP_ENTER_Y (m), MAP_TIMEOUT (m)); 162 m->players, m->difficulty, m->width, m->height, m->enter_x, m->enter_y, m->timeout);
161 163
162 } 164 }
163 if (m->msg) 165 if (m->msg)
164 new_draw_info (NDI_UNIQUE, NDI_NAVY, op, m->msg); 166 new_draw_info (NDI_UNIQUE, NDI_NAVY, op, m->msg);
165} 167}
192 */ 194 */
193 for (reg = first_region; reg != NULL; reg = reg->next) 195 for (reg = first_region; reg != NULL; reg = reg->next)
194 { 196 {
195 reg->counter = 0; 197 reg->counter = 0;
196 } 198 }
197 for (pl = first_player; pl != NULL; pl = pl->next) 199 for_all_players (pl)
198 if (pl->ob->map != NULL) 200 if (pl->ob->map != NULL)
199 get_region_by_map (pl->ob->map)->counter++; 201 get_region_by_map (pl->ob->map)->counter++;
200 202
201 /* we only want to print out by places with a 'longname' field... */ 203 /* we only want to print out by places with a 'longname' field... */
202 for (reg = first_region; reg != NULL; reg = reg->next) 204 for (reg = first_region; reg != NULL; reg = reg->next)
226} chars_names; 228} chars_names;
227 229
228int 230int
229command_afk (object *op, char *params) 231command_afk (object *op, char *params)
230{ 232{
231 if (QUERY_FLAG (op, FLAG_AFK)) 233 if ((op->contr->ns->afk = !op->contr->ns->afk))
232 {
233 CLEAR_FLAG (op, FLAG_AFK);
234 new_draw_info (NDI_UNIQUE, 0, op, "You are no longer AFK"); 234 new_draw_info (NDI_UNIQUE, 0, op, "You are no longer AFK");
235 }
236 else 235 else
237 {
238 SET_FLAG (op, FLAG_AFK);
239 new_draw_info (NDI_UNIQUE, 0, op, "You are now AFK"); 236 new_draw_info (NDI_UNIQUE, 0, op, "You are now AFK");
240 }
241 237
242 return 1; 238 return 1;
243} 239}
244 240
245int 241int
1334 object *tmp; 1330 object *tmp;
1335 1331
1336 for (mp = styles; mp != NULL; mp = mp->next) 1332 for (mp = styles; mp != NULL; mp = mp->next)
1337 { 1333 {
1338 maps_used++; 1334 maps_used++;
1339 mapmem += MAP_WIDTH (mp) * MAP_HEIGHT (mp) * (sizeof (object *) + sizeof (mapspace)) + sizeof (maptile); 1335 mapmem += mp->width * mp->height * (sizeof (object *) + sizeof (mapspace)) + sizeof (maptile);
1340 for (x = 0; x < MAP_WIDTH (mp); x++) 1336 for (x = 0; x < mp->width; x++)
1341 { 1337 {
1342 for (y = 0; y < MAP_HEIGHT (mp); y++) 1338 for (y = 0; y < mp->height; y++)
1343 { 1339 {
1344 for (tmp = GET_MAP_OB (mp, x, y); tmp != NULL; tmp = tmp->above) 1340 for (tmp = GET_MAP_OB (mp, x, y); tmp != NULL; tmp = tmp->above)
1345 objects_used++; 1341 objects_used++;
1346 } 1342 }
1347 } 1343 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines