Jump to content
  • 0

how to fix warning on source?


Hanashi

Question


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  113
  • Reputation:   40
  • Joined:  10/23/13
  • Last Seen:  

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

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

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".

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   345
  • Joined:  02/26/12
  • Last Seen:  

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

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  113
  • Reputation:   40
  • Joined:  10/23/13
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   345
  • Joined:  02/26/12
  • Last Seen:  

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. 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  113
  • Reputation:   40
  • Joined:  10/23/13
  • Last Seen:  

@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

 

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

show your modified code for  pc_getitemfromcart

you must be missing the return value part.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  113
  • Reputation:   40
  • Joined:  10/23/13
  • Last Seen:  

i only base on @dropall command /...

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  113
  • Reputation:   40
  • Joined:  10/23/13
  • Last Seen:  

ok so i'll just add return 0; or return -1 in each line or something?

Edited by AshiHanna
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

you changed to Boolean type. it should only return true / false.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  113
  • Reputation:   40
  • Joined:  10/23/13
  • Last Seen:  

ohh got it thanks :ani_swt3:

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   345
  • Joined:  02/26/12
  • Last Seen:  

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)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  113
  • Reputation:   40
  • Joined:  10/23/13
  • Last Seen:  

already done lmao it has nothing to do with my custom command i just fix the boolean codes of pc_getitemfromcart /heh

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  1096
  • Reputation:   345
  • Joined:  02/26/12
  • Last Seen:  

ok then =) 

Link to comment
Share on other sites

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.

×
×
  • Create New...