Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Public files, factory and code battle
#2
All public names in CBot (both for functions and classes) are shared between teams. We know this can cause name collisions, especially if you try to load the same programs for both teams, and it will be fixed in the future. See https://github.com/colobot/colobot/issues/526. There is also https://github.com/colobot/colobot/issues/697 for when you just want to use classes to organize things in the code and not for sharing data between robots.

Using factory() with function name actually just makes it run a program that looks something like that:
Code:
extern void object::Autogenerated()
{
    FunctionNameHere();
}
so it follows normal rules of calling public functions. An alternative is to provide a filename to load (I actually don't even remember where does it load the file from myself, but I think it's the "files" directory, the same one that is used when reading/writing files with CBOT) or full program code.


Messages In This Thread
Public files, factory and code battle - by nknk - 12-22-2016, 01:34 PM
RE: Public files, factory and code battle - by krzys_h - 12-22-2016, 02:41 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)