class HighCommunications ; end
class Communications ; end
class Hyperdrive ; end
class Cockpit ; end
class Bridge ; end
class Ship
include Hyperdrive
include Cockpit
include Communications
end
class SpaceStation
include Hyperdrive # I guess? :p
include Bridge # Maybe different from cockpit? :p
include HighCommunications
end
class Satellite
include HighCommunications
end
class Weapons ; end
class Communications ; end
class Hyperdrive ; end
class Cockpit ; end
class Space_Object ; end # Anything in space?
class Ship < Space_Object
include Cockpit
end
class Fighter < Ship
include Weapons
end
class Satellite < Space_Object
include Communications
end
class Hominid
include Head
include Torso
include Legs
include Arms
end
class Person < Hominid
include Student
include Biker
include Programmer
include PokerPlayer
end
class Communications
def initialize
@comm_array = CommDevice.new(:low_communications)
end
### array isn't exposed.
end
class Hyperdrive
def initialize
@hyperdrive = FTLDevice.new()
end
def self.hyperdrive # Perhaps we want to expose the object.
return @hyperdrive
end
end
class Ship
include Hyperdrive
include Communications
end
So I decided tonight, since I got the first stage to compile and run in the MUD for the first time that before I went any further, I'd step back and evaluate and see if this path was truely worthwhile. First off, SW:TSW is being built off of SmaugFUSS, so I'd only be gaining OO Designs in the Space and Force systems without a tremendous amount of work retrofitting SmaugFUSS to be OO itself. Secondly, I'm just learning these concepts so I'm bound to do something wrong, and for something as integral to the theme as Space and Force, I'd really prefer to avoid that. So now on to the meat…
This is the base Ship class, minus the get/set functions, and other public functions and data members.
Now the derived classes vary in type based on the Class/Type of ship. A couple examples:
There's a ton more of them, and they're no where near complete but this is just a couple of examples. If anyone wants to see the full classes, I'd be happy to show them to you in a PM or a pastebin, but I don't want to post them all because it's about 640 lines just for the classes themselves, not including the meat of the member functions in the .cpp file.
So I guess, based on what I've shown, am I over complicating things? Going a good route? Have I done anything wrong here? Is this a waste of time to have parts of the codebase OO and probably 70% of it be procedural? I guess it really boils down to is it worth all the effort to make these two systems OO while the rest of the base won't be? I had other questions.. but they seem to have slipped my mind… perhaps some responses will jar them loose.. Or maybe not and their doomed to the bowels of the forgotten…