Page 1 of 1

Things which doesn't have sense

Posted: Mon Nov 25, 2013 4:17 am
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

Re: Things which doesn't have sense

Posted: Mon Nov 25, 2013 7:12 am
by UnAfraid
What if its overriden by child class?

Re: Things which doesn't have sense

Posted: Mon Nov 25, 2013 9:55 am
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));    } 

Re: Things which doesn't have sense

Posted: Mon Nov 25, 2013 11:53 am
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

Re: Things which doesn't have sense

Posted: Mon Nov 25, 2013 1:21 pm
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.

Re: Things which doesn't have sense

Posted: Mon Nov 25, 2013 2:25 pm
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.