Skip to content

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

Closed

Description

@x87

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)

Activity

  1. x87 commented on May 5, 2021

    @x87
    ContributorAuthor

    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)

  2. added this to the v5 milestone on May 5, 2021
  3. x87 commented on May 5, 2021

    @x87
    ContributorAuthor

    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)

  4. x87 commented on May 5, 2021

    @x87
    ContributorAuthor

    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

  5. x87 commented on Dec 17, 2021

    @x87
    ContributorAuthor

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

  6. x87 commented on Feb 21, 2022

    @x87
    ContributorAuthor

    Closing as it should be sufficient to use classes metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions