Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Critical errors with a program in lvl controller after loading saved game
#9
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.


Messages In This Thread
RE: Critical errors with a program in lvl controller after loading saved game - by robocat04 - 02-20-2018, 10:51 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)