02-20-2018, 10:51 AM
(This post was last modified: 02-20-2018, 11:14 AM by robocat04.
Edit Reason: Note on pull request
)
UPDATE: there's something I didn't noticed in the first place. @melex750 already fixed this issue using setters and getters. More info is here.
Quote:That's what singleton would fix.Even if it's not being destroyed by garbage collector by itself after returning from the function, shouldn't "instance = null;" be enough to throw it into bin then?
Quote:Though, do you even operate on the values in Camps?I sure do. And it seems as though changing them is what causes the game to crash, because LvlCntlr_main reads them all the time from the very beginning of the game, and does it without crashes. That is, unless regular creation of new instance of Camps in Rdata_set or something else is to be blamed.
Quote:I wanted to convert Camps to singleton, but I have problems with making a static method for getInstance(). Oo' CBOT environment in the game says "Type declaration missing" if I add "static" and that's strange because I didn't remove anything.It seems that in CBOT there is no way to make method of class static. What is the purpose of it anyway, again?
Quote:And idk how I can access static method from the outside anyway. (ClassName.method() doesn't work.)In CBOT you can't access anything in the class itself. You have to create instance of class and access everything in it. Like that:
Code:
Classname instance();
instance.method();
Quote:...I think I still prefer normal languages.We all do, hazel, we all do. But CBOT is what we got here.