--- deliantra/server/common/player.C 2009/01/08 00:54:55 1.50 +++ deliantra/server/common/player.C 2010/01/16 12:33:46 1.61 @@ -1,28 +1,31 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team * Copyright (©) 1992,2007 Frank Tore Johansen * - * Deliantra is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * Deliantra is free software: you can redistribute it and/or modify it under + * the terms of the Affero GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the Affero GNU General Public License + * and the GNU General Public License along with this program. If not, see + * . * * The authors can be reached via e-mail to */ #include +//+GPL + /* Determine if the attacktype represented by the * specified attack-number is enabled for dragon players. * A dragon player (quetzal) can gain resistances for @@ -65,14 +68,14 @@ int wiz = ob->flag [FLAG_WIZ]; /* Eneq(@csd.uu.se): If we have an open container hide it. */ - object *container = ob->container; + object *container = ob->container_ (); ob->container = 0; if (ob->map) maplevel = ob->map->path; -#define PL_OUT(k) freezer.put (KW_ ## k, k) -#define PL_OUT2(k,v) freezer.put (KW_ ## k, v) +#define PL_OUT(k) freezer.put (KW(k), k) +#define PL_OUT2(k,v) freezer.put (KW(k), v) PL_OUT (password); PL_OUT2 (title, own_title); @@ -89,8 +92,8 @@ PL_OUT (outputs_sync); PL_OUT (outputs_count); - freezer.put (KW_usekeys, usekeys == key_inventory ? "key_inventory" : (usekeys == keyrings ? "keyrings" : "containers")); - freezer.put (KW_unapply, unapply == unapply_nochoice ? "unapply_nochoice" : (unapply == unapply_never ? "unapply_never" : "unapply_always")); + freezer.put (KW(usekeys), usekeys == key_inventory ? CS(key_inventory) : (usekeys == keyrings ? CS(keyrings) : CS(containers))); + freezer.put (KW(unapply), unapply == unapply_nochoice ? CS(unapply_nochoice) : (unapply == unapply_never ? CS(unapply_never) : CS(unapply_always))); PL_OUT2 (map, maplevel); PL_OUT (savebed_map); @@ -116,14 +119,11 @@ } freezer.put (ob->contr); - freezer.put (KW_endplst); + freezer.put (KW(endplst)); - SET_FLAG (ob, FLAG_NO_FIX_PLAYER); CLEAR_FLAG (ob, FLAG_WIZ); ob->write (freezer); - CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); - /* Eneq(@csd.uu.se): Reveal the container if we have one. */ ob->container = container; @@ -134,6 +134,8 @@ return true; } +//-GPL + bool player::save_pl (const char *path) { @@ -267,7 +269,7 @@ return 0; } -const char * +const_utf8_string player::killer_name () const { static char buf [2048]; @@ -339,6 +341,9 @@ case '\r': buf << '\n'; + /* \r\n+ becomes one or more newlines */ + while (*cfpod == '\n') + buf << *cfpod++; break; case '\n': @@ -398,6 +403,7 @@ case 'I': pfx = "" ; sfx = "" ; break; case 'U': pfx = "" ; sfx = "" ; break; case 'T': pfx = ""; sfx = ""; break; + case 'Z': pfx = "" ; sfx = "" ; break; case 'H': // hint { @@ -407,17 +413,17 @@ nest.clear (); if (pl->hintmode == 1) - buf << "[Hint suppressed, see hintmode]"; + buf << "[Hint available]"; else - while (*cfpod == ' ') // eat trailing whitespace + while (*cfpod <= ' '&& *cfpod) // eat trailing whitespace ++cfpod; goto skip; } else { - pfx = "["; - sfx = " (Use hintmode to suppress hints)]"; + pfx = "[Hint: "; + sfx = "]"; } } break; @@ -442,6 +448,11 @@ goto skip; } + + default: + pfx = "UNKNOWN_DIRECTIVE{"; + sfx = "}"; + break; } buf << pfx;