--- deliantra/server/common/arch.C 2006/09/14 21:16:11 1.20 +++ deliantra/server/common/arch.C 2006/11/07 16:30:54 1.25 @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - The authors can be reached via e-mail at crossfire-devel@real-time.com + The authors can be reached via e-mail at */ #include @@ -208,12 +208,8 @@ int item_matched_string (object *pl, object *op, const char *name) { - char * - cp, - local_name[MAX_BUF]; - int - count, - retval = 0; + char *cp, local_name[MAX_BUF]; + int count, retval = 0; strcpy (local_name, name); /* strtok is destructive to name */ @@ -275,7 +271,6 @@ retval = 14; else if (!strncasecmp (cp, query_base_name (op, 1), strlen (cp))) retval = 14; - /* Do substring checks, so things like 'Str+1' will match. * retval of these should perhaps be lower - they are lower * then the specific strcasecmp aboves, but still higher than @@ -287,16 +282,11 @@ retval = 12; else if (strstr (query_short_name (op), cp)) retval = 12; - /* Check against plural/non plural based on count. */ else if (count > 1 && !strcasecmp (cp, op->name_pl)) - { - retval = 6; - } + retval = 6; else if (count == 1 && !strcasecmp (op->name, cp)) - { - retval = 6; - } + retval = 6; /* base name matched - not bad */ else if (strcasecmp (cp, op->name) == 0 && !count) retval = 4; @@ -308,9 +298,11 @@ { if (pl->type == PLAYER) pl->contr->count = count; + return retval; } } + return 0; } @@ -363,8 +355,7 @@ void init_archetable (void) { - archetype * - at; + archetype *at; LOG (llevDebug, " Setting up archetable...\n"); @@ -374,43 +365,11 @@ LOG (llevDebug, "done\n"); } -/* - * Dumps an archetype to debug-level output. - */ - -void -dump_arch (archetype *at) -{ - dump_object (&at->clone); -} - -/* - * Dumps _all_ archetypes to debug-level output. - * If you run crossfire with debug, and enter DM-mode, you can trigger - * this with the O key. - */ - -void -dump_all_archetypes (void) -{ - archetype * - at; - - for (at = first_archetype; at != NULL; at = (at->more == NULL) ? at->next : at->more) - { - dump_arch (at); - fprintf (logfile, "%s\n", errmsg); - } -} - void free_all_archs (void) { - archetype * - at, * - next; - int - i = 0, f = 0; + archetype *at, *next; + int i = 0, f = 0; for (at = first_archetype; at != NULL; at = next) { @@ -445,9 +404,7 @@ void first_arch_pass (object_thawer & fp) { - archetype * - at, * - head = NULL, *last_more = NULL; + archetype *at, *head = NULL, *last_more = NULL; at->clone.arch = first_archetype = at = new archetype; @@ -526,11 +483,8 @@ void second_arch_pass (object_thawer & thawer) { - char - buf[MAX_BUF], * - variable = buf, *argument, *cp; - archetype * - at = NULL, *other; + char buf[MAX_BUF], *variable = buf, *argument, *cp; + archetype *at = NULL, *other; while (fgets (buf, MAX_BUF, thawer) != NULL) { @@ -565,8 +519,7 @@ { if (at != NULL) { - treasurelist * - tl = find_treasurelist (argument); + treasurelist *tl = find_treasurelist (argument); if (tl == NULL) LOG (llevError, "Failed to link treasure to arch (%s): %s\n", &at->name, argument); @@ -581,8 +534,7 @@ void check_generators (void) { - archetype * - at; + archetype *at; for (at = first_archetype; at != NULL; at = at->next) if (QUERY_FLAG (&at->clone, FLAG_GENERATOR) && at->clone.other_arch == NULL) @@ -600,8 +552,7 @@ void load_archetypes (void) { - char - filename[MAX_BUF]; + char filename[MAX_BUF]; #if TIME_ARCH_LOAD struct timeval @@ -649,8 +600,7 @@ object * arch_to_object (archetype *at) { - object * - op; + object *op; if (at == NULL) { @@ -677,7 +627,7 @@ object * create_singularity (const char *name) { - object * op; + object *op; char buf[MAX_BUF]; sprintf (buf, "%s (%s)", ARCH_SINGULARITY, name);