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

Comparing deliantra/server/common/arch.C (file contents):
Revision 1.64 by root, Tue Jun 5 13:05:02 2007 UTC vs.
Revision 1.66 by root, Thu Jun 7 19:12:22 2007 UTC

69find_archetype_by_object_name (const char *name) 69find_archetype_by_object_name (const char *name)
70{ 70{
71 shstr_cmp name_cmp (name); 71 shstr_cmp name_cmp (name);
72 72
73 for_all_archetypes (at) 73 for_all_archetypes (at)
74 if (at->archname == name_cmp) 74 if (at->name == name_cmp)
75 return at; 75 return at;
76 76
77 return 0; 77 return 0;
78} 78}
79 79
86find_archetype_by_object_type_name (int type, const char *name) 86find_archetype_by_object_type_name (int type, const char *name)
87{ 87{
88 shstr_cmp name_cmp (name); 88 shstr_cmp name_cmp (name);
89 89
90 for_all_archetypes (at) 90 for_all_archetypes (at)
91 if (at->archname == name_cmp && at->type == type) 91 if (at->name == name_cmp && at->type == type)
92 return at; 92 return at;
93 93
94 return 0; 94 return 0;
95} 95}
96 96
157 } 157 }
158 158
159 return create_singularity (name); 159 return create_singularity (name);
160} 160}
161 161
162 /* This is a subset of the parse_id command. Basically, name can be 162/* This is a subset of the parse_id command. Basically, name can be
163 * a string seperated lists of things to match, with certain keywords. 163 * a string seperated lists of things to match, with certain keywords.
164 * pl is the player (only needed to set count properly) 164 * pl is the player (only needed to set count properly)
165 * op is the item we are trying to match. Calling function takes care 165 * op is the item we are trying to match. Calling function takes care
166 * of what action might need to be done and if it is valid 166 * of what action might need to be done and if it is valid
167 * (pickup, drop, etc.) Return NONZERO if we have a match. A higher 167 * (pickup, drop, etc.) Return NONZERO if we have a match. A higher
168 * value means a better match. 0 means no match. 168 * value means a better match. 0 means no match.
169 * 169 *
170 * Brief outline of the procedure: 170 * Brief outline of the procedure:
171 * We take apart the name variable into the individual components. 171 * We take apart the name variable into the individual components.
172 * cases for 'all' and unpaid are pretty obvious. 172 * cases for 'all' and unpaid are pretty obvious.
173 * Next, we check for a count (either specified in name, or in the 173 * Next, we check for a count (either specified in name, or in the
174 * player object.) 174 * player object.)
175 * If count is 1, make a quick check on the name. 175 * If count is 1, make a quick check on the name.
176 * IF count is >1, we need to make plural name. Return if match. 176 * IF count is >1, we need to make plural name. Return if match.
177 * Last, make a check on the full name. 177 * Last, make a check on the full name.
178 */ 178 */
179int 179int
180item_matched_string (object *pl, object *op, const char *name) 180item_matched_string (object *pl, object *op, const char *name)
181{ 181{
182 char *cp, local_name[MAX_BUF]; 182 char *cp, local_name[MAX_BUF];
183 int count, retval = 0; 183 int count, retval = 0;
514 * an object, and never NULL. 514 * an object, and never NULL.
515 */ 515 */
516object * 516object *
517create_singularity (const char *name) 517create_singularity (const char *name)
518{ 518{
519 object *op; 519 LOG (llevError | logBacktrace, "FATAL: creating singularity for '%s'.\n", name);
520
521 if (!strcmp (name, "bug"))
522 abort ();
523
520 char buf[MAX_BUF]; 524 char buf[MAX_BUF];
525 sprintf (buf, "bug, please report (%s)", name);
521 526
522 sprintf (buf, "%s (%s)", ARCH_SINGULARITY, name); 527 object *op = get_archetype ("bug");
523 op = object::create ();
524 op->name = op->name_pl = buf; 528 op->name = op->name_pl = buf;
525 SET_FLAG (op, FLAG_NO_PICK); 529
526 return op; 530 return op;
527} 531}
528 532
529/* 533/*
530 * Finds which archetype matches the given name, and returns a new 534 * Finds which archetype matches the given name, and returns a new

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines