Update of /cvsroot/gcblue/gcb_wx/src/database
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29425/src/database
Modified Files:
tcDatabase.cpp
Added Files:
tcBallisticDBObject.cpp
Log Message:
--- NEW FILE: tcBallisticDBObject.cpp ---
/*
** @file tcBallisticDBObject.cpp
*/
/* Copyright (C) 2004 Dewitt Colclough (de...@tw...)
** All rights reserved.
** This file is part of the Global Conflict Blue (GCB) program.
** GCB is free software; you can redistribute it and/or modify
** it under the terms of version 2 of the GNU General Public License as
** published by the Free Software Foundation.
** GCB 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 GCB; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdwx.h"
#if _MSC_VER > 1000
#pragma warning(disable:4786) // suppress warning for STL bug in VC6, see Q167355 in the MSDN Library.
#endif // _MSC_VER > 1000
#include "tcBallisticDBObject.h"
#include "math_constants.h"
#include "randfn.h"
#include "CsvTranslator.h"
#include "common/tinyxml.h"
using namespace std;
namespace Database
{
void tcBallisticDBObject::PrintToFile(tcFile& file)
{
tcWeaponDBObject::PrintToFile(file);
}
int tcBallisticDBObject::Serialize(tcFile& file, bool mbLoad, UINT32 anVersion)
{
tcWeaponDBObject::Serialize(file,mbLoad,anVersion);
if (mbLoad)
{
}
else
{
}
return true;
}
int tcBallisticDBObject::SerializeCSV(CsvTranslator *csv, bool mbLoad)
{
tcWeaponDBObject::SerializeCSV(csv, mbLoad);
if (mbLoad)
{
}
else
{
csv->WriteLine();
}
return 1;
}
/**
* Loads/saves XML data for database object
* @param load true to load, false to save
*/
void tcBallisticDBObject::SerializeXml(TiXmlElement* node, bool load)
{
if (load) return; // write only for now
wxASSERT(node);
TiXmlElement* localNode = node->InsertEndChild(TiXmlElement("sensor"))->ToElement();
//localNode->SetAttribute("maxRange_km" ,mfMaxRange_km);
tcWeaponDBObject::SerializeXml(node, load);
}
int tcBallisticDBObject::WriteCSVHeader(Database::CsvTranslator *csv)
{
tcWeaponDBObject::WriteCSVHeader(csv);
csv->WriteLine(); // write line since this is a leaf class
return 1;
}
tcBallisticDBObject::tcBallisticDBObject() : tcWeaponDBObject()
{
mzClass = "Default Ballistic";
mnClassID = DTYPE_BALLISTIC;
}
tcBallisticDBObject::tcBallisticDBObject(tcBallisticDBObject& obj)
: tcWeaponDBObject(obj)
{
}
tcBallisticDBObject::~tcBallisticDBObject()
{
}
}
Index: tcDatabase.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabase.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** tcDatabase.cpp 27 Jul 2004 00:16:23 -0000 1.12
--- tcDatabase.cpp 29 Jul 2004 00:14:17 -0000 1.13
***************
*** 1,6 ****
/*
! ** tcDatabase.cpp
! **
! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...)
** All rights reserved.
--- 1,6 ----
/*
! ** @file tcDatabase.cpp
! */
! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...)
** All rights reserved.
***************
*** 45,48 ****
--- 45,49 ----
#include "tcAirDBObject.h"
#include "tcFlightportDBObject.h"
+ #include "tcBallisticDBObject.h"
#include "common/tinyxml.h"
***************
*** 81,84 ****
--- 82,86 ----
std::string airFileName = path + string("air") + suffix + ".csv";
std::string flightportFileName = path + string("flightport") + suffix + ".csv";
+ std::string ballisticFileName = path + string("ballistic") + suffix + ".csv";
if (mbLoad)
***************
*** 120,123 ****
--- 122,130 ----
serializer.LoadCsv();
}
+ // tcBallisticDBObject
+ {
+ tcDBObjSerializer<tcBallisticDBObject> serializer(ballisticFileName, this);
+ serializer.LoadCsv();
+ }
}
else
***************
*** 159,162 ****
--- 166,174 ----
serializer.SaveCsv();
}
+ // tcBallisticDBObject
+ {
+ tcDBObjSerializer<tcBallisticDBObject> serializer(ballisticFileName, this);
+ serializer.SaveCsv();
+ }
}
|