[3.2.1] AGS does not let declare a struct member with name similar to global

Started by Crimson Wizard, Tue 14/06/2011 09:09:13

Previous topic - Next topic

Crimson Wizard

AGS does not let declare a struct member function with name similar to global function. It shows "already defined" error.

Code example:
Code: ags

struct GameBoard
{
   import static function SetViewport(int x1, int y1, int x2, y2);
}

monkey0506

It's a known issue. You can only get around it by a) using a different name for the function/property, or b) define the struct function/property before the global function/property. Since SetViewport is defined internally, you can't use option b here.

Even the internally defined methods have to adhere to this limitation. Take for example the Character.Room property versus the Room struct. The only reason the Room struct is allowed is because the Character.Room property is defined first. If they were defined the other way around, the internal scripts wouldn't compile either.

SMF spam blocked by CleanTalk