Jump to content
  • 0

how to fix warning on source?


Question

Posted

i tried to change void to bool on pc_getitemfromcart in pc.c and pc.h

but it gives me warning on compiling if i use pc_getitemfromcart on custom @command

13 answers to this question

Recommended Posts

  • 0
Posted
8 minutes ago, AshiHanna said:

i only base on @dropall command /...

This is a support topic, you should have provided the code snippets so that other members can help you check/fix the issue.

Otherwise, everyone are just guessing your issue based on the outcome. 

 

On 11/7/2016 at 8:27 PM, AshiHanna said:
3>c:\users\my\desktop\ragnarok\rathena\src\map\pc.c(5162): warning C4033: 'pc_getitemfromcart' must return a value
3>c:\users\my\desktop\ragnarok\rathena\src\map\pc.c(5165): warning C4033: 'pc_getitemfromcart' must return a value
3>c:\users\my\desktop\ragnarok\rathena\src\map\pc.c(5170): warning C4033: 'pc_getitemfromcart' must return a value
3>c:\users\my\desktop\ragnarok\rathena\src\map\pc.c(5177): warning C4716: 'pc_getitemfromcart': must return a value

So based on your topic, the answer would be "Add in the missing return statement/line".

 

  • 0
Posted (edited)

where is your warning? can you please show warning message, and function with saving lines which trigger the error.

return 0; }

/*==========================================
where it transfer cart items to inventory
==========================================*/
ACMD_FUNC(inventorycart)
{
	int8 type = -1;
	uint16 i, count = 0, count2 = 0;
	struct item_data *item_data = NULL;

	nullpo_retr(-1, sd);
	
	if( message[0] ) {
		type = atoi(message);
		if( type != -1 && type != IT_HEALING && type != IT_USABLE && type != IT_ETC && type != IT_WEAPON &&
			type != IT_ARMOR && type != IT_CARD && type != IT_PETEGG && type != IT_PETARMOR && type != IT_AMMO )
			return -1;
					}
	if (pc_iscarton(sd) != 0) {
			for( i = 0; i < MAX_CART; i++ ) {
				if( sd->status.cart[i].amount ) {
				if( (item_data = itemdb_exists(sd->status.cart[i].nameid)) == NULL ) {
					ShowDebug("Non-existant item %d on inventoryall list (account_id: %d, char_id: %d)\n", sd->status.cart[i].nameid, sd->status.account_id, sd->status.char_id);
					continue;
												}
				if( type == -1 || type == (uint8)item_data->type ) {
				if(pc_getitemfromcart(sd, i, sd->status.cart[i].amount))
					count += sd->status.cart[i].amount;
				else count2 += sd->status.cart[i].amount;
			}
		}
	}
}
return 0;
}

3>c:\users\my\desktop\ragnarok\rathena\src\map\pc.c(5162): warning C4033: 'pc_getitemfromcart' must return a value
3>c:\users\my\desktop\ragnarok\rathena\src\map\pc.c(5165): warning C4033: 'pc_getitemfromcart' must return a value
3>c:\users\my\desktop\ragnarok\rathena\src\map\pc.c(5170): warning C4033: 'pc_getitemfromcart' must return a value
3>c:\users\my\desktop\ragnarok\rathena\src\map\pc.c(5177): warning C4716: 'pc_getitemfromcart': must return a value
Edited by AshiHanna
  • 0
Posted

Your function above a little bit wrong. You trying to check with if condition that somethings has been returned from void (no return at all) function.

If you will explain to me logic what do you want to get with this command, i will try to help you with this custom command. Because i'm a little bit tired and confused for now and can't understand what do you want in your function. 

  • 0
Posted

@inventorycart {<item type>}

transfer all items from cart to inventory based on the item type.

Valid item types:
    -1 = All Items (default)
     0 = Healing Items
     2 = Useable Items
     3 = Etc Items
     4 = Armors
     5 = Weapons
     6 = Cards
     7 = Pet Eggs
     8 = Pet Armors
     10 = Ammunition Items

example: you want to transfer all healing items from cart to inventory

@inventorycart 0

 

  • 0
Posted
1 hour ago, AshiHanna said:

@inventorycart {<item type>}

transfer all items from cart to inventory based on the item type.

Valid item types:
    -1 = All Items (default)
     0 = Healing Items
     2 = Useable Items
     3 = Etc Items
     4 = Armors
     5 = Weapons
     6 = Cards
     7 = Pet Eggs
     8 = Pet Armors
     10 = Ammunition Items

example: you want to transfer all healing items from cart to inventory

@inventorycart 0

 

 

oODJZND.png

I will send here this command when it will be ready (it will take some time, don't wait for it today)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...