--- deliantra/server/common/object.C 2009/10/03 20:11:12 1.287
+++ deliantra/server/common/object.C 2009/10/19 21:48:49 1.292
@@ -5,18 +5,19 @@
* Copyright (©) 2001,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
*/
@@ -336,7 +337,7 @@
// even if our inv is in a player.
if (envest->is_on_map ())
if (object *pl = envest->ms ().player ())
- if (pl->container == env)
+ if (pl->container_ () == env)
return pl;
}
else
@@ -344,8 +345,8 @@
// maybe there is a player standing on the same mapspace
// this will catch the case where "this" is a player
if (object *pl = ms ().player ())
- if ((!pl->container && pl->contr->ns && !pl->contr->ns->update_look)
- || this == pl->container)
+ if ((pl->contr->ns && !pl->container_ () && !pl->contr->ns->update_look)
+ || pl->container_ () == this)
return pl;
}
}
@@ -433,6 +434,12 @@
return freezer.as_string ();
}
+char *
+object::as_string ()
+{
+ return dump_object (this);
+}
+
/*
* get_nearest_part(multi-object, object 2) returns the part of the
* multi-object 1 which is closest to the second object.
@@ -557,7 +564,8 @@
new_draw_info_format (NDI_UNIQUE, 0, this,
"You try to balance all your items at once, "
"but the %s is just too much for your body. "
- "[You need to unapply some items first.]", &ob->name);
+ "[You need to unapply some items first - use the 'body' command to see "
+ "how many items you cna wera on a specific body part.]", &ob->name);
return false;
}
@@ -1113,7 +1121,7 @@
--map->players;
map->touch ();
}
- else if (pl->container == this)
+ else if (pl->container_ () == this)
{
// removing a container should close it
close_container ();
@@ -1139,7 +1147,7 @@
if (object *pl = ms.player ())
{
- if (pl->container == this)
+ if (pl->container_ () == this)
/* If a container that the player is currently using somehow gets
* removed (most likely destroyed), update the player view
* appropriately.
@@ -2542,6 +2550,15 @@
return 0;
}
+void
+object::force_set_timer (int duration)
+{
+ this->duration = 1;
+ this->speed_left = -1.f;
+
+ this->set_speed (duration ? 1.f / duration : 0.f);
+}
+
object *
object::force_add (shstr_tmp name, int duration)
{
@@ -2550,12 +2567,10 @@
object *force = get_archetype (FORCE_NAME);
- force->slaying = name;
- force->stats.food = 1;
- force->speed_left = -1.f;
+ force->slaying = name;
+
+ force->force_set_timer (duration);
- force->set_speed (duration ? 1.f / duration : 0.f);
- force->flag [FLAG_IS_USED_UP] = true;
force->flag [FLAG_APPLIED] = true;
return insert (force);