From: <eg...@us...> - 2006-07-18 20:41:07
|
Revision: 107 Author: egore Date: 2006-07-18 13:40:54 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/opengate/?rev=107&view=rev Log Message: ----------- move stuff around Modified Paths: -------------- src/common/objects/Makefile.am Added Paths: ----------- src/common/objects/ship.cpp src/common/objects/ship.h Removed Paths: ------------- src/common/objects/ships/ Modified: src/common/objects/Makefile.am =================================================================== --- src/common/objects/Makefile.am 2006-07-18 20:39:16 UTC (rev 106) +++ src/common/objects/Makefile.am 2006-07-18 20:40:54 UTC (rev 107) @@ -1,8 +1,7 @@ INCLUDES = $(all_includes) METASOURCES = AUTO noinst_LTLIBRARIES = libopengate-objects.la -libopengate_objects_la_SOURCES = movable_object.cpp object.cpp -noinst_HEADERS = movable_object.h object.h -SUBDIRS = ships -libopengate_objects_la_LIBADD =\ - $(top_builddir)/src/common/objects/ships/libopengate-ship.la +libopengate_objects_la_SOURCES = movable_object.cpp object.cpp ship.cpp \ + station.cpp +noinst_HEADERS = movable_object.h object.h ship.h station.h + Copied: src/common/objects/ship.cpp (from rev 105, src/common/objects/ships/ship.cpp) =================================================================== --- src/common/objects/ship.cpp (rev 0) +++ src/common/objects/ship.cpp 2006-07-18 20:40:54 UTC (rev 107) @@ -0,0 +1,146 @@ +/*************************************************************************** + * ship.cpp + * + * Sat Jul 15 14:57:38 2006 + * Copyright 2006 Christoph Brill + * Email <eg...@us...> + ****************************************************************************/ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "ship.h" +#include "../exception.h" +#include "../loader.h" +#include "../faction_storage.h" +#include <vector> + +Ship::Ship(std::string filename) { + // TODO: intialize the variables + _filename = filename; + initialize(); +} + +Ship::~Ship() { + if (_capacitor) { + delete(_capacitor); + } + +} + +void Ship::initialize() { + + Loader* loader = Loader::get_instance(); + loader->parse_file(_filename); + + // Naming + _name = loader->get_option("/ship/name"); + _class = loader->get_option("/ship/class"); + FactionStorage* f_storage = FactionStorage::get_instance(); + _faction = f_storage->get_faction(loader->get_option("/ship/faction")); + _description = loader->get_option("/ship/description"); + + // Production Data + _productioncenter = loader->get_option_array("/ship/production-center"); + + // Generic Data + _techlevel = atoi(loader->get_option("/ship/techlevel")); + _size = atoi(loader->get_option("/ship/size")); + _mass = atoi(loader->get_option("/ship/mass")); + + _capacitorsize = atoi(loader->get_option("/ship/capacitorsize")); + _ecmsize = atoi(loader->get_option("/ship/ecmsize")); + _enginecount = atoi(loader->get_option("/ship/enginecount")); + _enginesize = atoi(loader->get_option("/ship/enginesize")); + _guncount = loader->get_option_count("/ship/gunsize"); + //_gunsize[] = atoi(loader->get_option_array("/ship/gunsize")); + _missilecount = loader->get_option_count("/ship/missilesize"); + //_missilesize[] = atoi(loader->get_option_array("/ship/_missilesize")); + //TODO:modx + _powerplantsize = atoi(loader->get_option("/ship/powerplantsize")); + _radarsize = atoi(loader->get_option("/ship/radarsize")); + _shieldsize = atoi(loader->get_option("/ship/shieldsize")); + + _armor = atoi(loader->get_option("/ship/armor")); + _cargocapacity = atoi(loader->get_option("/ship/cargocapacity")); + + _dragfactor = atof(loader->get_option("/ship/dragfactor")); + _pitch = atof(loader->get_option("/ship/pitch")); + _roll = atof(loader->get_option("/ship/roll")); + _yaw = atof(loader->get_option("/ship/yaw")); +} + +std::string Ship::get_name() { + return _name; +} + +void Ship::set_name(std::string name) { + _name = name; +} + +std::string Ship::get_class() { + return _class; +} + +void Ship::set_class(std::string newclass) { + _class = newclass; +} + +Faction* Ship::get_faction() { + return _faction; +} + +void Ship::set_faction(Faction* faction) { + _faction = faction; +} + +Capacitor* Ship::get_capacitor() { + return _capacitor; +} + +void Ship::set_capacitor(Capacitor* capacitor) { + if (capacitor->get_size() > _capacitorsize) { + throw new Exception("Capacitor to big"); + } + if (_capacitor) { + delete(_capacitor); + } + _capacitor = capacitor; +} + +short Ship::get_capacitor_size() { + return _capacitorsize; +} + +short Ship::get_guncount() { + return _guncount; +} + +std::vector<char*> Ship::get_productioncenters() { + return _productioncenter; +} + +bool Ship::move(const int direction, float scale) { + return false; +} + +bool Ship::rotate(int direction, Ogre::Degree scale) { + return false; +} + +void Ship::performMove() { + +} Copied: src/common/objects/ship.h (from rev 105, src/common/objects/ships/ship.h) =================================================================== --- src/common/objects/ship.h (rev 0) +++ src/common/objects/ship.h 2006-07-18 20:40:54 UTC (rev 107) @@ -0,0 +1,119 @@ +/*************************************************************************** + * ship.h + * + * Sat Jul 15 14:57:38 2006 + * Copyright 2006 Christoph Brill + * Email <eg...@us...> + ****************************************************************************/ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _OPENGATE_SHIP_ +#define _OPENGATE_SHIP_ + +#include "movable_object.h" +#include "../equipment/engine.h" +#include "../equipment/ecm.h" +#include "../equipment/capacitor.h" +#include "../equipment/gun.h" + +/** + * This abstract class defines basic information about every ship + * that is flying around in opengate. For example every ship has + * an engine. Or every ship has a faction. All this information is + * stored in this class. + * + * @author Christoph Brill + */ +class Ship : public MovableObject { +public: + Ship(std::string filename); + virtual ~Ship(); + + // Naming + std::string get_name(); + void set_name(std::string name); + std::string get_class(); + void set_class(std::string newclass); + Faction* get_faction(); + void set_faction(Faction* faction); + std::string get_description(); + void set_description(std::string description); + + Capacitor* get_capacitor(); + void set_capacitor(Capacitor* capacitor); + short get_capacitor_size(); + short get_guncount(); + std::vector<char*> get_productioncenters(); + + // Ogre stuff + virtual bool move(const int direction, float scale); + virtual bool rotate(int direction, Ogre::Degree scale); + virtual void performMove(); + +private: + + virtual void initialize(); + std::string _filename; + + // Naming + std::string _name; + std::string _class; + Faction* _faction; + std::string _description; + + // Production Data + std::vector<char*> _productioncenter; + + // Generic Data + short _techlevel; + int _size; + long _mass; + + // Sizes + short _capacitorsize; + Capacitor* _capacitor; + short _ecmsize; + ECM* _ecm; + short _enginecount; + short _enginesize; + Engine* _engine[]; + short _guncount; + short _gunsize[]; + Gun* _gun[]; + short _missilecount; + short _missilesize[]; + //TODO: Missile* _missile[]; + //TODO: modx + short _powerplantsize; + //TODO: Powerplant* _powerplant; + short _radarsize; + //TODO: Radar* _radar; + short _shieldsize; + //TODO: Shield* _shield; + long _armor; + short _cargocapacity; + + // Movement + double _dragfactor; + double _pitch; + double _roll; + double _yaw; +}; + +#endif + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2006-07-18 20:43:00
|
Revision: 108 Author: egore Date: 2006-07-18 13:42:49 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/opengate/?rev=108&view=rev Log Message: ----------- add station construct Added Paths: ----------- src/common/objects/station.cpp src/common/objects/station.h Added: src/common/objects/station.cpp =================================================================== --- src/common/objects/station.cpp (rev 0) +++ src/common/objects/station.cpp 2006-07-18 20:42:49 UTC (rev 108) @@ -0,0 +1,41 @@ +/*************************************************************************** + * station.cpp + * + * Sat Jul 18 22:30:39 2006 + * Copyright 2006 Christoph Brill + * Email <eg...@us...> + ****************************************************************************/ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "station.h" + +Station::Station() { + +} + +Station::~Station() { + +} + +double Station::get_price_for(std::string object) { + return 0.0; +} + +void Station::initialize() { + +} Property changes on: src/common/objects/station.cpp ___________________________________________________________________ Name: svn:mime-type + text/x-c++src Name: svn:eol-style + native Added: src/common/objects/station.h =================================================================== --- src/common/objects/station.h (rev 0) +++ src/common/objects/station.h 2006-07-18 20:42:49 UTC (rev 108) @@ -0,0 +1,52 @@ +/*************************************************************************** + * station.h + * + * Sat Jul 18 22:30:39 2006 + * Copyright 2006 Christoph Brill + * Email <eg...@us...> + ****************************************************************************/ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _OPENGATE_STATION_ +#define _OPENGATE_STATION_ + +#include <string> +#include "../faction.h" +#include "object.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +class Station : public Object { +public: + Station(); + ~Station(); + + double get_price_for(std::string object); +private: + void initialize(); + Faction* _faction; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _OPENGATE_STATION_ */ Property changes on: src/common/objects/station.h ___________________________________________________________________ Name: svn:mime-type + text/x-c++hdr Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2006-07-30 18:45:39
|
Revision: 124 Author: egore Date: 2006-07-30 11:45:34 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/opengate/?rev=124&view=rev Log Message: ----------- Remove setters for unsetable values Add implementation for array-values Modified Paths: -------------- src/common/objects/ship.cpp src/common/objects/ship.h Modified: src/common/objects/ship.cpp =================================================================== --- src/common/objects/ship.cpp 2006-07-30 18:44:33 UTC (rev 123) +++ src/common/objects/ship.cpp 2006-07-30 18:45:34 UTC (rev 124) @@ -61,6 +61,7 @@ _size = atoi(loader->get_option("/ship/size")); _mass = atoi(loader->get_option("/ship/mass")); + // Specific Data _capacitorsize = atoi(loader->get_option("/ship/capacitorsize")); _ecmsize = atoi(loader->get_option("/ship/ecmsize")); _enginecount = atoi(loader->get_option("/ship/enginecount")); @@ -87,26 +88,14 @@ return _name; } -void Ship::set_name(std::string name) { - _name = name; -} - std::string Ship::get_class() { return _class; } -void Ship::set_class(std::string newclass) { - _class = newclass; -} - Faction* Ship::get_faction() { return _faction; } -void Ship::set_faction(Faction* faction) { - _faction = faction; -} - Capacitor* Ship::get_capacitor() { return _capacitor; } @@ -121,10 +110,6 @@ _capacitor = capacitor; } -short Ship::get_capacitor_size() { - return _capacitorsize; -} - short Ship::get_guncount() { return _guncount; } Modified: src/common/objects/ship.h =================================================================== --- src/common/objects/ship.h 2006-07-30 18:44:33 UTC (rev 123) +++ src/common/objects/ship.h 2006-07-30 18:45:34 UTC (rev 124) @@ -46,16 +46,11 @@ // Naming std::string get_name(); - void set_name(std::string name); std::string get_class(); - void set_class(std::string newclass); Faction* get_faction(); - void set_faction(Faction* faction); std::string get_description(); - void set_description(std::string description); Capacitor* get_capacitor(); - void set_capacitor(Capacitor* capacitor); short get_capacitor_size(); short get_guncount(); std::vector<char*> get_productioncenters(); @@ -65,6 +60,17 @@ virtual bool rotate(int direction, Ogre::Degree scale); virtual void performMove(); +protected: + + void set_capacitor(Capacitor* capacitor); + void set_ecm(ECM* _ecm); + + // Movement + double _dragfactor; + double _pitch; + double _roll; + double _yaw; + private: virtual void initialize(); @@ -108,11 +114,6 @@ long _armor; short _cargocapacity; - // Movement - double _dragfactor; - double _pitch; - double _roll; - double _yaw; }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |