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.237 by root, Tue May 6 21:04:37 2008 UTC vs.
Revision 1.243 by root, Sat May 17 00:17:02 2008 UTC

186 || ob1->speed != ob2->speed 186 || ob1->speed != ob2->speed
187 || ob1->value != ob2->value 187 || ob1->value != ob2->value
188 || ob1->name != ob2->name) 188 || ob1->name != ob2->name)
189 return 0; 189 return 0;
190 190
191 // some objects are unmergable
192 if (!ob1->nrof || !ob2->nrof)
193 return 0;
194
191 /* Do not merge objects if nrof would overflow. First part checks 195 /* Do not merge objects if nrof would overflow. First part checks
192 * for unsigned overflow (2c), second part checks whether the result 196 * for unsigned overflow (2c), second part checks whether the result
193 * would fit into a 32 bit signed int, which is often used to hold 197 * would fit into a 32 bit signed int, which is often used to hold
194 * nrof values. 198 * nrof values.
195 */ 199 */
206 SET_FLAG (ob1, FLAG_BEEN_APPLIED); 210 SET_FLAG (ob1, FLAG_BEEN_APPLIED);
207 211
208 if (QUERY_FLAG (ob2, FLAG_IDENTIFIED)) 212 if (QUERY_FLAG (ob2, FLAG_IDENTIFIED))
209 SET_FLAG (ob2, FLAG_BEEN_APPLIED); 213 SET_FLAG (ob2, FLAG_BEEN_APPLIED);
210 214
211 if (ob1->arch->name != ob2->arch->name 215 if (ob1->arch->archname != ob2->arch->archname
212 || ob1->name != ob2->name 216 || ob1->name != ob2->name
213 || ob1->title != ob2->title 217 || ob1->title != ob2->title
214 || ob1->msg != ob2->msg 218 || ob1->msg != ob2->msg
215 || ob1->weight != ob2->weight 219 || ob1->weight != ob2->weight
216 || ob1->attacktype != ob2->attacktype 220 || ob1->attacktype != ob2->attacktype
217 || ob1->magic != ob2->magic 221 || ob1->magic != ob2->magic
218 || ob1->slaying != ob2->slaying 222 || ob1->slaying != ob2->slaying
219 || ob1->skill != ob2->skill 223 || ob1->skill != ob2->skill
220 || ob1->value != ob2->value 224 || ob1->value != ob2->value
221 || ob1->animation_id != ob2->animation_id 225 || ob1->animation_id != ob2->animation_id
226 || (ob1->face != ob2->face && !ob1->animation_id) // face and animation are dependent on each other
222 || ob1->client_type != ob2->client_type 227 || ob1->client_type != ob2->client_type
223 || ob1->materialname != ob2->materialname 228 || ob1->materialname != ob2->materialname
224 || ob1->lore != ob2->lore 229 || ob1->lore != ob2->lore
225 || ob1->subtype != ob2->subtype 230 || ob1->subtype != ob2->subtype
226 || ob1->move_type != ob2->move_type 231 || ob1->move_type != ob2->move_type
478 */ 483 */
479object * 484object *
480find_object_name (const char *str) 485find_object_name (const char *str)
481{ 486{
482 shstr_cmp str_ (str); 487 shstr_cmp str_ (str);
483 object *op;
484 488
489 if (str_)
485 for_all_objects (op) 490 for_all_objects (op)
486 if (op->name == str_) 491 if (op->name == str_)
487 break; 492 return op;
488 493
489 return op; 494 return 0;
490} 495}
491 496
492/* 497/*
493 * Sets the owner and sets the skill and exp pointers to owner's current 498 * Sets the owner and sets the skill and exp pointers to owner's current
494 * skill and experience objects. 499 * skill and experience objects.
904 * drop on that space. 909 * drop on that space.
905 */ 910 */
906 if (!drop_to_ground 911 if (!drop_to_ground
907 || !map 912 || !map
908 || map->in_memory != MAP_ACTIVE 913 || map->in_memory != MAP_ACTIVE
909 || map->nodrop 914 || map->no_drop
910 || ms ().move_block == MOVE_ALL) 915 || ms ().move_block == MOVE_ALL)
911 { 916 {
912 while (inv) 917 while (inv)
913 { 918 {
914 inv->destroy_inv (false); 919 inv->destroy_inv (false);
943 948
944static struct freed_map : maptile 949static struct freed_map : maptile
945{ 950{
946 freed_map () 951 freed_map ()
947 { 952 {
948 path = "<freed objects map>"; 953 path = "<freed objects map>";
949 name = "/internal/freed_objects_map"; 954 name = "/internal/freed_objects_map";
950 width = 3; 955 width = 3;
951 height = 3; 956 height = 3;
952 nodrop = 1; 957 no_drop = 1;
958 no_reset = 1;
953 959
954 alloc (); 960 alloc ();
955 in_memory = MAP_ACTIVE; 961 in_memory = MAP_ACTIVE;
956 } 962 }
957 963
1309 if (!QUERY_FLAG (op, FLAG_ALIVE)) 1315 if (!QUERY_FLAG (op, FLAG_ALIVE))
1310 CLEAR_FLAG (op, FLAG_NO_STEAL); 1316 CLEAR_FLAG (op, FLAG_NO_STEAL);
1311 1317
1312 if (flag & INS_BELOW_ORIGINATOR) 1318 if (flag & INS_BELOW_ORIGINATOR)
1313 { 1319 {
1314 if (originator->map != op->map || originator->x != op->x || originator->y != op->y || !originator->is_on_map ()) 1320 if (originator->map != op->map || originator->x != op->x || originator->y != op->y)
1315 { 1321 {
1316 LOG (llevError, "insert_ob_in_map called with INS_BELOW_ORIGINATOR when originator not on same space!\n"); 1322 LOG (llevError, "insert_ob_in_map called with INS_BELOW_ORIGINATOR when originator not on same space!\n");
1317 abort (); 1323 abort ();
1318 } 1324 }
1325
1326 if (!originator->is_on_map ())
1327 LOG (llevDebug | logBacktrace, "insert_ob_in_map(%s) called with INS_BELOW_ORIGINATOR when originator '%s' not on map",
1328 op->debug_desc (), originator->debug_desc ());
1319 1329
1320 op->above = originator; 1330 op->above = originator;
1321 op->below = originator->below; 1331 op->below = originator->below;
1322 originator->below = op; 1332 originator->below = op;
1323 1333
1390 } /* If objects on this space */ 1400 } /* If objects on this space */
1391 1401
1392 if (flag & INS_ABOVE_FLOOR_ONLY) 1402 if (flag & INS_ABOVE_FLOOR_ONLY)
1393 top = floor; 1403 top = floor;
1394 1404
1395 /* Top is the object that our object (op) is going to get inserted above. 1405 // insert object above top, or bottom-most if top = 0
1396 */
1397
1398 /* no top found, insert on top */
1399 if (!top) 1406 if (!top)
1400 { 1407 {
1401 op->above = 0; 1408 op->below = 0;
1402 op->below = ms.top; 1409 op->above = ms.bot;
1403 ms.top = op; 1410 ms.bot = op;
1404 1411
1405 *(op->below ? &op->below->above : &ms.bot) = op; 1412 *(op->above ? &op->above->below : &ms.top) = op;
1406 } 1413 }
1407 else 1414 else
1408 { /* get inserted into the stack above top */ 1415 {
1409 op->above = top->above; 1416 op->above = top->above;
1410 top->above = op; 1417 top->above = op;
1411 1418
1412 op->below = top; 1419 op->below = top;
1413 *(op->above ? &op->above->below : &ms.top) = op; 1420 *(op->above ? &op->above->below : &ms.top) = op;
1414 } 1421 }
1415 } /* else not INS_BELOW_ORIGINATOR */ 1422 }
1416 1423
1417 if (op->type == PLAYER) 1424 if (op->type == PLAYER)
1418 { 1425 {
1419 op->contr->do_los = 1; 1426 op->contr->do_los = 1;
1420 ++op->map->players; 1427 ++op->map->players;
2415{ 2422{
2416 char flagdesc[512]; 2423 char flagdesc[512];
2417 char info2[256 * 4]; 2424 char info2[256 * 4];
2418 char *p = info; 2425 char *p = info;
2419 2426
2420 p += snprintf (p, 512, "{cnt:%d,uuid:%s,name:\"%s\"%s%s,flags:[%s],type:%d}", 2427 p += snprintf (p, 512, "{cnt:%d,uuid:%s,name:\"%s\"%s%s%s,flags:[%s],type:%d}",
2421 count, 2428 count,
2422 uuid.c_str (), 2429 uuid.c_str (),
2423 &name, 2430 &name,
2424 title ? "\",title:\"" : "", 2431 title ? ",title:\"" : "",
2425 title ? (const char *)title : "", 2432 title ? (const char *)title : "",
2433 title ? "\"" : "",
2426 flag_desc (flagdesc, 512), type); 2434 flag_desc (flagdesc, 512), type);
2427 2435
2428 if (!flag[FLAG_REMOVED] && env) 2436 if (!flag[FLAG_REMOVED] && env)
2429 p += snprintf (p, 256, "(in %s)", env->debug_desc (info2)); 2437 p += snprintf (p, 256, "(in %s)", env->debug_desc (info2));
2430 2438

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines