[crossfire] Error output for non-working bank deposit

Andreas Kirschbaum kirschbaum at myrealbox.com
Sun Feb 20 10:47:57 CST 2005


Rick Tanner wrote:
>
     
      On crossfire.metalforge.net, I'm seeing the following error when players
     
     >
     
      try to deposit gold coins at the Scorn bank.
     
     [...]
>
     
        File "/home/crossfire/share/crossfire/maps/python/IPO/banksay.py", line 64, in ?
     
     >
     
          if (CFPython.PayAmount(activator, (int(text[1])*exchange_rate)*fees)):
     
     >
     
      SystemError: Objects/longobject.c:689: bad argument to internal function
     
     
The problem seems to be that a float is passed to PayAmount() (which
expects an integer). After adding an explicit type cast (see attached
patch), it did work for me again.
-------------- next part --------------
Index: python/IPO/banksay.py
===================================================================
RCS file: /cvsroot/crossfire/maps-bigworld/python/IPO/banksay.py,v
retrieving revision 1.8
diff -w -c -5 -r1.8 banksay.py
*** python/IPO/banksay.py	6 Dec 2004 04:48:05 -0000	1.8
--- python/IPO/banksay.py	13 Feb 2005 15:19:55 -0000
***************
*** 59,69 ****
                    \nA service charge of %d percent will be placed on all deposits' \
  		%(service_charge)
  
  elif text[0] == 'deposit':
  	if len(text)==2:
! 		if (CFPython.PayAmount(activator, (int(text[1])*exchange_rate)*fees)):
  			bank.deposit(activatorname, int(text[1]))
  			message = '%d recieved, %d imperials deposited to bank account.  %s' \
  			%((int(text[1])*(exchange_rate/50))*fees,int(text[1]),random.choice(thanks_message))
  		else:
  			message = 'You would need %d gold'%((int(text[1])*(exchange_rate/10))*fees)
--- 59,69 ----
                    \nA service charge of %d percent will be placed on all deposits' \
  		%(service_charge)
  
  elif text[0] == 'deposit':
  	if len(text)==2:
! 		if (CFPython.PayAmount(activator, int((int(text[1])*exchange_rate)*fees))):
  			bank.deposit(activatorname, int(text[1]))
  			message = '%d recieved, %d imperials deposited to bank account.  %s' \
  			%((int(text[1])*(exchange_rate/50))*fees,int(text[1]),random.choice(thanks_message))
  		else:
  			message = 'You would need %d gold'%((int(text[1])*(exchange_rate/10))*fees)
    
    


More information about the crossfire mailing list