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.291 by root, Mon Oct 12 14:00:57 2009 UTC vs.
Revision 1.294 by root, Thu Nov 5 15:43:21 2009 UTC

37static const uint64 UUID_GAP = 1<<19; 37static const uint64 UUID_GAP = 1<<19;
38uint32_t mapspace::smellcount = 10000; 38uint32_t mapspace::smellcount = 10000;
39 39
40objectvec objects; 40objectvec objects;
41activevec actives; 41activevec actives;
42
43//+GPL
42 44
43short freearr_x[SIZEOFFREE] = { 45short freearr_x[SIZEOFFREE] = {
44 0, 46 0,
45 0, 1, 1, 1, 0, -1, -1, -1, 47 0, 1, 1, 1, 0, -1, -1, -1,
46 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 48 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1,
335 337
336 // the player itself is always on a map, so we will find him here 338 // the player itself is always on a map, so we will find him here
337 // even if our inv is in a player. 339 // even if our inv is in a player.
338 if (envest->is_on_map ()) 340 if (envest->is_on_map ())
339 if (object *pl = envest->ms ().player ()) 341 if (object *pl = envest->ms ().player ())
340 if (pl->container == env) 342 if (pl->container_ () == env)
341 return pl; 343 return pl;
342 } 344 }
343 else 345 else
344 { 346 {
345 // maybe there is a player standing on the same mapspace 347 // maybe there is a player standing on the same mapspace
346 // this will catch the case where "this" is a player 348 // this will catch the case where "this" is a player
347 if (object *pl = ms ().player ()) 349 if (object *pl = ms ().player ())
348 if ((!pl->container && pl->contr->ns && !pl->contr->ns->update_look) 350 if ((pl->contr->ns && !pl->container_ () && !pl->contr->ns->update_look)
349 || this == pl->container) 351 || pl->container_ () == this)
350 return pl; 352 return pl;
351 } 353 }
352 } 354 }
353 355
354 return 0; 356 return 0;
1041 * the previous environment. 1043 * the previous environment.
1042 */ 1044 */
1043void 1045void
1044object::do_remove () 1046object::do_remove ()
1045{ 1047{
1046 object *tmp, *last = 0;
1047 object *otmp;
1048
1049 if (flag [FLAG_REMOVED]) 1048 if (flag [FLAG_REMOVED])
1050 return; 1049 return;
1051 1050
1052 INVOKE_OBJECT (REMOVE, this); 1051 INVOKE_OBJECT (REMOVE, this);
1053 1052
1119 close_container (); 1118 close_container ();
1120 1119
1121 --map->players; 1120 --map->players;
1122 map->touch (); 1121 map->touch ();
1123 } 1122 }
1124 else if (pl->container == this) 1123 else if (pl->container_ () == this)
1125 { 1124 {
1126 // removing a container should close it 1125 // removing a container should close it
1127 close_container (); 1126 close_container ();
1128 } 1127 }
1129 1128
1145 1144
1146 int check_walk_off = !flag [FLAG_NO_APPLY]; 1145 int check_walk_off = !flag [FLAG_NO_APPLY];
1147 1146
1148 if (object *pl = ms.player ()) 1147 if (object *pl = ms.player ())
1149 { 1148 {
1150 if (pl->container == this) 1149 if (pl->container_ () == this)
1151 /* If a container that the player is currently using somehow gets 1150 /* If a container that the player is currently using somehow gets
1152 * removed (most likely destroyed), update the player view 1151 * removed (most likely destroyed), update the player view
1153 * appropriately. 1152 * appropriately.
1154 */ 1153 */
1155 pl->close_container (); 1154 pl->close_container ();
1159 //TODO: update floorbox to preserve ordering 1158 //TODO: update floorbox to preserve ordering
1160 if (pl->contr->ns) 1159 if (pl->contr->ns)
1161 pl->contr->ns->floorbox_update (); 1160 pl->contr->ns->floorbox_update ();
1162 } 1161 }
1163 1162
1163 if (check_walk_off)
1164 for (tmp = ms.bot; tmp; tmp = tmp->above) 1164 for (object *above, *tmp = ms.bot; tmp; tmp = above)
1165 { 1165 {
1166 above = tmp->above;
1167
1166 /* No point updating the players look faces if he is the object 1168 /* No point updating the players look faces if he is the object
1167 * being removed. 1169 * being removed.
1168 */ 1170 */
1169 1171
1170 /* See if object moving off should effect something */ 1172 /* See if object moving off should effect something */
1171 if (check_walk_off
1172 && ((move_type & tmp->move_off) 1173 if ((move_type & tmp->move_off)
1173 && (move_type & ~tmp->move_off & ~tmp->move_block) == 0)) 1174 && (move_type & ~tmp->move_off & ~tmp->move_block) == 0)
1174 {
1175 move_apply (tmp, this, 0); 1175 move_apply (tmp, this, 0);
1176
1177 if (destroyed ())
1178 LOG (llevError, "BUG: remove_ob(): name %s, destroyed leaving object\n", tmp->debug_desc ());
1179 } 1176 }
1180
1181 last = tmp;
1182 }
1183 1177
1184 if (affects_los ()) 1178 if (affects_los ())
1185 update_all_los (map, x, y); 1179 update_all_los (map, x, y);
1186 } 1180 }
1187} 1181}
2548 return splay (tmp); 2542 return splay (tmp);
2549 2543
2550 return 0; 2544 return 0;
2551} 2545}
2552 2546
2547//-GPL
2548
2553void 2549void
2554object::force_set_timer (int duration) 2550object::force_set_timer (int duration)
2555{ 2551{
2556 this->duration = 1; 2552 this->duration = 1;
2557 this->speed_left = -1.f; 2553 this->speed_left = -1.f;
2566 force->destroy (); 2562 force->destroy ();
2567 2563
2568 object *force = get_archetype (FORCE_NAME); 2564 object *force = get_archetype (FORCE_NAME);
2569 2565
2570 force->slaying = name; 2566 force->slaying = name;
2571
2572 force->force_set_timer (duration); 2567 force->force_set_timer (duration);
2573
2574 force->flag [FLAG_APPLIED] = true; 2568 force->flag [FLAG_APPLIED] = true;
2575 2569
2576 return insert (force); 2570 return insert (force);
2577} 2571}
2578 2572
2579void 2573void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines