does it make any sense

This is a discussion on does it make any sense within the C++ Programming forums, part of the General Programming Boards category; Code: void AddItem(int A) { int B; amount += A; if( amount < stackSize ) { B = amount - ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    84

    does it make any sense

    Code:
    	void AddItem(int A)
    	{
    		int B;
            amount += A;
    
    		if( amount < stackSize )
    		{
    			B = amount - stackSize;
    			GetItem(B)
    		}
    	}
    
        void GetItem(int A)
    	{
    		for( int iii=0; iii != MAX_INV; iii++)
    
    			if( charInv[iii].id == 0 )
    			{ 
    				charInv[iii] = *this; 
    				charInv[iii].additem(A); 
    				break;
    			}
    
    			else if( charInv[iii].id == id)
    				if( charInv[iii].amount < stackSize)
    				{ 
    					charInv[iii].AddItem(A); 
    					break;
    				}
    	}
    does this code make any sense?

    what i tried to do here is when u get item the prog' look for empty slots if it finds one it copies the item into the empty slot if it find a slot with the same item and the and there's still stacksize left it adds the item amount to the item (uses different prog') if the amount passe the stacksize then it reads by how much it passed it and then subscribes it from the amount and then calls the GetItem prog' to put it in new slot, it won't put it on the same slot because of the condition statement
    Last edited by ExDHaos; 05-23-2009 at 09:21 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Does this even remotely make sense
    By hckr83 in forum C Programming
    Replies: 6
    Last Post: 12-23-2005, 05:02 PM
  2. want to make this small program...
    By psycho88 in forum C++ Programming
    Replies: 8
    Last Post: 11-30-2005, 02:05 AM
  3. Question about atheists
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 08-11-2003, 12:50 PM
  4. 'functions' in make?
    By mart_man00 in forum C Programming
    Replies: 1
    Last Post: 06-21-2003, 03:16 PM
  5. Foreigners don't make sense
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 04-25-2002, 03:31 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21