Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support derived classes (Car and Heli/Boat/Tank etc) #40

Closed
Tracked by #170
x87 opened this issue May 5, 2021 · 5 comments
Closed
Tracked by #170

support derived classes (Car and Heli/Boat/Tank etc) #40

x87 opened this issue May 5, 2021 · 5 comments
Milestone

Comments

@x87
Copy link
Contributor

x87 commented May 5, 2021

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).

What do you think?

Originally posted by @x87 in sannybuilder/dev#136 (reply in thread)

@x87
Copy link
Contributor Author

x87 commented May 5, 2021

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#.

sannybuilder/dev#136 (reply in thread)

@x87 x87 added this to the v5 milestone May 5, 2021
@x87
Copy link
Contributor Author

x87 commented 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
Copy link
Contributor Author

x87 commented May 5, 2021

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

@x87
Copy link
Contributor Author

x87 commented Dec 17, 2021

Note: classes inheritance is supported in CLEO Redux with the help of classes metadata, e.g. Boat

@x87
Copy link
Contributor Author

x87 commented Feb 21, 2022

Closing as it should be sufficient to use classes metadata.

@x87 x87 closed this as completed Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant