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

Comparing deliantra/server/common/object.C (file contents):
Revision 1.338 by root, Fri Jul 2 16:24:24 2010 UTC vs.
Revision 1.343 by root, Sat Apr 23 04:56:46 2011 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,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2001 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 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
274 */ 274 */
275bool object::can_merge_slow (object *ob1, object *ob2) 275bool object::can_merge_slow (object *ob1, object *ob2)
276{ 276{
277 /* A couple quick sanity checks */ 277 /* A couple quick sanity checks */
278 if (ob1 == ob2 278 if (ob1 == ob2
279 || ob1->type != ob2->type 279 || ob1->type != ob2->type
280 || ob1->value != ob2->value 280 || ob1->value != ob2->value
281 || ob1->name != ob2->name 281 || ob1->name != ob2->name
282 || ob1->custom_name != ob2->custom_name
282 || fabs (ob1->speed - ob2->speed) >= MIN_ACTIVE_SPEED) 283 || fabs (ob1->speed - ob2->speed) >= MIN_ACTIVE_SPEED)
283 return 0; 284 return 0;
284 285
285 /* Do not merge objects if nrof would overflow, assume nrof 286 /* Do not merge objects if nrof would overflow, assume nrof
286 * is always 0 .. 2**31-1 */ 287 * is always 0 .. 2**31-1 */
667object::instantiate () 668object::instantiate ()
668{ 669{
669 if (!uuid.seq) // HACK 670 if (!uuid.seq) // HACK
670 uuid = UUID::gen (); 671 uuid = UUID::gen ();
671 672
672 // TODO: unclean state changes, should nt be done in copy_to AND instantiate 673 // TODO: unclean state changes, should not be done in copy_to AND instantiate
673 if (flag [FLAG_RANDOM_SPEED] && speed) 674 if (flag [FLAG_RANDOM_SPEED] && speed)
674 speed_left = - speed - rndm (); // TODO animation 675 speed_left = - speed - rndm (); // TODO animation
675 else 676 else
676 speed_left = -1.; 677 speed_left = -1.;
677 678
1182 1183
1183 if (pl && pl->is_player ()) 1184 if (pl && pl->is_player ())
1184 { 1185 {
1185 if (expect_false (pl->contr->combat_ob == this)) 1186 if (expect_false (pl->contr->combat_ob == this))
1186 { 1187 {
1187 pl->apply (pl->contr->combat_ob, AP_UNAPPLY); 1188 pl->apply (pl->contr->combat_ob, AP_UNAPPLY | AP_IGNORE_CURSE);
1188 pl->contr->combat_ob = 0; 1189 pl->contr->combat_ob = 0;
1189 if (pl->contr->ranged_ob) pl->apply (pl->contr->ranged_ob); 1190 if (pl->contr->ranged_ob) pl->apply (pl->contr->ranged_ob);
1190 } 1191 }
1191 1192
1192 if (expect_false (pl->contr->ranged_ob == this)) 1193 if (expect_false (pl->contr->ranged_ob == this))
1193 { 1194 {
1194 pl->apply (pl->contr->ranged_ob, AP_UNAPPLY); 1195 pl->apply (pl->contr->ranged_ob, AP_UNAPPLY | AP_IGNORE_CURSE);
1195 pl->contr->ranged_ob = 0; 1196 pl->contr->ranged_ob = 0;
1196 if (pl->contr->combat_ob) pl->apply (pl->contr->combat_ob); 1197 if (pl->contr->combat_ob) pl->apply (pl->contr->combat_ob);
1197 } 1198 }
1198 1199
1199 pl->contr->queue_stats_update (); 1200 pl->contr->queue_stats_update ();
2816 return contr->mark; 2817 return contr->mark;
2817 else 2818 else
2818 return 0; 2819 return 0;
2819} 2820}
2820 2821
2822// put marked object first in the inventory
2823// this is used by identify-like spells so players can influence
2824// the order a bit.
2825void
2826object::splay_marked ()
2827{
2828 if (object *marked = mark ())
2829 splay (marked);
2830}
2831

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines