From: "Mathew Earle Reuther" <graymere@ZIPCON.NET>
> And, i have no idea why, but at first glance it looks like only words
> that are both in the namelist and the short desc work . . . of course, I'm
> not entirely positive on that as it's difficult to test with all the
> editing of things that needs to be done, but that's first assumption.
>
sorry, wrong assumption. As it's obvious in the code you've supplied
(which is all that is needed and very nice for a bug report :), the
assemblyFindAssembly() func runs through the list of assemblies until
it finds _the first_ with a matching alias. Then it immediately
returns this, regardless if it's the one you're after.
<snip>
> Then the function which takes the argument and checks for a match:
> long assemblyFindAssembly( const char *pszAssemblyName )
> {
> long i = 0;
> long lRnum = NOTHING;
>
> if( g_pAssemblyTable == NULL )
> return (-1);
> else if( pszAssemblyName == NULL || *pszAssemblyName == '\0' )
> return (-1);
>
Of course they now should return NOTHING, and there should be a check for
that in the calling function. Never mind, though. What you want is to
do the loop twice:
for( i = 0; i < g_lNumAssemblies; i++ )
{
if( (lRnum = real_object( g_pAssemblyTable[ i ].lVnum )) < 0 )
log( "SYSERR: assemblyFindAssembly(): Invalid vnum #%ld in assembly
table.", g_pAssemblyTable[i].lVnum );
else if( !strncmp( pszAssemblyName,
obj_proto[ lRnum ].shortdesc,
strlen(pszAssemblyName) ) )
return (g_pAssemblyTable[ i ].lVnum);
}
> for( i = 0; i < g_lNumAssemblies; i++ )
> {
> if( (lRnum = real_object( g_pAssemblyTable[ i ].lVnum )) < 0 )
> log( "SYSERR: assemblyFindAssembly(): Invalid vnum #%ld in assembly
> table.", g_pAssemblyTable[i].lVnum );
> else if( isname( pszAssemblyName, obj_proto[ lRnum ].name ) )
> return (g_pAssemblyTable[ i ].lVnum);
> }
>
> return (-1);
> }
>
Now, if you type
brew flagon of red
it'll first search for an object which has a shortdesc starting with
'flagon of red' in the assembly list. If none are found it'll check
with isname().
That should do it - after all, it's a tight loop, and you don't go
assembling all the time, so the extra loop shouldn't slow you down too
much.
Welcor
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT