Closed x87 closed 2 years ago
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#.
https://github.com/sannybuilder/dev/discussions/136#discussioncomment-698849
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)
We could add an extra field for is_constructor
commands to specify the base class name. e.g.
Boat extends Car Heli extends Car MenuGrid extends Menu AudioStream3d extends AudioStream
Note: classes inheritance is supported in CLEO Redux with the help of classes metadata, e.g. Boat
Closing as it should be sufficient to use classes metadata.
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_BOATBoat.Create(...): Boat
00A5 CREATE_TANKTank.Create(...): Tank
00A5 CREATE_HELIHeli.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).What do you think?
Originally posted by @x87 in https://github.com/sannybuilder/dev/discussions/136#discussioncomment-635112