Things which doesn't have sense

If something doesn't fit in any other forum then post it here.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
ksrz
Posts: 3
Joined: Thu Jan 05, 2012 2:41 am

Things which doesn't have sense

Post by ksrz »

Rev: 5339 - 2012/05/12 [Interlude]
i was looking for a function to return the item type, after a little research i found this one:
public boolean isConsumable()
{
return false;
}

haha that's funny, it's like, "hey, can i consume that? [NO]" xDD
User avatar
UnAfraid
L2j Veteran
L2j Veteran
Posts: 4199
Joined: Mon Jul 23, 2007 4:25 pm
Location: Bulgaria
Contact:

Re: Things which doesn't have sense

Post by UnAfraid »

What if its overriden by child class?
Image
User avatar
BiggBoss
L2j Veteran
L2j Veteran
Posts: 1104
Joined: Wed Apr 15, 2009 3:11 pm
Location: Spain

Re: Things which doesn't have sense

Post by BiggBoss »

an example :P

http://svn.l2jserver.com/branches/L2_Ga ... cItem.java

Code: Select all

  @Override    public final boolean isConsumable()    {        return ((getItemType() == L2EtcItemType.SHOT) || (getItemType() == L2EtcItemType.POTION)); // || (type == L2EtcItemType.SCROLL));    } 
Image
ksrz
Posts: 3
Joined: Thu Jan 05, 2012 2:41 am

Re: Things which doesn't have sense

Post by ksrz »

yeah, know, but i usually do:


-------------
....
var _isConsumable = false;

fn public/protected bool IsConsumable(){ return _isConsumable; }
fn public/protected void IsConsumable(bool b){ _isConsumable = b; }
...
--------------

pd. there is no reason to offend any of the developers.
just 2 different ways to do something, and on my mind was funny in pseudo-code :D
User avatar
UnAfraid
L2j Veteran
L2j Veteran
Posts: 4199
Joined: Mon Jul 23, 2007 4:25 pm
Location: Bulgaria
Contact:

Re: Things which doesn't have sense

Post by UnAfraid »

What if you have thousands of instances of that class u gonna allocate variable for each when u need it just for few hundreds.
Image
ksrz
Posts: 3
Joined: Thu Jan 05, 2012 2:41 am

Re: Things which doesn't have sense

Post by ksrz »

bool = 1byte, why not?
Anyway, the purpose of this topic is not to offend anyone.
- I apologize to those i have offended, it is not intended.
Post Reply