mirror of
https://bitbucket.org/seefoe/src.git
synced 2026-09-12 22:45:22 -04:00
re-add and add some missing tdf templates, fix build_tdf.sh
This commit is contained in:
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+9
-9
@@ -343,7 +343,7 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const
|
||||
base = dynamic_cast<const SharedCreatureObjectTemplate *>(m_baseData);
|
||||
}
|
||||
|
||||
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 2, ("template param index out of range"));
|
||||
DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range"));
|
||||
if (!m_acceleration[index].isLoaded())
|
||||
{
|
||||
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr)
|
||||
@@ -392,7 +392,7 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons
|
||||
base = dynamic_cast<const SharedCreatureObjectTemplate *>(m_baseData);
|
||||
}
|
||||
|
||||
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 2, ("template param index out of range"));
|
||||
DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range"));
|
||||
if (!m_acceleration[index].isLoaded())
|
||||
{
|
||||
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr)
|
||||
@@ -441,7 +441,7 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons
|
||||
base = dynamic_cast<const SharedCreatureObjectTemplate *>(m_baseData);
|
||||
}
|
||||
|
||||
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 2, ("template param index out of range"));
|
||||
DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range"));
|
||||
if (!m_acceleration[index].isLoaded())
|
||||
{
|
||||
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr)
|
||||
@@ -490,7 +490,7 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const
|
||||
base = dynamic_cast<const SharedCreatureObjectTemplate *>(m_baseData);
|
||||
}
|
||||
|
||||
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 2, ("template param index out of range"));
|
||||
DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range"));
|
||||
if (!m_speed[index].isLoaded())
|
||||
{
|
||||
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr)
|
||||
@@ -539,7 +539,7 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const
|
||||
base = dynamic_cast<const SharedCreatureObjectTemplate *>(m_baseData);
|
||||
}
|
||||
|
||||
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 2, ("template param index out of range"));
|
||||
DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range"));
|
||||
if (!m_speed[index].isLoaded())
|
||||
{
|
||||
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr)
|
||||
@@ -588,7 +588,7 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const
|
||||
base = dynamic_cast<const SharedCreatureObjectTemplate *>(m_baseData);
|
||||
}
|
||||
|
||||
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 2, ("template param index out of range"));
|
||||
DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range"));
|
||||
if (!m_speed[index].isLoaded())
|
||||
{
|
||||
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr)
|
||||
@@ -637,7 +637,7 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const
|
||||
base = dynamic_cast<const SharedCreatureObjectTemplate *>(m_baseData);
|
||||
}
|
||||
|
||||
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 2, ("template param index out of range"));
|
||||
DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range"));
|
||||
if (!m_turnRate[index].isLoaded())
|
||||
{
|
||||
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr)
|
||||
@@ -686,7 +686,7 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const
|
||||
base = dynamic_cast<const SharedCreatureObjectTemplate *>(m_baseData);
|
||||
}
|
||||
|
||||
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 2, ("template param index out of range"));
|
||||
DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range"));
|
||||
if (!m_turnRate[index].isLoaded())
|
||||
{
|
||||
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr)
|
||||
@@ -735,7 +735,7 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const
|
||||
base = dynamic_cast<const SharedCreatureObjectTemplate *>(m_baseData);
|
||||
}
|
||||
|
||||
DEBUG_FATAL(static_cast<int>(index) < 0 || static_cast<int>(index) >= 2, ("template param index out of range"));
|
||||
DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range"));
|
||||
if (!m_turnRate[index].isLoaded())
|
||||
{
|
||||
if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr)
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
-1
@@ -61,7 +61,6 @@ public:
|
||||
|
||||
enum DamageType
|
||||
{
|
||||
DT_none = 0x00000000,
|
||||
DT_kinetic = 0x00000001,
|
||||
DT_energy = 0x00000002,
|
||||
DT_blast = 0x00000004,
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+175
@@ -0,0 +1,175 @@
|
||||
//========================================================================
|
||||
//
|
||||
// SharedMissionDataObjectTemplate.cpp
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include "sharedGame/FirstSharedGame.h"
|
||||
#include "SharedMissionDataObjectTemplate.h"
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <stdio.h>
|
||||
|
||||
const std::string DefaultString("");
|
||||
const StringId DefaultStringId("", 0);
|
||||
const Vector DefaultVector(0,0,0);
|
||||
const TriggerVolumeData DefaultTriggerVolumeData;
|
||||
|
||||
bool SharedMissionDataObjectTemplate::ms_allowDefaultTemplateParams = true;
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
SharedMissionDataObjectTemplate::SharedMissionDataObjectTemplate(const std::string & filename)
|
||||
//@BEGIN TFD INIT
|
||||
: SharedIntangibleObjectTemplate(filename)
|
||||
,m_versionOk(true)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // SharedMissionDataObjectTemplate::SharedMissionDataObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
SharedMissionDataObjectTemplate::~SharedMissionDataObjectTemplate()
|
||||
{
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // SharedMissionDataObjectTemplate::~SharedMissionDataObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void SharedMissionDataObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(SharedMissionDataObjectTemplate_tag, create);
|
||||
} // SharedMissionDataObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a SharedMissionDataObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * SharedMissionDataObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new SharedMissionDataObjectTemplate(filename);
|
||||
} // SharedMissionDataObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag SharedMissionDataObjectTemplate::getId(void) const
|
||||
{
|
||||
return SharedMissionDataObjectTemplate_tag;
|
||||
} // SharedMissionDataObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag SharedMissionDataObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
} // SharedMissionDataObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
* Returns the highest version of this template or it's base templates.
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag SharedMissionDataObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
return m_templateVersion;
|
||||
const SharedMissionDataObjectTemplate * base = dynamic_cast<const SharedMissionDataObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // SharedMissionDataObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
#ifdef _DEBUG
|
||||
/**
|
||||
* Special function used by datalint. Checks for duplicate values in base and derived templates.
|
||||
*/
|
||||
void SharedMissionDataObjectTemplate::testValues(void) const
|
||||
{
|
||||
SharedIntangibleObjectTemplate::testValues();
|
||||
} // SharedMissionDataObjectTemplate::testValues
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
* for this template.
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void SharedMissionDataObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != SharedMissionDataObjectTemplate_tag)
|
||||
{
|
||||
SharedIntangibleObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
if (m_templateVersion == TAG(D,E,R,V))
|
||||
{
|
||||
file.enterForm();
|
||||
file.enterChunk();
|
||||
std::string baseFilename;
|
||||
file.read_string(baseFilename);
|
||||
file.exitChunk();
|
||||
const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename);
|
||||
DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str()));
|
||||
if (m_baseData == base && base != nullptr)
|
||||
base->releaseReference();
|
||||
else
|
||||
{
|
||||
if (m_baseData != nullptr)
|
||||
m_baseData->releaseReference();
|
||||
m_baseData = base;
|
||||
}
|
||||
file.exitForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
}
|
||||
if (getHighestTemplateVersion() != TAG(0,0,0,0))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
m_versionOk = false;
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
UNREF(paramName);
|
||||
UNREF(paramCount);
|
||||
|
||||
file.exitForm();
|
||||
SharedIntangibleObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // SharedMissionDataObjectTemplate::load
|
||||
|
||||
//@END TFD
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
//========================================================================
|
||||
//
|
||||
// SharedMissionDataObjectTemplate.h
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef _INCLUDED_SharedMissionDataObjectTemplate_H
|
||||
#define _INCLUDED_SharedMissionDataObjectTemplate_H
|
||||
|
||||
#include "SharedIntangibleObjectTemplate.h"
|
||||
#include "sharedFoundation/DynamicVariable.h"
|
||||
#include "sharedUtility/TemplateParameter.h"
|
||||
|
||||
|
||||
class Vector;
|
||||
typedef StructParam<ObjectTemplate> StructParamOT;
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
|
||||
|
||||
class SharedMissionDataObjectTemplate : public SharedIntangibleObjectTemplate
|
||||
{
|
||||
public:
|
||||
//@BEGIN TFD ID
|
||||
enum
|
||||
{
|
||||
SharedMissionDataObjectTemplate_tag = TAG(S,M,S,D)
|
||||
};
|
||||
//@END TFD ID
|
||||
public:
|
||||
SharedMissionDataObjectTemplate(const std::string & filename);
|
||||
virtual ~SharedMissionDataObjectTemplate();
|
||||
|
||||
virtual Tag getId(void) const;
|
||||
virtual Tag getTemplateVersion(void) const;
|
||||
virtual Tag getHighestTemplateVersion(void) const;
|
||||
static void install(bool allowDefaultTemplateParams = true);
|
||||
|
||||
//@BEGIN TFD
|
||||
public:
|
||||
|
||||
#ifdef _DEBUG
|
||||
public:
|
||||
// special code used by datalint
|
||||
virtual void testValues(void) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void load(Iff &file);
|
||||
|
||||
private:
|
||||
//@END TFD
|
||||
|
||||
private:
|
||||
Tag m_templateVersion; // the template version
|
||||
bool m_versionOk; // flag that the template version loaded is the one we expect
|
||||
static bool ms_allowDefaultTemplateParams; // flag to allow defaut params instead of fataling
|
||||
|
||||
static void registerMe(void);
|
||||
static ObjectTemplate * create(const std::string & filename);
|
||||
|
||||
// no copying
|
||||
SharedMissionDataObjectTemplate(const SharedMissionDataObjectTemplate &);
|
||||
SharedMissionDataObjectTemplate & operator =(const SharedMissionDataObjectTemplate &);
|
||||
};
|
||||
|
||||
|
||||
inline void SharedMissionDataObjectTemplate::install(bool allowDefaultTemplateParams)
|
||||
{
|
||||
ms_allowDefaultTemplateParams = allowDefaultTemplateParams;
|
||||
//@BEGIN TFD INSTALL
|
||||
SharedMissionDataObjectTemplate::registerMe();
|
||||
//@END TFD INSTALL
|
||||
}
|
||||
|
||||
|
||||
#endif // _INCLUDED_SharedMissionDataObjectTemplate_H
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
//========================================================================
|
||||
//
|
||||
// SharedMissionListEntryObjectTemplate.cpp
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include "sharedGame/FirstSharedGame.h"
|
||||
#include "SharedMissionListEntryObjectTemplate.h"
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <stdio.h>
|
||||
|
||||
const std::string DefaultString("");
|
||||
const StringId DefaultStringId("", 0);
|
||||
const Vector DefaultVector(0,0,0);
|
||||
const TriggerVolumeData DefaultTriggerVolumeData;
|
||||
|
||||
bool SharedMissionListEntryObjectTemplate::ms_allowDefaultTemplateParams = true;
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
SharedMissionListEntryObjectTemplate::SharedMissionListEntryObjectTemplate(const std::string & filename)
|
||||
//@BEGIN TFD INIT
|
||||
: SharedIntangibleObjectTemplate(filename)
|
||||
,m_versionOk(true)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // SharedMissionListEntryObjectTemplate::SharedMissionListEntryObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
SharedMissionListEntryObjectTemplate::~SharedMissionListEntryObjectTemplate()
|
||||
{
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // SharedMissionListEntryObjectTemplate::~SharedMissionListEntryObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void SharedMissionListEntryObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(SharedMissionListEntryObjectTemplate_tag, create);
|
||||
} // SharedMissionListEntryObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a SharedMissionListEntryObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * SharedMissionListEntryObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new SharedMissionListEntryObjectTemplate(filename);
|
||||
} // SharedMissionListEntryObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag SharedMissionListEntryObjectTemplate::getId(void) const
|
||||
{
|
||||
return SharedMissionListEntryObjectTemplate_tag;
|
||||
} // SharedMissionListEntryObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag SharedMissionListEntryObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
} // SharedMissionListEntryObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
* Returns the highest version of this template or it's base templates.
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag SharedMissionListEntryObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
return m_templateVersion;
|
||||
const SharedMissionListEntryObjectTemplate * base = dynamic_cast<const SharedMissionListEntryObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // SharedMissionListEntryObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
#ifdef _DEBUG
|
||||
/**
|
||||
* Special function used by datalint. Checks for duplicate values in base and derived templates.
|
||||
*/
|
||||
void SharedMissionListEntryObjectTemplate::testValues(void) const
|
||||
{
|
||||
SharedIntangibleObjectTemplate::testValues();
|
||||
} // SharedMissionListEntryObjectTemplate::testValues
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
* for this template.
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void SharedMissionListEntryObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != SharedMissionListEntryObjectTemplate_tag)
|
||||
{
|
||||
SharedIntangibleObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
if (m_templateVersion == TAG(D,E,R,V))
|
||||
{
|
||||
file.enterForm();
|
||||
file.enterChunk();
|
||||
std::string baseFilename;
|
||||
file.read_string(baseFilename);
|
||||
file.exitChunk();
|
||||
const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename);
|
||||
DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str()));
|
||||
if (m_baseData == base && base != nullptr)
|
||||
base->releaseReference();
|
||||
else
|
||||
{
|
||||
if (m_baseData != nullptr)
|
||||
m_baseData->releaseReference();
|
||||
m_baseData = base;
|
||||
}
|
||||
file.exitForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
}
|
||||
if (getHighestTemplateVersion() != TAG(0,0,0,0))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
m_versionOk = false;
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
UNREF(paramName);
|
||||
UNREF(paramCount);
|
||||
|
||||
file.exitForm();
|
||||
SharedIntangibleObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // SharedMissionListEntryObjectTemplate::load
|
||||
|
||||
//@END TFD
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
//========================================================================
|
||||
//
|
||||
// SharedMissionListEntryObjectTemplate.h
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef _INCLUDED_SharedMissionListEntryObjectTemplate_H
|
||||
#define _INCLUDED_SharedMissionListEntryObjectTemplate_H
|
||||
|
||||
#include "SharedIntangibleObjectTemplate.h"
|
||||
#include "sharedFoundation/DynamicVariable.h"
|
||||
#include "sharedUtility/TemplateParameter.h"
|
||||
|
||||
|
||||
class Vector;
|
||||
typedef StructParam<ObjectTemplate> StructParamOT;
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
|
||||
|
||||
class SharedMissionListEntryObjectTemplate : public SharedIntangibleObjectTemplate
|
||||
{
|
||||
public:
|
||||
//@BEGIN TFD ID
|
||||
enum
|
||||
{
|
||||
SharedMissionListEntryObjectTemplate_tag = TAG(S,M,L,E)
|
||||
};
|
||||
//@END TFD ID
|
||||
public:
|
||||
SharedMissionListEntryObjectTemplate(const std::string & filename);
|
||||
virtual ~SharedMissionListEntryObjectTemplate();
|
||||
|
||||
virtual Tag getId(void) const;
|
||||
virtual Tag getTemplateVersion(void) const;
|
||||
virtual Tag getHighestTemplateVersion(void) const;
|
||||
static void install(bool allowDefaultTemplateParams = true);
|
||||
|
||||
//@BEGIN TFD
|
||||
public:
|
||||
|
||||
#ifdef _DEBUG
|
||||
public:
|
||||
// special code used by datalint
|
||||
virtual void testValues(void) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void load(Iff &file);
|
||||
|
||||
private:
|
||||
//@END TFD
|
||||
|
||||
private:
|
||||
Tag m_templateVersion; // the template version
|
||||
bool m_versionOk; // flag that the template version loaded is the one we expect
|
||||
static bool ms_allowDefaultTemplateParams; // flag to allow defaut params instead of fataling
|
||||
|
||||
static void registerMe(void);
|
||||
static ObjectTemplate * create(const std::string & filename);
|
||||
|
||||
// no copying
|
||||
SharedMissionListEntryObjectTemplate(const SharedMissionListEntryObjectTemplate &);
|
||||
SharedMissionListEntryObjectTemplate & operator =(const SharedMissionListEntryObjectTemplate &);
|
||||
};
|
||||
|
||||
|
||||
inline void SharedMissionListEntryObjectTemplate::install(bool allowDefaultTemplateParams)
|
||||
{
|
||||
ms_allowDefaultTemplateParams = allowDefaultTemplateParams;
|
||||
//@BEGIN TFD INSTALL
|
||||
SharedMissionListEntryObjectTemplate::registerMe();
|
||||
//@END TFD INSTALL
|
||||
}
|
||||
|
||||
|
||||
#endif // _INCLUDED_SharedMissionListEntryObjectTemplate_H
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
-8
@@ -161,8 +161,6 @@ UNREF(testData);
|
||||
#ifdef _DEBUG
|
||||
if (testData && base != nullptr)
|
||||
{
|
||||
if (testDataValue == value)
|
||||
DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName()));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -227,8 +225,6 @@ UNREF(testData);
|
||||
#ifdef _DEBUG
|
||||
if (testData && base != nullptr)
|
||||
{
|
||||
if (testDataValue == value)
|
||||
DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName()));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -293,8 +289,6 @@ UNREF(testData);
|
||||
#ifdef _DEBUG
|
||||
if (testData && base != nullptr)
|
||||
{
|
||||
if (testDataValue == value)
|
||||
DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName()));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -337,8 +331,6 @@ UNREF(testData);
|
||||
#ifdef _DEBUG
|
||||
if (testData && base != nullptr)
|
||||
{
|
||||
if (testDataValue == value)
|
||||
DEBUG_WARNING(true, ("Template %s, parameter surfaceType is returning same value as base template.", DataResource::getName()));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Executable → Regular
+175
@@ -0,0 +1,175 @@
|
||||
//========================================================================
|
||||
//
|
||||
// SharedTokenObjectTemplate.cpp
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include "sharedGame/FirstSharedGame.h"
|
||||
#include "SharedTokenObjectTemplate.h"
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <stdio.h>
|
||||
|
||||
const std::string DefaultString("");
|
||||
const StringId DefaultStringId("", 0);
|
||||
const Vector DefaultVector(0,0,0);
|
||||
const TriggerVolumeData DefaultTriggerVolumeData;
|
||||
|
||||
bool SharedTokenObjectTemplate::ms_allowDefaultTemplateParams = true;
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
SharedTokenObjectTemplate::SharedTokenObjectTemplate(const std::string & filename)
|
||||
//@BEGIN TFD INIT
|
||||
: SharedIntangibleObjectTemplate(filename)
|
||||
,m_versionOk(true)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // SharedTokenObjectTemplate::SharedTokenObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
SharedTokenObjectTemplate::~SharedTokenObjectTemplate()
|
||||
{
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // SharedTokenObjectTemplate::~SharedTokenObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void SharedTokenObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(SharedTokenObjectTemplate_tag, create);
|
||||
} // SharedTokenObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a SharedTokenObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * SharedTokenObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new SharedTokenObjectTemplate(filename);
|
||||
} // SharedTokenObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag SharedTokenObjectTemplate::getId(void) const
|
||||
{
|
||||
return SharedTokenObjectTemplate_tag;
|
||||
} // SharedTokenObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag SharedTokenObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
} // SharedTokenObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
* Returns the highest version of this template or it's base templates.
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag SharedTokenObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
return m_templateVersion;
|
||||
const SharedTokenObjectTemplate * base = dynamic_cast<const SharedTokenObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // SharedTokenObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
#ifdef _DEBUG
|
||||
/**
|
||||
* Special function used by datalint. Checks for duplicate values in base and derived templates.
|
||||
*/
|
||||
void SharedTokenObjectTemplate::testValues(void) const
|
||||
{
|
||||
SharedIntangibleObjectTemplate::testValues();
|
||||
} // SharedTokenObjectTemplate::testValues
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
* for this template.
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void SharedTokenObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != SharedTokenObjectTemplate_tag)
|
||||
{
|
||||
SharedIntangibleObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
if (m_templateVersion == TAG(D,E,R,V))
|
||||
{
|
||||
file.enterForm();
|
||||
file.enterChunk();
|
||||
std::string baseFilename;
|
||||
file.read_string(baseFilename);
|
||||
file.exitChunk();
|
||||
const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename);
|
||||
DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str()));
|
||||
if (m_baseData == base && base != nullptr)
|
||||
base->releaseReference();
|
||||
else
|
||||
{
|
||||
if (m_baseData != nullptr)
|
||||
m_baseData->releaseReference();
|
||||
m_baseData = base;
|
||||
}
|
||||
file.exitForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
}
|
||||
if (getHighestTemplateVersion() != TAG(0,0,0,0))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
m_versionOk = false;
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
UNREF(paramName);
|
||||
UNREF(paramCount);
|
||||
|
||||
file.exitForm();
|
||||
SharedIntangibleObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // SharedTokenObjectTemplate::load
|
||||
|
||||
//@END TFD
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
//========================================================================
|
||||
//
|
||||
// SharedTokenObjectTemplate.h
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef _INCLUDED_SharedTokenObjectTemplate_H
|
||||
#define _INCLUDED_SharedTokenObjectTemplate_H
|
||||
|
||||
#include "SharedIntangibleObjectTemplate.h"
|
||||
#include "sharedFoundation/DynamicVariable.h"
|
||||
#include "sharedUtility/TemplateParameter.h"
|
||||
|
||||
|
||||
class Vector;
|
||||
typedef StructParam<ObjectTemplate> StructParamOT;
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
|
||||
|
||||
class SharedTokenObjectTemplate : public SharedIntangibleObjectTemplate
|
||||
{
|
||||
public:
|
||||
//@BEGIN TFD ID
|
||||
enum
|
||||
{
|
||||
SharedTokenObjectTemplate_tag = TAG(S,T,O,K)
|
||||
};
|
||||
//@END TFD ID
|
||||
public:
|
||||
SharedTokenObjectTemplate(const std::string & filename);
|
||||
virtual ~SharedTokenObjectTemplate();
|
||||
|
||||
virtual Tag getId(void) const;
|
||||
virtual Tag getTemplateVersion(void) const;
|
||||
virtual Tag getHighestTemplateVersion(void) const;
|
||||
static void install(bool allowDefaultTemplateParams = true);
|
||||
|
||||
//@BEGIN TFD
|
||||
public:
|
||||
|
||||
#ifdef _DEBUG
|
||||
public:
|
||||
// special code used by datalint
|
||||
virtual void testValues(void) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void load(Iff &file);
|
||||
|
||||
private:
|
||||
//@END TFD
|
||||
|
||||
private:
|
||||
Tag m_templateVersion; // the template version
|
||||
bool m_versionOk; // flag that the template version loaded is the one we expect
|
||||
static bool ms_allowDefaultTemplateParams; // flag to allow defaut params instead of fataling
|
||||
|
||||
static void registerMe(void);
|
||||
static ObjectTemplate * create(const std::string & filename);
|
||||
|
||||
// no copying
|
||||
SharedTokenObjectTemplate(const SharedTokenObjectTemplate &);
|
||||
SharedTokenObjectTemplate & operator =(const SharedTokenObjectTemplate &);
|
||||
};
|
||||
|
||||
|
||||
inline void SharedTokenObjectTemplate::install(bool allowDefaultTemplateParams)
|
||||
{
|
||||
ms_allowDefaultTemplateParams = allowDefaultTemplateParams;
|
||||
//@BEGIN TFD INSTALL
|
||||
SharedTokenObjectTemplate::registerMe();
|
||||
//@END TFD INSTALL
|
||||
}
|
||||
|
||||
|
||||
#endif // _INCLUDED_SharedTokenObjectTemplate_H
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+25
-24
@@ -17,9 +17,9 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
@@ -27,11 +27,9 @@
|
||||
ServerArmorTemplate::ServerArmorTemplate(const std::string & filename)
|
||||
//@BEGIN TFD INIT
|
||||
: TpfTemplate(filename)
|
||||
, m_specialProtectionLoaded(false)
|
||||
, m_specialProtectionAppend(false)
|
||||
, m_templateVersion(0)
|
||||
, m_versionOk(false)
|
||||
//@END TFD INIT
|
||||
,m_specialProtectionLoaded(false)
|
||||
,m_specialProtectionAppend(false)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerArmorTemplate::ServerArmorTemplate
|
||||
|
||||
@@ -40,7 +38,7 @@ ServerArmorTemplate::ServerArmorTemplate(const std::string & filename)
|
||||
*/
|
||||
ServerArmorTemplate::~ServerArmorTemplate()
|
||||
{
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@BEGIN TFD CLEANUP
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter)
|
||||
@@ -50,7 +48,7 @@ ServerArmorTemplate::~ServerArmorTemplate()
|
||||
}
|
||||
m_specialProtection.clear();
|
||||
}
|
||||
//@END TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // ServerArmorTemplate::~ServerArmorTemplate
|
||||
|
||||
/**
|
||||
@@ -98,10 +96,10 @@ Tag ServerArmorTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerArmorTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerArmorTemplate * base = dynamic_cast<const ServerArmorTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerArmorTemplate::getHighestTemplateVersion
|
||||
@@ -275,6 +273,7 @@ bool ServerArmorTemplate::isAppend(const char *name) const
|
||||
return TpfTemplate::isAppend(name);
|
||||
} // ServerArmorTemplate::isAppend
|
||||
|
||||
|
||||
int ServerArmorTemplate::getListLength(const char *name) const
|
||||
{
|
||||
if (strcmp(name, "specialProtection") == 0)
|
||||
@@ -297,8 +296,8 @@ int ServerArmorTemplate::getListLength(const char *name) const
|
||||
*/
|
||||
void ServerArmorTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerArmorTemplate_tag)
|
||||
{
|
||||
@@ -308,7 +307,7 @@ void ServerArmorTemplate::load(Iff &file)
|
||||
|
||||
file.enterForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
if (m_templateVersion == TAG(D, E, R, V))
|
||||
if (m_templateVersion == TAG(D,E,R,V))
|
||||
{
|
||||
file.enterForm();
|
||||
file.enterChunk();
|
||||
@@ -328,7 +327,7 @@ void ServerArmorTemplate::load(Iff &file)
|
||||
file.exitForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
}
|
||||
if (getHighestTemplateVersion() != TAG(0, 0, 0, 1))
|
||||
if (getHighestTemplateVersion() != TAG(0,0,0,1))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
@@ -401,18 +400,18 @@ void ServerArmorTemplate::load(Iff &file)
|
||||
*/
|
||||
void ServerArmorTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerArmorTemplate_tag);
|
||||
if (m_baseTemplateName.size() != 0)
|
||||
{
|
||||
file.insertForm(TAG(D, E, R, V));
|
||||
file.insertForm(TAG(D,E,R,V));
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1);
|
||||
file.exitChunk();
|
||||
file.exitForm();
|
||||
}
|
||||
file.insertForm(TAG(0, 0, 0, 1));
|
||||
file.insertForm(TAG(0,0,0,1));
|
||||
file.allowNonlinearFunctions();
|
||||
|
||||
int paramCount = 0;
|
||||
@@ -447,7 +446,7 @@ void ServerArmorTemplate::save(Iff &file)
|
||||
count = m_specialProtection.size();
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < count; ++i)
|
||||
m_specialProtection[i]->saveToIff(file); }
|
||||
m_specialProtection[i]->saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save vulnerability
|
||||
@@ -462,7 +461,7 @@ void ServerArmorTemplate::save(Iff &file)
|
||||
count = 3;
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < 3; ++i)
|
||||
m_encumbrance[i].saveToIff(file); }
|
||||
m_encumbrance[i].saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
|
||||
@@ -477,6 +476,7 @@ void ServerArmorTemplate::save(Iff &file)
|
||||
file.exitForm();
|
||||
} // ServerArmorTemplate::save
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// class ServerArmorTemplate::_SpecialProtection
|
||||
|
||||
@@ -620,6 +620,7 @@ bool ServerArmorTemplate::_SpecialProtection::isAppend(const char *name) const
|
||||
return TpfTemplate::isAppend(name);
|
||||
} // ServerArmorTemplate::_SpecialProtection::isAppend
|
||||
|
||||
|
||||
int ServerArmorTemplate::_SpecialProtection::getListLength(const char *name) const
|
||||
{
|
||||
return TpfTemplate::getListLength(name);
|
||||
@@ -633,8 +634,8 @@ int ServerArmorTemplate::_SpecialProtection::getListLength(const char *name) con
|
||||
*/
|
||||
void ServerArmorTemplate::_SpecialProtection::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
file.enterForm();
|
||||
|
||||
@@ -664,7 +665,7 @@ void ServerArmorTemplate::_SpecialProtection::load(Iff &file)
|
||||
*/
|
||||
void ServerArmorTemplate::_SpecialProtection::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
int count;
|
||||
|
||||
file.insertForm(_SpecialProtection_tag);
|
||||
|
||||
@@ -693,4 +694,4 @@ void ServerArmorTemplate::_SpecialProtection::save(Iff &file)
|
||||
UNREF(count);
|
||||
} // ServerArmorTemplate::_SpecialProtection::save
|
||||
|
||||
//@END TFD
|
||||
//@END TFD
|
||||
|
||||
Executable → Regular
-1
@@ -54,7 +54,6 @@ public:
|
||||
|
||||
enum DamageType
|
||||
{
|
||||
DT_none = 0x00000000,
|
||||
DT_kinetic = 0x00000001,
|
||||
DT_energy = 0x00000002,
|
||||
DT_blast = 0x00000004,
|
||||
|
||||
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerBattlefieldMarkerObjectTemplate * base = dynamic_cast<const ServerBattlefieldMarkerObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerBuildingObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerBuildingObjectTemplate * base = dynamic_cast<const ServerBuildingObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerBuildingObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerCellObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerCellObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerCellObjectTemplate * base = dynamic_cast<const ServerCellObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerCellObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerCityObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerCityObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerCityObjectTemplate * base = dynamic_cast<const ServerCityObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerCityObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerConstructionContractObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerConstructionContractObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerConstructionContractObjectTemplate * base = dynamic_cast<const ServerConstructionContractObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerConstructionContractObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+25
-25
@@ -17,8 +17,9 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
@@ -26,11 +27,9 @@
|
||||
ServerCreatureObjectTemplate::ServerCreatureObjectTemplate(const std::string & filename)
|
||||
//@BEGIN TFD INIT
|
||||
: ServerTangibleObjectTemplate(filename)
|
||||
, m_attribModsLoaded(false)
|
||||
, m_attribModsAppend(false)
|
||||
, m_templateVersion(0)
|
||||
, m_versionOk(false)
|
||||
//@END TFD INIT
|
||||
,m_attribModsLoaded(false)
|
||||
,m_attribModsAppend(false)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerCreatureObjectTemplate::ServerCreatureObjectTemplate
|
||||
|
||||
@@ -39,7 +38,7 @@ ServerCreatureObjectTemplate::ServerCreatureObjectTemplate(const std::string & f
|
||||
*/
|
||||
ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate()
|
||||
{
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@BEGIN TFD CLEANUP
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter)
|
||||
@@ -49,7 +48,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate()
|
||||
}
|
||||
m_attribMods.clear();
|
||||
}
|
||||
//@END TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate
|
||||
|
||||
/**
|
||||
@@ -97,10 +96,10 @@ Tag ServerCreatureObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerCreatureObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerCreatureObjectTemplate * base = dynamic_cast<const ServerCreatureObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerCreatureObjectTemplate::getHighestTemplateVersion
|
||||
@@ -406,6 +405,7 @@ bool ServerCreatureObjectTemplate::isAppend(const char *name) const
|
||||
return ServerTangibleObjectTemplate::isAppend(name);
|
||||
} // ServerCreatureObjectTemplate::isAppend
|
||||
|
||||
|
||||
int ServerCreatureObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
if (strcmp(name, "attributes") == 0)
|
||||
@@ -444,8 +444,8 @@ int ServerCreatureObjectTemplate::getListLength(const char *name) const
|
||||
*/
|
||||
void ServerCreatureObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerCreatureObjectTemplate_tag)
|
||||
{
|
||||
@@ -455,7 +455,7 @@ void ServerCreatureObjectTemplate::load(Iff &file)
|
||||
|
||||
file.enterForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
if (m_templateVersion == TAG(D, E, R, V))
|
||||
if (m_templateVersion == TAG(D,E,R,V))
|
||||
{
|
||||
file.enterForm();
|
||||
file.enterChunk();
|
||||
@@ -475,7 +475,7 @@ void ServerCreatureObjectTemplate::load(Iff &file)
|
||||
file.exitForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
}
|
||||
if (getHighestTemplateVersion() != TAG(0, 0, 0, 5))
|
||||
if (getHighestTemplateVersion() != TAG(0,0,0,5))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
@@ -614,18 +614,18 @@ void ServerCreatureObjectTemplate::load(Iff &file)
|
||||
*/
|
||||
void ServerCreatureObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerCreatureObjectTemplate_tag);
|
||||
if (m_baseTemplateName.size() != 0)
|
||||
{
|
||||
file.insertForm(TAG(D, E, R, V));
|
||||
file.insertForm(TAG(D,E,R,V));
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1);
|
||||
file.exitChunk();
|
||||
file.exitForm();
|
||||
}
|
||||
file.insertForm(TAG(0, 0, 0, 5));
|
||||
file.insertForm(TAG(0,0,0,5));
|
||||
file.allowNonlinearFunctions();
|
||||
|
||||
int paramCount = 0;
|
||||
@@ -642,7 +642,7 @@ void ServerCreatureObjectTemplate::save(Iff &file)
|
||||
count = 6;
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < 6; ++i)
|
||||
m_attributes[i].saveToIff(file); }
|
||||
m_attributes[i].saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save minAttributes
|
||||
@@ -651,7 +651,7 @@ void ServerCreatureObjectTemplate::save(Iff &file)
|
||||
count = 6;
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < 6; ++i)
|
||||
m_minAttributes[i].saveToIff(file); }
|
||||
m_minAttributes[i].saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxAttributes
|
||||
@@ -660,7 +660,7 @@ void ServerCreatureObjectTemplate::save(Iff &file)
|
||||
count = 6;
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < 6; ++i)
|
||||
m_maxAttributes[i].saveToIff(file); }
|
||||
m_maxAttributes[i].saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save minDrainModifier
|
||||
@@ -699,7 +699,7 @@ void ServerCreatureObjectTemplate::save(Iff &file)
|
||||
count = m_attribMods.size();
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < count; ++i)
|
||||
m_attribMods[i]->saveToIff(file); }
|
||||
m_attribMods[i]->saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save shockWounds
|
||||
@@ -732,7 +732,7 @@ void ServerCreatureObjectTemplate::save(Iff &file)
|
||||
count = 4;
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < 4; ++i)
|
||||
m_maxMentalStates[i].saveToIff(file); }
|
||||
m_maxMentalStates[i].saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save mentalStatesDecay
|
||||
@@ -741,7 +741,7 @@ void ServerCreatureObjectTemplate::save(Iff &file)
|
||||
count = 4;
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < 4; ++i)
|
||||
m_mentalStatesDecay[i].saveToIff(file); }
|
||||
m_mentalStatesDecay[i].saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
|
||||
@@ -756,4 +756,4 @@ void ServerCreatureObjectTemplate::save(Iff &file)
|
||||
file.exitForm();
|
||||
} // ServerCreatureObjectTemplate::save
|
||||
|
||||
//@END TFD
|
||||
//@END TFD
|
||||
|
||||
Executable → Regular
Executable → Regular
+34
-32
@@ -17,8 +17,9 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
@@ -26,15 +27,13 @@
|
||||
ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate(const std::string & filename)
|
||||
//@BEGIN TFD INIT
|
||||
: ServerIntangibleObjectTemplate(filename)
|
||||
, m_slotsLoaded(false)
|
||||
, m_slotsAppend(false)
|
||||
, m_skillCommandsLoaded(false)
|
||||
, m_skillCommandsAppend(false)
|
||||
, m_manufactureScriptsLoaded(false)
|
||||
, m_manufactureScriptsAppend(false)
|
||||
, m_templateVersion(0)
|
||||
, m_versionOk(false)
|
||||
//@END TFD INIT
|
||||
,m_slotsLoaded(false)
|
||||
,m_slotsAppend(false)
|
||||
,m_skillCommandsLoaded(false)
|
||||
,m_skillCommandsAppend(false)
|
||||
,m_manufactureScriptsLoaded(false)
|
||||
,m_manufactureScriptsAppend(false)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate
|
||||
|
||||
@@ -43,7 +42,7 @@ ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate(const std
|
||||
*/
|
||||
ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate()
|
||||
{
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@BEGIN TFD CLEANUP
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_slots.begin(); iter != m_slots.end(); ++iter)
|
||||
@@ -71,7 +70,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate()
|
||||
}
|
||||
m_manufactureScripts.clear();
|
||||
}
|
||||
//@END TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate
|
||||
|
||||
/**
|
||||
@@ -119,10 +118,10 @@ Tag ServerDraftSchematicObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerDraftSchematicObjectTemplate * base = dynamic_cast<const ServerDraftSchematicObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerDraftSchematicObjectTemplate::getHighestTemplateVersion
|
||||
@@ -372,6 +371,7 @@ bool ServerDraftSchematicObjectTemplate::isAppend(const char *name) const
|
||||
return ServerIntangibleObjectTemplate::isAppend(name);
|
||||
} // ServerDraftSchematicObjectTemplate::isAppend
|
||||
|
||||
|
||||
int ServerDraftSchematicObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
if (strcmp(name, "slots") == 0)
|
||||
@@ -398,8 +398,8 @@ int ServerDraftSchematicObjectTemplate::getListLength(const char *name) const
|
||||
*/
|
||||
void ServerDraftSchematicObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerDraftSchematicObjectTemplate_tag)
|
||||
{
|
||||
@@ -409,7 +409,7 @@ void ServerDraftSchematicObjectTemplate::load(Iff &file)
|
||||
|
||||
file.enterForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
if (m_templateVersion == TAG(D, E, R, V))
|
||||
if (m_templateVersion == TAG(D,E,R,V))
|
||||
{
|
||||
file.enterForm();
|
||||
file.enterChunk();
|
||||
@@ -429,7 +429,7 @@ void ServerDraftSchematicObjectTemplate::load(Iff &file)
|
||||
file.exitForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
}
|
||||
if (getHighestTemplateVersion() != TAG(0, 0, 0, 7))
|
||||
if (getHighestTemplateVersion() != TAG(0,0,0,7))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
@@ -532,18 +532,18 @@ void ServerDraftSchematicObjectTemplate::load(Iff &file)
|
||||
*/
|
||||
void ServerDraftSchematicObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerDraftSchematicObjectTemplate_tag);
|
||||
if (m_baseTemplateName.size() != 0)
|
||||
{
|
||||
file.insertForm(TAG(D, E, R, V));
|
||||
file.insertForm(TAG(D,E,R,V));
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1);
|
||||
file.exitChunk();
|
||||
file.exitForm();
|
||||
}
|
||||
file.insertForm(TAG(0, 0, 0, 7));
|
||||
file.insertForm(TAG(0,0,0,7));
|
||||
file.allowNonlinearFunctions();
|
||||
|
||||
int paramCount = 0;
|
||||
@@ -578,7 +578,7 @@ void ServerDraftSchematicObjectTemplate::save(Iff &file)
|
||||
count = m_slots.size();
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < count; ++i)
|
||||
m_slots[i]->saveToIff(file); }
|
||||
m_slots[i]->saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
if (!m_skillCommandsLoaded)
|
||||
@@ -593,7 +593,7 @@ void ServerDraftSchematicObjectTemplate::save(Iff &file)
|
||||
count = m_skillCommands.size();
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < count; ++i)
|
||||
m_skillCommands[i]->saveToIff(file); }
|
||||
m_skillCommands[i]->saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save destroyIngredients
|
||||
@@ -614,7 +614,7 @@ void ServerDraftSchematicObjectTemplate::save(Iff &file)
|
||||
count = m_manufactureScripts.size();
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < count; ++i)
|
||||
m_manufactureScripts[i]->saveToIff(file); }
|
||||
m_manufactureScripts[i]->saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save itemsPerContainer
|
||||
@@ -647,6 +647,7 @@ void ServerDraftSchematicObjectTemplate::save(Iff &file)
|
||||
file.exitForm();
|
||||
} // ServerDraftSchematicObjectTemplate::save
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// class ServerDraftSchematicObjectTemplate::_IngredientSlot
|
||||
|
||||
@@ -655,8 +656,8 @@ void ServerDraftSchematicObjectTemplate::save(Iff &file)
|
||||
*/
|
||||
ServerDraftSchematicObjectTemplate::_IngredientSlot::_IngredientSlot(const std::string & filename)
|
||||
: TpfTemplate(filename)
|
||||
, m_optionsLoaded(false)
|
||||
, m_optionsAppend(false)
|
||||
,m_optionsLoaded(false)
|
||||
,m_optionsAppend(false)
|
||||
{
|
||||
} // ServerDraftSchematicObjectTemplate::_IngredientSlot::_IngredientSlot
|
||||
|
||||
@@ -878,6 +879,7 @@ bool ServerDraftSchematicObjectTemplate::_IngredientSlot::isAppend(const char *n
|
||||
return TpfTemplate::isAppend(name);
|
||||
} // ServerDraftSchematicObjectTemplate::_IngredientSlot::isAppend
|
||||
|
||||
|
||||
int ServerDraftSchematicObjectTemplate::_IngredientSlot::getListLength(const char *name) const
|
||||
{
|
||||
if (strcmp(name, "options") == 0)
|
||||
@@ -896,8 +898,8 @@ int ServerDraftSchematicObjectTemplate::_IngredientSlot::getListLength(const cha
|
||||
*/
|
||||
void ServerDraftSchematicObjectTemplate::_IngredientSlot::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
file.enterForm();
|
||||
|
||||
@@ -952,7 +954,7 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::load(Iff &file)
|
||||
*/
|
||||
void ServerDraftSchematicObjectTemplate::_IngredientSlot::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
int count;
|
||||
|
||||
file.insertForm(_IngredientSlot_tag);
|
||||
|
||||
@@ -982,7 +984,7 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::save(Iff &file)
|
||||
count = m_options.size();
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < count; ++i)
|
||||
m_options[i]->saveToIff(file); }
|
||||
m_options[i]->saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save optionalSkillCommand
|
||||
@@ -1013,4 +1015,4 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::save(Iff &file)
|
||||
file.exitForm(true);
|
||||
} // ServerDraftSchematicObjectTemplate::_IngredientSlot::save
|
||||
|
||||
//@END TFD
|
||||
//@END TFD
|
||||
|
||||
Executable → Regular
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerFactoryObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerFactoryObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerFactoryObjectTemplate * base = dynamic_cast<const ServerFactoryObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerFactoryObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerGroupObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerGroupObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerGroupObjectTemplate * base = dynamic_cast<const ServerGroupObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerGroupObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerGuildObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerGuildObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerGuildObjectTemplate * base = dynamic_cast<const ServerGuildObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerGuildObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerHarvesterInstallationObjectTemplate * base = dynamic_cast<const ServerHarvesterInstallationObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerInstallationObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerInstallationObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerInstallationObjectTemplate * base = dynamic_cast<const ServerInstallationObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerInstallationObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerIntangibleObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerIntangibleObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerIntangibleObjectTemplate * base = dynamic_cast<const ServerIntangibleObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerIntangibleObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerJediManagerObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerJediManagerObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerJediManagerObjectTemplate * base = dynamic_cast<const ServerJediManagerObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerJediManagerObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerManufactureInstallationObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerManufactureInstallationObjectTemplate * base = dynamic_cast<const ServerManufactureInstallationObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Executable → Regular
+28
-26
@@ -17,8 +17,9 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
@@ -26,13 +27,11 @@
|
||||
ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTemplate(const std::string & filename)
|
||||
//@BEGIN TFD INIT
|
||||
: ServerIntangibleObjectTemplate(filename)
|
||||
, m_ingredientsLoaded(false)
|
||||
, m_ingredientsAppend(false)
|
||||
, m_attributesLoaded(false)
|
||||
, m_attributesAppend(false)
|
||||
, m_templateVersion(0)
|
||||
, m_versionOk(false)
|
||||
//@END TFD INIT
|
||||
,m_ingredientsLoaded(false)
|
||||
,m_ingredientsAppend(false)
|
||||
,m_attributesLoaded(false)
|
||||
,m_attributesAppend(false)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTemplate
|
||||
|
||||
@@ -41,7 +40,7 @@ ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTempla
|
||||
*/
|
||||
ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTemplate()
|
||||
{
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@BEGIN TFD CLEANUP
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter)
|
||||
@@ -60,7 +59,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl
|
||||
}
|
||||
m_attributes.clear();
|
||||
}
|
||||
//@END TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTemplate
|
||||
|
||||
/**
|
||||
@@ -108,10 +107,10 @@ Tag ServerManufactureSchematicObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerManufactureSchematicObjectTemplate * base = dynamic_cast<const ServerManufactureSchematicObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion
|
||||
@@ -282,6 +281,7 @@ bool ServerManufactureSchematicObjectTemplate::isAppend(const char *name) const
|
||||
return ServerIntangibleObjectTemplate::isAppend(name);
|
||||
} // ServerManufactureSchematicObjectTemplate::isAppend
|
||||
|
||||
|
||||
int ServerManufactureSchematicObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
if (strcmp(name, "ingredients") == 0)
|
||||
@@ -304,8 +304,8 @@ int ServerManufactureSchematicObjectTemplate::getListLength(const char *name) co
|
||||
*/
|
||||
void ServerManufactureSchematicObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerManufactureSchematicObjectTemplate_tag)
|
||||
{
|
||||
@@ -315,7 +315,7 @@ void ServerManufactureSchematicObjectTemplate::load(Iff &file)
|
||||
|
||||
file.enterForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
if (m_templateVersion == TAG(D, E, R, V))
|
||||
if (m_templateVersion == TAG(D,E,R,V))
|
||||
{
|
||||
file.enterForm();
|
||||
file.enterChunk();
|
||||
@@ -335,7 +335,7 @@ void ServerManufactureSchematicObjectTemplate::load(Iff &file)
|
||||
file.exitForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
}
|
||||
if (getHighestTemplateVersion() != TAG(0, 0, 0, 0))
|
||||
if (getHighestTemplateVersion() != TAG(0,0,0,0))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
@@ -411,18 +411,18 @@ void ServerManufactureSchematicObjectTemplate::load(Iff &file)
|
||||
*/
|
||||
void ServerManufactureSchematicObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerManufactureSchematicObjectTemplate_tag);
|
||||
if (m_baseTemplateName.size() != 0)
|
||||
{
|
||||
file.insertForm(TAG(D, E, R, V));
|
||||
file.insertForm(TAG(D,E,R,V));
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1);
|
||||
file.exitChunk();
|
||||
file.exitForm();
|
||||
}
|
||||
file.insertForm(TAG(0, 0, 0, 0));
|
||||
file.insertForm(TAG(0,0,0,0));
|
||||
file.allowNonlinearFunctions();
|
||||
|
||||
int paramCount = 0;
|
||||
@@ -451,7 +451,7 @@ void ServerManufactureSchematicObjectTemplate::save(Iff &file)
|
||||
count = m_ingredients.size();
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < count; ++i)
|
||||
m_ingredients[i]->saveToIff(file); }
|
||||
m_ingredients[i]->saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save itemCount
|
||||
@@ -472,7 +472,7 @@ void ServerManufactureSchematicObjectTemplate::save(Iff &file)
|
||||
count = m_attributes.size();
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < count; ++i)
|
||||
m_attributes[i]->saveToIff(file); }
|
||||
m_attributes[i]->saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
|
||||
@@ -487,6 +487,7 @@ void ServerManufactureSchematicObjectTemplate::save(Iff &file)
|
||||
file.exitForm();
|
||||
} // ServerManufactureSchematicObjectTemplate::save
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// class ServerManufactureSchematicObjectTemplate::_IngredientSlot
|
||||
|
||||
@@ -635,6 +636,7 @@ bool ServerManufactureSchematicObjectTemplate::_IngredientSlot::isAppend(const c
|
||||
return TpfTemplate::isAppend(name);
|
||||
} // ServerManufactureSchematicObjectTemplate::_IngredientSlot::isAppend
|
||||
|
||||
|
||||
int ServerManufactureSchematicObjectTemplate::_IngredientSlot::getListLength(const char *name) const
|
||||
{
|
||||
return TpfTemplate::getListLength(name);
|
||||
@@ -648,8 +650,8 @@ int ServerManufactureSchematicObjectTemplate::_IngredientSlot::getListLength(con
|
||||
*/
|
||||
void ServerManufactureSchematicObjectTemplate::_IngredientSlot::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
file.enterForm();
|
||||
|
||||
@@ -679,7 +681,7 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::load(Iff &file)
|
||||
*/
|
||||
void ServerManufactureSchematicObjectTemplate::_IngredientSlot::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
int count;
|
||||
|
||||
file.insertForm(_IngredientSlot_tag);
|
||||
|
||||
@@ -708,4 +710,4 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::save(Iff &file)
|
||||
UNREF(count);
|
||||
} // ServerManufactureSchematicObjectTemplate::_IngredientSlot::save
|
||||
|
||||
//@END TFD
|
||||
//@END TFD
|
||||
|
||||
Executable → Regular
+266
@@ -0,0 +1,266 @@
|
||||
//========================================================================
|
||||
//
|
||||
// ServerMissionBoardObjectTemplate.cpp
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include "sharedTemplate/FirstSharedTemplate.h"
|
||||
#include "sharedTemplateDefinition/TemplateData.h"
|
||||
#include "sharedTemplateDefinition/TemplateGlobals.h"
|
||||
#include "ServerMissionBoardObjectTemplate.h"
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
ServerMissionBoardObjectTemplate::ServerMissionBoardObjectTemplate(const std::string & filename)
|
||||
//@BEGIN TFD INIT
|
||||
: ServerUniverseObjectTemplate(filename)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerMissionBoardObjectTemplate::ServerMissionBoardObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
ServerMissionBoardObjectTemplate::~ServerMissionBoardObjectTemplate()
|
||||
{
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // ServerMissionBoardObjectTemplate::~ServerMissionBoardObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void ServerMissionBoardObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(ServerMissionBoardObjectTemplate_tag, create);
|
||||
} // ServerMissionBoardObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a ServerMissionBoardObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * ServerMissionBoardObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new ServerMissionBoardObjectTemplate(filename);
|
||||
} // ServerMissionBoardObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag ServerMissionBoardObjectTemplate::getId(void) const
|
||||
{
|
||||
return ServerMissionBoardObjectTemplate_tag;
|
||||
} // ServerMissionBoardObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag ServerMissionBoardObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
} // ServerMissionBoardObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
* Returns the highest version of this template or it's base templates.
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag ServerMissionBoardObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
return m_templateVersion;
|
||||
const ServerMissionBoardObjectTemplate * base = dynamic_cast<const ServerMissionBoardObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerMissionBoardObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
CompilerIntegerParam * ServerMissionBoardObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
} //ServerMissionBoardObjectTemplate::getCompilerIntegerParam
|
||||
|
||||
FloatParam * ServerMissionBoardObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
} //ServerMissionBoardObjectTemplate::getFloatParam
|
||||
|
||||
BoolParam * ServerMissionBoardObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
} //ServerMissionBoardObjectTemplate::getBoolParam
|
||||
|
||||
StringParam * ServerMissionBoardObjectTemplate::getStringParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
} //ServerMissionBoardObjectTemplate::getStringParam
|
||||
|
||||
StringIdParam * ServerMissionBoardObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerMissionBoardObjectTemplate::getStringIdParam
|
||||
|
||||
VectorParam * ServerMissionBoardObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerMissionBoardObjectTemplate::getVectorParam
|
||||
|
||||
DynamicVariableParam * ServerMissionBoardObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerMissionBoardObjectTemplate::getDynamicVariableParam
|
||||
|
||||
StructParamOT * ServerMissionBoardObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerMissionBoardObjectTemplate::getStructParamOT
|
||||
|
||||
TriggerVolumeParam * ServerMissionBoardObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //ServerMissionBoardObjectTemplate::getTriggerVolumeParam
|
||||
|
||||
void ServerMissionBoardObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name)
|
||||
{
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerUniverseObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerMissionBoardObjectTemplate::initStructParamOT
|
||||
|
||||
void ServerMissionBoardObjectTemplate::setAsEmptyList(const char *name)
|
||||
{
|
||||
ServerUniverseObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerMissionBoardObjectTemplate::setAsEmptyList
|
||||
|
||||
void ServerMissionBoardObjectTemplate::setAppend(const char *name)
|
||||
{
|
||||
ServerUniverseObjectTemplate::setAppend(name);
|
||||
} // ServerMissionBoardObjectTemplate::setAppend
|
||||
|
||||
bool ServerMissionBoardObjectTemplate::isAppend(const char *name) const
|
||||
{
|
||||
return ServerUniverseObjectTemplate::isAppend(name);
|
||||
} // ServerMissionBoardObjectTemplate::isAppend
|
||||
|
||||
|
||||
int ServerMissionBoardObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getListLength(name);
|
||||
} // ServerMissionBoardObjectTemplate::getListLength
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
* for this template.
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void ServerMissionBoardObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerMissionBoardObjectTemplate_tag)
|
||||
{
|
||||
ServerUniverseObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
if (m_templateVersion == TAG(D,E,R,V))
|
||||
{
|
||||
file.enterForm();
|
||||
file.enterChunk();
|
||||
std::string baseFilename;
|
||||
file.read_string(baseFilename);
|
||||
file.exitChunk();
|
||||
const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename);
|
||||
DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str()));
|
||||
if (m_baseData == base && base != nullptr)
|
||||
base->releaseReference();
|
||||
else
|
||||
{
|
||||
if (m_baseData != nullptr)
|
||||
m_baseData->releaseReference();
|
||||
m_baseData = base;
|
||||
}
|
||||
file.exitForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
}
|
||||
if (getHighestTemplateVersion() != TAG(0,0,0,0))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
UNREF(paramName);
|
||||
UNREF(paramCount);
|
||||
|
||||
file.exitForm();
|
||||
ServerUniverseObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerMissionBoardObjectTemplate::load
|
||||
|
||||
/**
|
||||
* Saves the template data to an iff file.
|
||||
*
|
||||
* @param file file to save to
|
||||
* @param location file type (client or server)
|
||||
*/
|
||||
void ServerMissionBoardObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerMissionBoardObjectTemplate_tag);
|
||||
if (m_baseTemplateName.size() != 0)
|
||||
{
|
||||
file.insertForm(TAG(D,E,R,V));
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1);
|
||||
file.exitChunk();
|
||||
file.exitForm();
|
||||
}
|
||||
file.insertForm(TAG(0,0,0,0));
|
||||
file.allowNonlinearFunctions();
|
||||
|
||||
int paramCount = 0;
|
||||
|
||||
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
|
||||
file.exitForm(true);
|
||||
ServerUniverseObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
UNREF(count);
|
||||
} // ServerMissionBoardObjectTemplate::save
|
||||
|
||||
//@END TFD
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
//========================================================================
|
||||
//
|
||||
// ServerMissionBoardObjectTemplate.h
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef _INCLUDED_ServerMissionBoardObjectTemplate_H
|
||||
#define _INCLUDED_ServerMissionBoardObjectTemplate_H
|
||||
|
||||
#include "ServerUniverseObjectTemplate.h"
|
||||
#include "sharedFoundation/DynamicVariable.h"
|
||||
#include "sharedTemplateDefinition/TpfTemplate.h"
|
||||
|
||||
|
||||
class Vector;
|
||||
typedef StructParam<ObjectTemplate> StructParamOT;
|
||||
|
||||
|
||||
class ServerMissionBoardObjectTemplate : public ServerUniverseObjectTemplate
|
||||
{
|
||||
public:
|
||||
//@BEGIN TFD ID
|
||||
enum
|
||||
{
|
||||
ServerMissionBoardObjectTemplate_tag = TAG(M,I,S,B)
|
||||
};
|
||||
//@END TFD ID
|
||||
public:
|
||||
ServerMissionBoardObjectTemplate(const std::string & filename);
|
||||
virtual ~ServerMissionBoardObjectTemplate();
|
||||
|
||||
virtual Tag getId(void) const;
|
||||
virtual Tag getTemplateVersion(void) const;
|
||||
virtual Tag getHighestTemplateVersion(void) const;
|
||||
static void install(void);
|
||||
|
||||
//@BEGIN TFD
|
||||
public:
|
||||
virtual CompilerIntegerParam *getCompilerIntegerParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual FloatParam *getFloatParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual BoolParam *getBoolParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual StringParam *getStringParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual StringIdParam *getStringIdParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual VectorParam *getVectorParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual DynamicVariableParam *getDynamicVariableParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual StructParamOT *getStructParamOT(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual TriggerVolumeParam *getTriggerVolumeParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual void initStructParamOT(StructParamOT ¶m, const char *name);
|
||||
virtual void setAsEmptyList(const char *name);
|
||||
virtual void setAppend(const char *name);
|
||||
virtual bool isAppend(const char *name) const;
|
||||
virtual int getListLength(const char *name) const;
|
||||
|
||||
protected:
|
||||
virtual void load(Iff &file);
|
||||
virtual void save(Iff &file);
|
||||
|
||||
private:
|
||||
//@END TFD
|
||||
|
||||
private:
|
||||
Tag m_templateVersion; // the template version
|
||||
bool m_versionOk; // flag that the template version loaded is the one we expect
|
||||
|
||||
static void registerMe(void);
|
||||
static ObjectTemplate * create(const std::string & filename);
|
||||
|
||||
// no copying
|
||||
ServerMissionBoardObjectTemplate(const ServerMissionBoardObjectTemplate &);
|
||||
ServerMissionBoardObjectTemplate & operator =(const ServerMissionBoardObjectTemplate &);
|
||||
};
|
||||
|
||||
|
||||
inline void ServerMissionBoardObjectTemplate::install(void)
|
||||
{
|
||||
//@BEGIN TFD INSTALL
|
||||
ServerMissionBoardObjectTemplate::registerMe();
|
||||
//@END TFD INSTALL
|
||||
}
|
||||
|
||||
|
||||
#endif // _INCLUDED_ServerMissionBoardObjectTemplate_H
|
||||
+266
@@ -0,0 +1,266 @@
|
||||
//========================================================================
|
||||
//
|
||||
// ServerMissionDataObjectTemplate.cpp
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include "sharedTemplate/FirstSharedTemplate.h"
|
||||
#include "sharedTemplateDefinition/TemplateData.h"
|
||||
#include "sharedTemplateDefinition/TemplateGlobals.h"
|
||||
#include "ServerMissionDataObjectTemplate.h"
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
ServerMissionDataObjectTemplate::ServerMissionDataObjectTemplate(const std::string & filename)
|
||||
//@BEGIN TFD INIT
|
||||
: ServerIntangibleObjectTemplate(filename)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerMissionDataObjectTemplate::ServerMissionDataObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
ServerMissionDataObjectTemplate::~ServerMissionDataObjectTemplate()
|
||||
{
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // ServerMissionDataObjectTemplate::~ServerMissionDataObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void ServerMissionDataObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(ServerMissionDataObjectTemplate_tag, create);
|
||||
} // ServerMissionDataObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a ServerMissionDataObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * ServerMissionDataObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new ServerMissionDataObjectTemplate(filename);
|
||||
} // ServerMissionDataObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag ServerMissionDataObjectTemplate::getId(void) const
|
||||
{
|
||||
return ServerMissionDataObjectTemplate_tag;
|
||||
} // ServerMissionDataObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag ServerMissionDataObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
} // ServerMissionDataObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
* Returns the highest version of this template or it's base templates.
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag ServerMissionDataObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
return m_templateVersion;
|
||||
const ServerMissionDataObjectTemplate * base = dynamic_cast<const ServerMissionDataObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerMissionDataObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
CompilerIntegerParam * ServerMissionDataObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
} //ServerMissionDataObjectTemplate::getCompilerIntegerParam
|
||||
|
||||
FloatParam * ServerMissionDataObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
} //ServerMissionDataObjectTemplate::getFloatParam
|
||||
|
||||
BoolParam * ServerMissionDataObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
} //ServerMissionDataObjectTemplate::getBoolParam
|
||||
|
||||
StringParam * ServerMissionDataObjectTemplate::getStringParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
} //ServerMissionDataObjectTemplate::getStringParam
|
||||
|
||||
StringIdParam * ServerMissionDataObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerMissionDataObjectTemplate::getStringIdParam
|
||||
|
||||
VectorParam * ServerMissionDataObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerMissionDataObjectTemplate::getVectorParam
|
||||
|
||||
DynamicVariableParam * ServerMissionDataObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerMissionDataObjectTemplate::getDynamicVariableParam
|
||||
|
||||
StructParamOT * ServerMissionDataObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerMissionDataObjectTemplate::getStructParamOT
|
||||
|
||||
TriggerVolumeParam * ServerMissionDataObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //ServerMissionDataObjectTemplate::getTriggerVolumeParam
|
||||
|
||||
void ServerMissionDataObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name)
|
||||
{
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerIntangibleObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerMissionDataObjectTemplate::initStructParamOT
|
||||
|
||||
void ServerMissionDataObjectTemplate::setAsEmptyList(const char *name)
|
||||
{
|
||||
ServerIntangibleObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerMissionDataObjectTemplate::setAsEmptyList
|
||||
|
||||
void ServerMissionDataObjectTemplate::setAppend(const char *name)
|
||||
{
|
||||
ServerIntangibleObjectTemplate::setAppend(name);
|
||||
} // ServerMissionDataObjectTemplate::setAppend
|
||||
|
||||
bool ServerMissionDataObjectTemplate::isAppend(const char *name) const
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::isAppend(name);
|
||||
} // ServerMissionDataObjectTemplate::isAppend
|
||||
|
||||
|
||||
int ServerMissionDataObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getListLength(name);
|
||||
} // ServerMissionDataObjectTemplate::getListLength
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
* for this template.
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void ServerMissionDataObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerMissionDataObjectTemplate_tag)
|
||||
{
|
||||
ServerIntangibleObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
if (m_templateVersion == TAG(D,E,R,V))
|
||||
{
|
||||
file.enterForm();
|
||||
file.enterChunk();
|
||||
std::string baseFilename;
|
||||
file.read_string(baseFilename);
|
||||
file.exitChunk();
|
||||
const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename);
|
||||
DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str()));
|
||||
if (m_baseData == base && base != nullptr)
|
||||
base->releaseReference();
|
||||
else
|
||||
{
|
||||
if (m_baseData != nullptr)
|
||||
m_baseData->releaseReference();
|
||||
m_baseData = base;
|
||||
}
|
||||
file.exitForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
}
|
||||
if (getHighestTemplateVersion() != TAG(0,0,0,0))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
UNREF(paramName);
|
||||
UNREF(paramCount);
|
||||
|
||||
file.exitForm();
|
||||
ServerIntangibleObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerMissionDataObjectTemplate::load
|
||||
|
||||
/**
|
||||
* Saves the template data to an iff file.
|
||||
*
|
||||
* @param file file to save to
|
||||
* @param location file type (client or server)
|
||||
*/
|
||||
void ServerMissionDataObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerMissionDataObjectTemplate_tag);
|
||||
if (m_baseTemplateName.size() != 0)
|
||||
{
|
||||
file.insertForm(TAG(D,E,R,V));
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1);
|
||||
file.exitChunk();
|
||||
file.exitForm();
|
||||
}
|
||||
file.insertForm(TAG(0,0,0,0));
|
||||
file.allowNonlinearFunctions();
|
||||
|
||||
int paramCount = 0;
|
||||
|
||||
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
|
||||
file.exitForm(true);
|
||||
ServerIntangibleObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
UNREF(count);
|
||||
} // ServerMissionDataObjectTemplate::save
|
||||
|
||||
//@END TFD
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
//========================================================================
|
||||
//
|
||||
// ServerMissionDataObjectTemplate.h
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef _INCLUDED_ServerMissionDataObjectTemplate_H
|
||||
#define _INCLUDED_ServerMissionDataObjectTemplate_H
|
||||
|
||||
#include "ServerIntangibleObjectTemplate.h"
|
||||
#include "sharedFoundation/DynamicVariable.h"
|
||||
#include "sharedTemplateDefinition/TpfTemplate.h"
|
||||
|
||||
|
||||
class Vector;
|
||||
typedef StructParam<ObjectTemplate> StructParamOT;
|
||||
|
||||
|
||||
class ServerMissionDataObjectTemplate : public ServerIntangibleObjectTemplate
|
||||
{
|
||||
public:
|
||||
//@BEGIN TFD ID
|
||||
enum
|
||||
{
|
||||
ServerMissionDataObjectTemplate_tag = TAG(M,I,S,D)
|
||||
};
|
||||
//@END TFD ID
|
||||
public:
|
||||
ServerMissionDataObjectTemplate(const std::string & filename);
|
||||
virtual ~ServerMissionDataObjectTemplate();
|
||||
|
||||
virtual Tag getId(void) const;
|
||||
virtual Tag getTemplateVersion(void) const;
|
||||
virtual Tag getHighestTemplateVersion(void) const;
|
||||
static void install(void);
|
||||
|
||||
//@BEGIN TFD
|
||||
public:
|
||||
virtual CompilerIntegerParam *getCompilerIntegerParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual FloatParam *getFloatParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual BoolParam *getBoolParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual StringParam *getStringParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual StringIdParam *getStringIdParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual VectorParam *getVectorParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual DynamicVariableParam *getDynamicVariableParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual StructParamOT *getStructParamOT(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual TriggerVolumeParam *getTriggerVolumeParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual void initStructParamOT(StructParamOT ¶m, const char *name);
|
||||
virtual void setAsEmptyList(const char *name);
|
||||
virtual void setAppend(const char *name);
|
||||
virtual bool isAppend(const char *name) const;
|
||||
virtual int getListLength(const char *name) const;
|
||||
|
||||
protected:
|
||||
virtual void load(Iff &file);
|
||||
virtual void save(Iff &file);
|
||||
|
||||
private:
|
||||
//@END TFD
|
||||
|
||||
private:
|
||||
Tag m_templateVersion; // the template version
|
||||
bool m_versionOk; // flag that the template version loaded is the one we expect
|
||||
|
||||
static void registerMe(void);
|
||||
static ObjectTemplate * create(const std::string & filename);
|
||||
|
||||
// no copying
|
||||
ServerMissionDataObjectTemplate(const ServerMissionDataObjectTemplate &);
|
||||
ServerMissionDataObjectTemplate & operator =(const ServerMissionDataObjectTemplate &);
|
||||
};
|
||||
|
||||
|
||||
inline void ServerMissionDataObjectTemplate::install(void)
|
||||
{
|
||||
//@BEGIN TFD INSTALL
|
||||
ServerMissionDataObjectTemplate::registerMe();
|
||||
//@END TFD INSTALL
|
||||
}
|
||||
|
||||
|
||||
#endif // _INCLUDED_ServerMissionDataObjectTemplate_H
|
||||
+266
@@ -0,0 +1,266 @@
|
||||
//========================================================================
|
||||
//
|
||||
// ServerMissionListEntryObjectTemplate.cpp
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include "sharedTemplate/FirstSharedTemplate.h"
|
||||
#include "sharedTemplateDefinition/TemplateData.h"
|
||||
#include "sharedTemplateDefinition/TemplateGlobals.h"
|
||||
#include "ServerMissionListEntryObjectTemplate.h"
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
ServerMissionListEntryObjectTemplate::ServerMissionListEntryObjectTemplate(const std::string & filename)
|
||||
//@BEGIN TFD INIT
|
||||
: ServerIntangibleObjectTemplate(filename)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerMissionListEntryObjectTemplate::ServerMissionListEntryObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
ServerMissionListEntryObjectTemplate::~ServerMissionListEntryObjectTemplate()
|
||||
{
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // ServerMissionListEntryObjectTemplate::~ServerMissionListEntryObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void ServerMissionListEntryObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(ServerMissionListEntryObjectTemplate_tag, create);
|
||||
} // ServerMissionListEntryObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a ServerMissionListEntryObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * ServerMissionListEntryObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new ServerMissionListEntryObjectTemplate(filename);
|
||||
} // ServerMissionListEntryObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag ServerMissionListEntryObjectTemplate::getId(void) const
|
||||
{
|
||||
return ServerMissionListEntryObjectTemplate_tag;
|
||||
} // ServerMissionListEntryObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag ServerMissionListEntryObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
} // ServerMissionListEntryObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
* Returns the highest version of this template or it's base templates.
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag ServerMissionListEntryObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
return m_templateVersion;
|
||||
const ServerMissionListEntryObjectTemplate * base = dynamic_cast<const ServerMissionListEntryObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerMissionListEntryObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
CompilerIntegerParam * ServerMissionListEntryObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
} //ServerMissionListEntryObjectTemplate::getCompilerIntegerParam
|
||||
|
||||
FloatParam * ServerMissionListEntryObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
} //ServerMissionListEntryObjectTemplate::getFloatParam
|
||||
|
||||
BoolParam * ServerMissionListEntryObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
} //ServerMissionListEntryObjectTemplate::getBoolParam
|
||||
|
||||
StringParam * ServerMissionListEntryObjectTemplate::getStringParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
} //ServerMissionListEntryObjectTemplate::getStringParam
|
||||
|
||||
StringIdParam * ServerMissionListEntryObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerMissionListEntryObjectTemplate::getStringIdParam
|
||||
|
||||
VectorParam * ServerMissionListEntryObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerMissionListEntryObjectTemplate::getVectorParam
|
||||
|
||||
DynamicVariableParam * ServerMissionListEntryObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerMissionListEntryObjectTemplate::getDynamicVariableParam
|
||||
|
||||
StructParamOT * ServerMissionListEntryObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerMissionListEntryObjectTemplate::getStructParamOT
|
||||
|
||||
TriggerVolumeParam * ServerMissionListEntryObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //ServerMissionListEntryObjectTemplate::getTriggerVolumeParam
|
||||
|
||||
void ServerMissionListEntryObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name)
|
||||
{
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerIntangibleObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerMissionListEntryObjectTemplate::initStructParamOT
|
||||
|
||||
void ServerMissionListEntryObjectTemplate::setAsEmptyList(const char *name)
|
||||
{
|
||||
ServerIntangibleObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerMissionListEntryObjectTemplate::setAsEmptyList
|
||||
|
||||
void ServerMissionListEntryObjectTemplate::setAppend(const char *name)
|
||||
{
|
||||
ServerIntangibleObjectTemplate::setAppend(name);
|
||||
} // ServerMissionListEntryObjectTemplate::setAppend
|
||||
|
||||
bool ServerMissionListEntryObjectTemplate::isAppend(const char *name) const
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::isAppend(name);
|
||||
} // ServerMissionListEntryObjectTemplate::isAppend
|
||||
|
||||
|
||||
int ServerMissionListEntryObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
return ServerIntangibleObjectTemplate::getListLength(name);
|
||||
} // ServerMissionListEntryObjectTemplate::getListLength
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
* for this template.
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void ServerMissionListEntryObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerMissionListEntryObjectTemplate_tag)
|
||||
{
|
||||
ServerIntangibleObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
if (m_templateVersion == TAG(D,E,R,V))
|
||||
{
|
||||
file.enterForm();
|
||||
file.enterChunk();
|
||||
std::string baseFilename;
|
||||
file.read_string(baseFilename);
|
||||
file.exitChunk();
|
||||
const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename);
|
||||
DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str()));
|
||||
if (m_baseData == base && base != nullptr)
|
||||
base->releaseReference();
|
||||
else
|
||||
{
|
||||
if (m_baseData != nullptr)
|
||||
m_baseData->releaseReference();
|
||||
m_baseData = base;
|
||||
}
|
||||
file.exitForm();
|
||||
m_templateVersion = file.getCurrentName();
|
||||
}
|
||||
if (getHighestTemplateVersion() != TAG(0,0,0,0))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
UNREF(paramName);
|
||||
UNREF(paramCount);
|
||||
|
||||
file.exitForm();
|
||||
ServerIntangibleObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerMissionListEntryObjectTemplate::load
|
||||
|
||||
/**
|
||||
* Saves the template data to an iff file.
|
||||
*
|
||||
* @param file file to save to
|
||||
* @param location file type (client or server)
|
||||
*/
|
||||
void ServerMissionListEntryObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerMissionListEntryObjectTemplate_tag);
|
||||
if (m_baseTemplateName.size() != 0)
|
||||
{
|
||||
file.insertForm(TAG(D,E,R,V));
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1);
|
||||
file.exitChunk();
|
||||
file.exitForm();
|
||||
}
|
||||
file.insertForm(TAG(0,0,0,0));
|
||||
file.allowNonlinearFunctions();
|
||||
|
||||
int paramCount = 0;
|
||||
|
||||
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
|
||||
file.exitForm(true);
|
||||
ServerIntangibleObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
UNREF(count);
|
||||
} // ServerMissionListEntryObjectTemplate::save
|
||||
|
||||
//@END TFD
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
//========================================================================
|
||||
//
|
||||
// ServerMissionListEntryObjectTemplate.h
|
||||
//
|
||||
//IMPORTANT: Any code between //@BEGIN TFD... and //@END TFD... will be
|
||||
//overwritten the next time the template definition is compiled. Do not
|
||||
//make changes to code inside these blocks.
|
||||
//
|
||||
// copyright 2001 Sony Online Entertainment
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#ifndef _INCLUDED_ServerMissionListEntryObjectTemplate_H
|
||||
#define _INCLUDED_ServerMissionListEntryObjectTemplate_H
|
||||
|
||||
#include "ServerIntangibleObjectTemplate.h"
|
||||
#include "sharedFoundation/DynamicVariable.h"
|
||||
#include "sharedTemplateDefinition/TpfTemplate.h"
|
||||
|
||||
|
||||
class Vector;
|
||||
typedef StructParam<ObjectTemplate> StructParamOT;
|
||||
|
||||
|
||||
class ServerMissionListEntryObjectTemplate : public ServerIntangibleObjectTemplate
|
||||
{
|
||||
public:
|
||||
//@BEGIN TFD ID
|
||||
enum
|
||||
{
|
||||
ServerMissionListEntryObjectTemplate_tag = TAG(M,L,E,O)
|
||||
};
|
||||
//@END TFD ID
|
||||
public:
|
||||
ServerMissionListEntryObjectTemplate(const std::string & filename);
|
||||
virtual ~ServerMissionListEntryObjectTemplate();
|
||||
|
||||
virtual Tag getId(void) const;
|
||||
virtual Tag getTemplateVersion(void) const;
|
||||
virtual Tag getHighestTemplateVersion(void) const;
|
||||
static void install(void);
|
||||
|
||||
//@BEGIN TFD
|
||||
public:
|
||||
virtual CompilerIntegerParam *getCompilerIntegerParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual FloatParam *getFloatParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual BoolParam *getBoolParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual StringParam *getStringParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual StringIdParam *getStringIdParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual VectorParam *getVectorParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual DynamicVariableParam *getDynamicVariableParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual StructParamOT *getStructParamOT(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual TriggerVolumeParam *getTriggerVolumeParam(const char *name, bool deepCheck = true, int index = 0);
|
||||
virtual void initStructParamOT(StructParamOT ¶m, const char *name);
|
||||
virtual void setAsEmptyList(const char *name);
|
||||
virtual void setAppend(const char *name);
|
||||
virtual bool isAppend(const char *name) const;
|
||||
virtual int getListLength(const char *name) const;
|
||||
|
||||
protected:
|
||||
virtual void load(Iff &file);
|
||||
virtual void save(Iff &file);
|
||||
|
||||
private:
|
||||
//@END TFD
|
||||
|
||||
private:
|
||||
Tag m_templateVersion; // the template version
|
||||
bool m_versionOk; // flag that the template version loaded is the one we expect
|
||||
|
||||
static void registerMe(void);
|
||||
static ObjectTemplate * create(const std::string & filename);
|
||||
|
||||
// no copying
|
||||
ServerMissionListEntryObjectTemplate(const ServerMissionListEntryObjectTemplate &);
|
||||
ServerMissionListEntryObjectTemplate & operator =(const ServerMissionListEntryObjectTemplate &);
|
||||
};
|
||||
|
||||
|
||||
inline void ServerMissionListEntryObjectTemplate::install(void)
|
||||
{
|
||||
//@BEGIN TFD INSTALL
|
||||
ServerMissionListEntryObjectTemplate::registerMe();
|
||||
//@END TFD INSTALL
|
||||
}
|
||||
|
||||
|
||||
#endif // _INCLUDED_ServerMissionListEntryObjectTemplate_H
|
||||
Executable → Regular
+3
-4
@@ -17,8 +17,7 @@
|
||||
#include "sharedDebug/DataLint.h"
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
@@ -86,10 +85,10 @@ Tag ServerMissionObjectTemplate::getTemplateVersion(void) const
|
||||
*/
|
||||
Tag ServerMissionObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == nullptr)
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerMissionObjectTemplate * base = dynamic_cast<const ServerMissionObjectTemplate *>(m_baseData);
|
||||
if (base == nullptr)
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerMissionObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
Executable → Regular
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user