[CF-Devel] Alchemy exploit

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Thu Aug 19 02:19:58 CDT 2004


>
     
      1) It seems there is a debug new_draw_info_format left in that prints the
     
     >
     
      results of value of the item - presumably that needs to be removed.
     
     
Yes, I missed that one.


>
     
      2) The block:
     
     [...]
>
     
       I'm not sure if it will actually compile of ALCHEMY_DEBUG is not defined,
     
     >
     
       as there is then just an empty if () else statement.  This can pretty easily
     
     >
     
      be solved by just putting {} in the right places, as an empty block should
     
     >
     
      be OK. Wonder if it might also be good to put some message as to why it
     
     >
     
      failed.
     
     
I fixed that and included the old and new prices in the debug message.


>
     
      3) use of any 'long' or 'unsigned long' variables is discouraged, as past
     
     >
     
      experience has shown that there is no guarantee if these will be 64 or 32
     
     >
     
      bit values.  Instead use the uint32 or uint64 types, depending on what you
     
     >
     
      need (maybe this has been clarified in more recent versions of the C
     
     >
     
      standard).  But in any case, use of the uint/sint types is still preferred -
     
     >
     
      I note that object.h defines nrof as a uint32.
     
     
I changed the variables to uint32 type. But now I need a type cast in
the call to LOG(): LOG(..., "...%lu...", (unsigned long)value_item, ...)
because "%lu" wants an unsigned long.


Unfortunately, I found another problem with my patch: after doing
alchemy, the resulting item is not identified and (always?) cursed.
Therefore query_cost() returns a value much less than a player would
actually get for that item.

So I need a means to pretend the item to be identified and not be cursed
to calculate the price for it. I could imagine two alternatives for
doing that:

a) temporarily change the item flags, call query_cost() and restore the
   flags.

b) add a new flag F_SELL_IDENTIFIED to query_cost() and modify the price
   calculations accordingly.

My preference would be second alternative because temporarily modifying
objects does not make the code easier to understand.

_______________________________________________
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