You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
support derived classes (Car and Heli/Boat/Tank etc) #40
To solve the dilemma with derived classes (Car and Heli/Boat/Tank etc) we could add overloaded constructor commands:
00A5 CREATE_CAR Car.Create: Car
00A5 CREATE_BOAT Boat.Create(...): Boat
00A5 CREATE_TANK Tank.Create(...): Tank
00A5 CREATE_HELI Heli.Create(...): Heli
All four will compile to the same opcode 00A5 but the compiler will become aware of the correct type of the vehicle and the class name. Also the compiler could validate that the correct model id is provided to the constructor (Boat.Create(#INFERNUS...) would raise an error).
I think for Сar, Boat and the like it is worth giving another modifier, like "inherited" or "extended". A static class must not inherit. At least this is implemented in C#.
Activity
x87 commentedon May 5, 2021
sannybuilder/dev#136 (reply in thread)
x87 commentedon May 5, 2021
another example of derivatives:
08D4 CREATE_MENU => Menu
0964 CREATE_MENU_GRID => MenuGrid (has its own command SET_ACTIVE_MENU_ITEM_CAR_MODS)
0AAC LOAD_AUDIO_STREAM => AudioStream
0AC1 LOAD_3D_AUDIO_STREAM => AudioStream3d (has *3D methods, like SET_PLAY_3D_AUDIO_STREAM_AT_CAR)
x87 commentedon May 5, 2021
We could add an extra field for
is_constructorcommands to specify the base class name. e.g.Boat extends Car
Heli extends Car
MenuGrid extends Menu
AudioStream3d extends AudioStream
x87 commentedon Dec 17, 2021
Note: classes inheritance is supported in CLEO Redux with the help of classes metadata, e.g. Boat
x87 commentedon Feb 21, 2022
Closing as it should be sufficient to use classes metadata.