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.78 by root, Fri Nov 6 13:03:34 2009 UTC vs.
Revision 1.82 by root, Sat Jan 30 23:30:26 2010 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
21 * 21 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 23 */
24 24
25#include <global.h> 25#include <global.h>
26#include <loader.h>
27#include <sproto.h> 26#include <sproto.h>
28 27
29/* Handles misc. input request - things like hash table, malloc, maps, etc */ 28/* Handles misc. input request - things like hash table, malloc, maps, etc */
30 29
31typedef struct 30typedef struct
209 " Wis %2d\n" 208 " Wis %2d\n"
210 " Cha %2d\n" 209 " Cha %2d\n"
211 " Pow %2d\n" 210 " Pow %2d\n"
212 " wc %d damage %d ac %d\n", 211 " wc %d damage %d ac %d\n",
213 &ob->name, 212 &ob->name,
214 &ob->name, 213 ob->level,
215 ob->stats.hp, ob->stats.maxhp, ob->stats.sp, ob->stats.maxsp, 214 ob->stats.hp, ob->stats.maxhp, ob->stats.sp, ob->stats.maxsp,
216 ob->stats.Str, 215 ob->stats.Str,
217 ob->stats.Dex, 216 ob->stats.Dex,
218 ob->stats.Con, 217 ob->stats.Con,
219 ob->stats.Int, 218 ob->stats.Int,
247 for (int i = 0; i < NROFATTACKS; i++) 246 for (int i = 0; i < NROFATTACKS; i++)
248 if (i != ATNR_INTERNAL) 247 if (i != ATNR_INTERNAL)
249 msg.printf (" %-20s %+4d\n", attacktype_desc [i], op->resist [i]); 248 msg.printf (" %-20s %+4d\n", attacktype_desc [i], op->resist [i]);
250 249
251 /* If dragon player, let's display natural resistances */ 250 /* If dragon player, let's display natural resistances */
252 if (is_dragon_pl (op)) 251 if (op->is_dragon ())
253 for (object *tmp = op->inv; tmp; tmp = tmp->below) 252 for (object *tmp = op->inv; tmp; tmp = tmp->below)
254 if ((tmp->type == FORCE) && tmp->arch->archname == shstr_dragon_skin_force) 253 if ((tmp->type == FORCE) && tmp->arch->archname == shstr_dragon_skin_force)
255 { 254 {
256 msg << "\nOf those, these are natural skin resistances:\n\n"; 255 msg << "\nOf those, these are natural skin resistances:\n\n";
257 256
265 op->contr->infobox (MSG_CHANNEL ("resistances"), msg); 264 op->contr->infobox (MSG_CHANNEL ("resistances"), msg);
266 265
267 return 0; 266 return 0;
268} 267}
269 268
270/*
271 * Actual commands.
272 * Those should be in small separate files (c_object.c, c_wiz.c, cmove.c,...)
273 */
274static int
275onoff_value (const char *line)
276{
277 int i;
278
279 if (sscanf (line, "%d", &i))
280 return (i != 0);
281 switch (line[0])
282 {
283 case 'o':
284 switch (line[1])
285 {
286 case 'n':
287 return 1; /* on */
288 default:
289 return 0; /* o[ff] */
290 }
291 case 'y': /* y[es] */
292 case 'k': /* k[ylla] */
293 case 's':
294 case 'd':
295 return 1;
296 case 'n': /* n[o] */
297 case 'e': /* e[i] */
298 case 'u':
299 default:
300 return 0;
301 }
302}
303
304int 269int
305command_title (object *op, char *params) 270command_title (object *op, char *params)
306{ 271{
307 char buf[MAX_BUF]; 272 char buf[MAX_BUF];
308 273
311 new_draw_info (NDI_UNIQUE, 0, op, "You cannot change your title."); 276 new_draw_info (NDI_UNIQUE, 0, op, "You cannot change your title.");
312 return 1; 277 return 1;
313 } 278 }
314 279
315 /* dragon players cannot change titles */ 280 /* dragon players cannot change titles */
316 if (is_dragon_pl (op)) 281 if (op->is_dragon ())
317 { 282 {
318 new_draw_info (NDI_UNIQUE, 0, op, "Dragons cannot change titles."); 283 new_draw_info (NDI_UNIQUE, 0, op, "Dragons cannot change titles.");
319 return 1; 284 return 1;
320 } 285 }
321 286

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines