Virtual inheritance mess

Hi, I've been a lurker here for the last year but today I have a question.
I'm creating a manic shooter engine for my game, and I'm using SFML for the graphics. I know some objects will be represented using sprites while others will consist of vertex arrays. I need to make a bunch of nested classes, and I need help about virtual inheritance. Here is the list of objects I need to make:

drawable: anything which can be drawn in the game
- bool _visible
- vector _position
- angle _orientation
+ virtual draw() =0 // we don't know if it's a sprite or vertex-based image yet

spriteDrawable: inherits from drawable, can be drawn with a sprite
- sprite _sprite
+ draw(){ /* if _visible, draw _sprite at _position with _orientation */ }

vertexDrawable: inherits from drawable, can be drawn with a vertex-based shape
- vertexArray _body
+ draw(){ /* if _visible, draw _body at _position with _orientation */ }


Now I need to make different objects which can be drawn, but also have other properties. Is there a way to make a class called movable which inherits from drawable, then make another class which inherits from both movable and spriteDrawable? Or do I need to make a vertexMovable and a spriteMovable class?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
struct drawable
{
    virtual ~drawable() {}

    // ...

};

struct sprite_drawable : virtual drawable
{
    // ...
};

struct vertex_drawable : virtual drawable
{
    // ...
};

struct moveable : virtual drawable
{
    // ...
};

// inherits drawable virtually; there is only one object of type drawable
// shared by the three classes involved
struct sprite_moveable : virtual drawable, sprite_drawable, moveable
{
    // ...
};

// virtual drawable is implied even if we don't specify it explicitly
// order of construction is:
// a. virtual base classes in order of virtual inheritance (1. drawable)
// b. non-virtual base classes in order of inheritance (2. sprite_drawable, 3. moveable)
// c. constructor of the class (4. vertex_moveable)
struct vertex_moveable : /* virtual drawable, */ sprite_drawable, moveable
{
    // ...
};
Wow, thanks. Exactly the kind of answer I was looking for.
Topic archived. No new replies allowed.