[CF-Devel] Patch submission: item renaming

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Sat Aug 9 01:48:12 CDT 2003


Nicolas Weeger wrote:
>
     
      Hello.
     
     >
     
      As discussed on this list, I implemented item renaming function.
     
     >
     
     
     >
     
      Attached are the patches against current CVS.
     
     >
     
      I think i may be missing some CVS option, since file names aren't that 
     
     >
     
      great it seems...
     
     >
     
      Sorry if patches are messy... decided to make one per modified file, 
     
     >
     
      copied from cvs output.
     
     >
     
     
     >
     
      Here's a short description on how renaming works:
     
     >
     
      * new field in object structure, 'custom_name'. This way custom name 
     
     >
     
      doesn't break anything (slaying, altars, and so on)
     
     >
     
      * mark an item, then 'rename <new name>' to rename it, 'rename' to clean 
     
     >
     
      the custom name
     
     
  To me, that seems pretty bad user interface.

  The client should make this easier.  Eg, I control right click on object (or 
some other combo of unused mouseclick/keypress) to rename an object.  The client 
can then send a command like 'rename <object_tag> <new_name>', and the server 
then looks for an object of object_tag in the players inventory to rename, and 
does so with new name.

  Also, your rename function is dangerous:
   if(params == NULL) {
 >     if(mark->custom_name) FREE_AND_CLEAR_STR(mark->custom_name);
 >     sprintf(buf,"You stop calling your %s with weird 
names.",query_base_name(mark,mark->nrof>1?1:0));
 >   } else {
 >     FREE_AND_COPY(mark->custom_name,params);
 >     sprintf(buf,"Your %s will now be called 
%s.",query_base_name(mark,mark->nrof>1?1:0),params);
 >   }


  since 'params' is user supplied data, very easy for the user to provide data 
that would cause buffer overruns.

  You should really use new_draw_info_format.  Then you don't even need to 
declare buf in that function.


>
     
      * regular name takes precedence over custom name. Thus if i have 'bottle 
     
     >
     
      of wine' and 'haggises' named 'wine', 'mark wine' will mark the bottle 
     
     >
     
      of wine, NOT the haggies. On the other hand 'drop wine' will drop both 
     
     >
     
      bottle & haggises
     
     
  I disagree with that actually.  It seems to me that if I rename something, I 
really consider that name important.

  If a player renames something and in ends up conflicting with other items, 
that is his problem.  But If I call my haggises wine, then whever I use any 
string to options to adjust that item, if I use wine, it should match the 
haggises, which I've specifically renamed to be called that, and not a generic 
object.

  This is unlikely to come up, but it just doesn't seem right to me to treat an 
object the player has renamed as the lowest value in matching order.


_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list