Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Bing, Yandex, Yahoo!

Members: 0
Guests: 18
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] The QUICKMATCH macro is...
Forum Rules | Mark all | Recent Posts

[Bug] The QUICKMATCH macro is no longer desired and is being removed
< Newer Topic :: Older Topic > AFKMud 1.7

Pages:<< prev 1 next >>
Post is unread #1 May 7, 2005, 1:14 am   Last edited Nov 13, 2005, 11:31 am by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: The QUICKMATCH macro is no longer desired and is being removed.
Discovered in: AFKMud 1.7
Danger: None. Preventative measure against future compiler changes.
Found by: Zhamel/Samson
Fixed by: Samson

---

hotboot.c, save_mobile

Locate:
   if( QUICKMATCH( mob->name, mob->pIndexData->player_name ) == 0 )
      fprintf( fp, "Name     %s~\n", mob->name );
   if( QUICKMATCH( mob->short_descr, mob->pIndexData->short_descr ) == 0 )
      fprintf( fp, "Short	%s~\n", mob->short_descr );
   if( QUICKMATCH( mob->long_descr, mob->pIndexData->long_descr ) == 0 )
      fprintf( fp, "Long	%s~\n", mob->long_descr );
   if( QUICKMATCH( mob->chardesc, mob->pIndexData->chardesc ) == 0 )
      fprintf( fp, "Description %s~\n", mob->chardesc );


Replace with:
   if( mob->name && mob->pIndexData->player_name && str_cmp( mob->name, mob->pIndexData->player_name ) )
      fprintf( fp, "Name     %s~\n", mob->name );
   if( mob->short_descr && mob->pIndexData->short_descr && str_cmp( mob->short_descr, mob->pIndexData->short_descr ) )
      fprintf( fp, "Short	%s~\n", mob->short_descr );
   if( mob->long_descr && mob->pIndexData->long_descr && str_cmp( mob->long_descr, mob->pIndexData->long_descr ) )
      fprintf( fp, "Long	%s~\n", mob->long_descr );
   if( mob->chardesc && mob->pIndexData->chardesc && str_cmp( mob->chardesc, mob->pIndexData->chardesc ) )
      fprintf( fp, "Description %s~\n", mob->chardesc );


save.c, fwrite_obj

Locate:
   if( QUICKMATCH( obj->name, obj->pIndexData->name ) == 0 )
      fprintf( fp, "Name         %s~\n", obj->name );
   if( QUICKMATCH( obj->short_descr, obj->pIndexData->short_descr ) == 0 )
      fprintf( fp, "ShortDescr   %s~\n", obj->short_descr );
   if( QUICKMATCH( obj->objdesc, obj->pIndexData->objdesc ) == 0 )
      fprintf( fp, "Description  %s~\n", obj->objdesc );
   if( QUICKMATCH( obj->action_desc, obj->pIndexData->action_desc ) == 0 )
      fprintf( fp, "ActionDesc   %s~\n", obj->action_desc );


Replace with:
   if( obj->name && obj->pIndexData->name && str_cmp( obj->name, obj->pIndexData->name ) )
      fprintf( fp, "Name         %s~\n", obj->name );
   if( obj->short_descr && obj->pIndexData->short_descr && str_cmp( obj->short_descr, obj->pIndexData->short_descr ) )
      fprintf( fp, "ShortDescr   %s~\n", obj->short_descr );
   if( obj->objdesc && obj->pIndexData->objdesc && str_cmp( obj->objdesc, obj->pIndexData->objdesc ) )
      fprintf( fp, "Description  %s~\n", obj->objdesc );
   if( obj->action_desc && obj->pIndexData->action_desc && str_cmp( obj->action_desc, obj->pIndexData->action_desc ) )
      fprintf( fp, "ActionDesc   %s~\n", obj->action_desc );


fwrite_mobile

Locate:
   if( QUICKMATCH( mob->name, mob->pIndexData->player_name ) == 0 )
      fprintf( fp, "Name     %s~\n", mob->name );
   if( QUICKMATCH( mob->short_descr, mob->pIndexData->short_descr ) == 0 )
      fprintf( fp, "Short     %s~\n", mob->short_descr );
   if( QUICKMATCH( mob->long_descr, mob->pIndexData->long_descr ) == 0 )
      fprintf( fp, "Long      %s~\n", mob->long_descr );
   if( QUICKMATCH( mob->chardesc, mob->pIndexData->chardesc ) == 0 )
      fprintf( fp, "Description %s~\n", mob->chardesc );


Replace with:
   if( mob->name && mob->pIndexData->player_name && str_cmp( mob->name, mob->pIndexData->player_name ) )
      fprintf( fp, "Name     %s~\n", mob->name );
   if( mob->short_descr && mob->pIndexData->short_descr && str_cmp( mob->short_descr, mob->pIndexData->short_descr ) )
      fprintf( fp, "Short	%s~\n", mob->short_descr );
   if( mob->long_descr && mob->pIndexData->long_descr && str_cmp( mob->long_descr, mob->pIndexData->long_descr ) )
      fprintf( fp, "Long	%s~\n", mob->long_descr );
   if( mob->chardesc && mob->pIndexData->chardesc && str_cmp( mob->chardesc, mob->pIndexData->chardesc ) )
      fprintf( fp, "Description %s~\n", mob->chardesc );


handler.c, group_object

Locate:
   if( obj1->pIndexData == obj2->pIndexData
    && QUICKMATCH( obj1->name, obj2->name )
    && QUICKMATCH( obj1->short_descr, obj2->short_descr )
    && QUICKMATCH( obj1->objdesc, obj2->objdesc )
    && ( obj1->action_desc && obj2->action_desc && QUICKMATCH( obj1->action_desc, obj2->action_desc ) )
    && QUICKMATCH( obj1->socket[0], obj2->socket[0] )
    && QUICKMATCH( obj1->socket[1], obj2->socket[1] )
    && QUICKMATCH( obj1->socket[2], obj2->socket[2] )
    && obj1->item_type == obj2->item_type
    && xSAME_BITS( obj1->extra_flags, obj2->extra_flags )
    && obj1->magic_flags == obj2->magic_flags
    && obj1->wear_flags == obj2->wear_flags
    && obj1->wear_loc == obj2->wear_loc
    && obj1->weight == obj2->weight
    && obj1->cost == obj2->cost
    && obj1->level == obj2->level
    && obj1->timer == obj2->timer
    && obj1->value[0] == obj2->value[0]
    && obj1->value[1] == obj2->value[1]
    && obj1->value[2] == obj2->value[2]
    && obj1->value[3] == obj2->value[3]
    && obj1->value[4] == obj2->value[4]
    && obj1->value[5] == obj2->value[5]
    && obj1->value[6] == obj2->value[6]
    && obj1->value[7] == obj2->value[7]
    && obj1->value[8] == obj2->value[8]
    && obj1->value[9] == obj2->value[9]
    && obj1->value[10] == obj2->value[10]
    && !obj1->first_extradesc
    && !obj2->first_extradesc
    && !obj1->first_affect
    && !obj2->first_affect
    && !obj1->first_content
    && !obj2->first_content
    && obj1->count + obj2->count > 0
    && obj1->map == obj2->map
    && obj1->x == obj2->x
    && obj1->y == obj2->y
    && QUICKMATCH( obj1->seller, obj2->seller )
    && QUICKMATCH( obj1->buyer, obj2->buyer )
    && obj1->bid == obj2->bid )   /* prevent count overflow */


Replace with:
   if( obj1->pIndexData == obj2->pIndexData
    && ( obj1->name && obj2->name && !str_cmp( obj1->name, obj2->name ) )
    && ( obj1->short_descr && obj2->short_descr && !str_cmp( obj1->short_descr, obj2->short_descr ) )
    && ( obj1->objdesc && obj2->objdesc && !str_cmp( obj1->objdesc, obj2->objdesc ) )
    && ( obj1->action_desc && obj2->action_desc && !str_cmp( obj1->action_desc, obj2->action_desc ) )
    && !str_cmp( obj1->socket[0], obj2->socket[0] )
    && !str_cmp( obj1->socket[1], obj2->socket[1] )
    && !str_cmp( obj1->socket[2], obj2->socket[2] )
    && obj1->item_type == obj2->item_type
    && xSAME_BITS( obj1->extra_flags, obj2->extra_flags )
    && obj1->magic_flags == obj2->magic_flags
    && obj1->wear_flags == obj2->wear_flags
    && obj1->wear_loc == obj2->wear_loc
    && obj1->weight == obj2->weight
    && obj1->cost == obj2->cost
    && obj1->level == obj2->level
    && obj1->timer == obj2->timer
    && obj1->value[0] == obj2->value[0]
    && obj1->value[1] == obj2->value[1]
    && obj1->value[2] == obj2->value[2]
    && obj1->value[3] == obj2->value[3]
    && obj1->value[4] == obj2->value[4]
    && obj1->value[5] == obj2->value[5]
    && obj1->value[6] == obj2->value[6]
    && obj1->value[7] == obj2->value[7]
    && obj1->value[8] == obj2->value[8]
    && obj1->value[9] == obj2->value[9]
    && obj1->value[10] == obj2->value[10]
    && !obj1->first_extradesc && !obj2->first_extradesc
    && !obj1->first_affect && !obj2->first_affect
    && !obj1->first_content && !obj2->first_content
    && obj1->count + obj2->count > 0
    && obj1->map == obj2->map
    && obj1->x == obj2->x
    && obj1->y == obj2->y
    && !str_cmp( obj1->seller, obj2->seller )
    && !str_cmp( obj1->buyer, obj2->buyer )
    && obj1->bid == obj2->bid )   /* prevent count overflow */


mud.h

Find and remove:

#define QUICKMATCH(p1, p2)	(int) (p1) == (int) (p2)


Changes in the GCC4 compiler have made the reliability of the QUICKMATCH macro questionable in the future so preventative measures are being taken now to remove it before it becomes a problem. The str_cmp() function performs the same checks on string data and probably should have been the preferred method all along.
       
Pages:<< prev 1 next >>