mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-14 23:07:48 -04:00
Merge remote-tracking branch 'local/testing'
This commit is contained in:
+3
-3
@@ -29,8 +29,8 @@ find_package(Threads)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(CURL REQUIRED)
|
||||
|
||||
# c++14 yeah!
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
# c++17 yeah!
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
@@ -105,7 +105,7 @@ elseif (UNIX)
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE} -flto -fwhole-program-vtables")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# O3 and Ofast include one or more flags that cause java to crash when using gcc6
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-signed-zeros -freciprocal-math -fno-unroll-loops -fno-tree-loop-optimize")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-signed-zeros -freciprocal-math -fno-unroll-loops -fno-tree-loop-optimize -fno-plt")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
|
||||
add_subdirectory(application)
|
||||
if (DEFINED _MIFF OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
add_subdirectory(application)
|
||||
endif()
|
||||
|
||||
Binary file not shown.
@@ -1,3 +1,5 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include "sharedFoundation/FirstSharedFoundation.h"
|
||||
|
||||
#include "ConfigCentralServer.h"
|
||||
@@ -12,17 +14,29 @@
|
||||
#include "sharedRandom/SetupSharedRandom.h"
|
||||
#include "sharedThread/SetupSharedThread.h"
|
||||
|
||||
#ifndef STELLA_INTERNAL
|
||||
#include "webAPIHeartbeat.h"
|
||||
#ifdef ENABLE_PROFILING
|
||||
extern "C" int __llvm_profile_write_file(void);
|
||||
#endif
|
||||
|
||||
inline void signalHandler(int s){
|
||||
printf("PlanetServer terminating, signal %d\n",s);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
#ifndef STELLA_INTERNAL
|
||||
StellaBellum::webAPIHeartbeat();
|
||||
#endif
|
||||
struct sigaction sigIntHandler;
|
||||
sigIntHandler.sa_handler = signalHandler;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
@@ -60,6 +74,7 @@ int main(int argc, char ** argv)
|
||||
SetupSharedFoundation::remove();
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
exit(0);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1233,7 +1233,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons
|
||||
DEBUG_REPORT_LOG(true, ("Pending character %lu is logging in or dropping\n", m.getAccountNumber()));
|
||||
|
||||
// Once they're logged in, Central doesn't need to know about them anymore:
|
||||
removeSuidFromAccountConnectionMap(m.getAccountNumber());
|
||||
removeFromAccountConnectionMap(m.getAccountNumber());
|
||||
break;
|
||||
}
|
||||
case constcrc("CharacterListMessage") : {
|
||||
@@ -1998,7 +1998,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons
|
||||
break;
|
||||
}
|
||||
case constcrc("DatabaseSaveStart") : {
|
||||
LOG("CentralServer", ("Received DatabaseSaveStart network message."));
|
||||
//LOG("CentralServer", ("Received DatabaseSaveStart network message."));
|
||||
if (m_shutdownPhase == 4) {
|
||||
LOG("CentralServerShutdown", ("Shutdown Phase %d: Setting indicator for receipt of DatabaseSaveStart.", m_shutdownPhase));
|
||||
m_shutdownHaveDatabaseSaveStart = true;
|
||||
@@ -2014,7 +2014,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons
|
||||
case constcrc("DatabaseSaveComplete") : {
|
||||
Archive::ReadIterator ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
|
||||
GenericValueTypeMessage<int> msg(ri);
|
||||
LOG("CentralServer", ("Received DatabaseSaveComplete network message."));
|
||||
//LOG("CentralServer", ("Received DatabaseSaveComplete network message."));
|
||||
|
||||
// tell all the Planet Servers that the save finished
|
||||
sendToAllPlanetServers(msg, true);
|
||||
@@ -3419,7 +3419,7 @@ void CentralServer::addToAccountConnectionMap(StationId suid, ConnectionServerCo
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void CentralServer::removeSuidFromAccountConnectionMap(StationId suid)
|
||||
void CentralServer::removeFromAccountConnectionMap(StationId suid)
|
||||
{
|
||||
ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid);
|
||||
if (i!=m_accountConnectionMap.end())
|
||||
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
|
||||
void getCharacterMatchStatistics(int & numberOfCharacterMatchRequests, int & numberOfCharacterMatchResultsPerRequest, int & timeSpentPerCharacterMatchRequestMs);
|
||||
|
||||
void removeSuidFromAccountConnectionMap(StationId suid);
|
||||
void removeFromAccountConnectionMap(StationId suid);
|
||||
|
||||
private:
|
||||
void handleRequestGameServerForLoginMessage (const RequestGameServerForLoginMessage & msg);
|
||||
|
||||
@@ -254,7 +254,7 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message)
|
||||
s_pseudoClientConnectionMap[info.getValue().first] = std::make_pair(static_cast<TransferRequestMoveValidation::TransferRequestSource>(info.getValue().second), this);
|
||||
|
||||
// remove corresponding "non pseudo client connection"
|
||||
CentralServer::getInstance().removeSuidFromAccountConnectionMap(static_cast<StationId>(info.getValue().first));
|
||||
CentralServer::getInstance().removeFromAccountConnectionMap(static_cast<StationId>(info.getValue().first));
|
||||
break;
|
||||
}
|
||||
case constcrc("DestroyPseudoClientConnection") :
|
||||
@@ -443,4 +443,4 @@ void ConnectionServerConnection::removeFromAccountConnectionMap(unsigned int sta
|
||||
{
|
||||
s_pseudoClientConnectionMap.erase(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -12,10 +12,31 @@
|
||||
#include "sharedRandom/SetupSharedRandom.h"
|
||||
#include "sharedThread/SetupSharedThread.h"
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
extern "C" int __llvm_profile_write_file(void);
|
||||
#endif
|
||||
|
||||
inline void signalHandler(int s){
|
||||
printf("PlanetServer terminating, signal %d\n",s);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct sigaction sigIntHandler;
|
||||
sigIntHandler.sa_handler = signalHandler;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
|
||||
@@ -40,6 +61,7 @@ int main(int argc, char ** argv)
|
||||
SetupSharedFoundation::remove();
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
exit(0);
|
||||
#endif
|
||||
|
||||
|
||||
Binary file not shown.
@@ -3,6 +3,7 @@
|
||||
// Author: Justin Randall
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
#include <signal.h>
|
||||
|
||||
#include "FirstCommodityServer.h"
|
||||
|
||||
@@ -27,10 +28,30 @@
|
||||
#include "LocalizationManager.h"
|
||||
#include "UnicodeUtils.h"
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
extern "C" int __llvm_profile_write_file(void);
|
||||
#endif
|
||||
|
||||
inline void signalHandler(int s){
|
||||
printf("CommoditiesServer terminating, signal %d\n",s);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct sigaction sigIntHandler;
|
||||
sigIntHandler.sa_handler = signalHandler;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
|
||||
@@ -74,6 +95,10 @@ int main(int argc, char ** argv)
|
||||
SetupSharedFoundation::remove();
|
||||
SetupSharedThread::remove();
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
exit(0);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,3 +1,5 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include "FirstConnectionServer.h"
|
||||
#include "ConfigConnectionServer.h"
|
||||
#include "ConnectionServer.h"
|
||||
@@ -12,10 +14,20 @@
|
||||
#include "sharedRandom/SetupSharedRandom.h"
|
||||
#include "sharedThread/SetupSharedThread.h"
|
||||
|
||||
#ifndef STELLA_INTERNAL
|
||||
#include "webAPIHeartbeat.h"
|
||||
#ifdef ENABLE_PROFILING
|
||||
extern "C" int __llvm_profile_write_file(void);
|
||||
#endif
|
||||
|
||||
inline void signalHandler(int s){
|
||||
printf("ConnectionServer terminating, signal %d\n",s);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
void dumpPid(const char * argv)
|
||||
@@ -29,9 +41,11 @@ void dumpPid(const char * argv)
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
#ifndef STELLA_INTERNAL
|
||||
StellaBellum::webAPIHeartbeat();
|
||||
#endif
|
||||
struct sigaction sigIntHandler;
|
||||
sigIntHandler.sa_handler = signalHandler;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
@@ -63,7 +77,7 @@ int main(int argc, char ** argv)
|
||||
SetupSharedThread::remove();
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
exit(0);
|
||||
__llvm_profile_write_file();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -161,7 +161,7 @@ void ConnectionServer::addGameConnection(unsigned long gameServerId, GameConnect
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
bool
|
||||
ConnectionServer::decryptToken(const KeyShare::Token &token, StationId &stationUserId, bool &secure, std::string &accountName) {
|
||||
ConnectionServer::decryptToken(const KeyShare::Token &token, uint32 &stationUserId, bool &secure, std::string &accountName) {
|
||||
static ConnectionServer &cs = instance();
|
||||
|
||||
//Also the sizeof(int) is likewise magic from the session api
|
||||
@@ -179,7 +179,7 @@ ConnectionServer::decryptToken(const KeyShare::Token &token, StationId &stationU
|
||||
char *tmpBuffer = new char[MAX_ACCOUNT_NAME_LENGTH + 1];
|
||||
memset(tmpBuffer, 0, MAX_ACCOUNT_NAME_LENGTH + 1);
|
||||
|
||||
memcpy(&stationUserId, keyBufferPointer, sizeof(StationId));
|
||||
memcpy(&stationUserId, keyBufferPointer, sizeof(uint32));
|
||||
keyBufferPointer += sizeof(uint32);
|
||||
memcpy(&secure, keyBufferPointer, sizeof(bool));
|
||||
keyBufferPointer += sizeof(bool);
|
||||
|
||||
@@ -48,7 +48,7 @@ class ConnectionServer : public MessageDispatch::Receiver
|
||||
static void addNewClient(ClientConnection* cconn, const NetworkId &oid, GameConnection* gconn, const std::string &sceneName, bool sendToStarport );
|
||||
static void addConnectedClient(uint32 suid, ClientConnection* conn);
|
||||
static void addGameConnection(unsigned long gameServerId, GameConnection* gc);
|
||||
static bool decryptToken(const KeyShare::Token & token, StationId & stationUserId, bool & secure, std::string & accountName);
|
||||
static bool decryptToken(const KeyShare::Token & token, uint32 & stationUserId, bool & secure, std::string & accountName);
|
||||
static bool decryptToken(const KeyShare::Token & token, char* sessionKey, StationId & stationId);
|
||||
static CentralConnection * getCentralConnection();
|
||||
static void dropClient(ClientConnection * conn, const std::string &description);
|
||||
|
||||
Binary file not shown.
@@ -6,6 +6,8 @@
|
||||
//
|
||||
// ======================================================================
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include "sharedFoundation/FirstSharedFoundation.h"
|
||||
#include "LogServer.h"
|
||||
|
||||
@@ -17,16 +19,30 @@
|
||||
#include "sharedNetworkMessages/SetupSharedNetworkMessages.h"
|
||||
#include "sharedThread/SetupSharedThread.h"
|
||||
|
||||
#ifndef STELLA_INTERNAL
|
||||
#include "webAPIHeartbeat.h"
|
||||
#ifdef ENABLE_PROFILING
|
||||
extern "C" int __llvm_profile_write_file(void);
|
||||
#endif
|
||||
|
||||
|
||||
inline void signalHandler(int s){
|
||||
printf("LogServer terminating, signal %d\n",s);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#ifndef STELLA_INTERNAL
|
||||
StellaBellum::webAPIHeartbeat();
|
||||
#endif
|
||||
struct sigaction sigIntHandler;
|
||||
sigIntHandler.sa_handler = signalHandler;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
@@ -55,9 +71,9 @@ int main(int argc, char **argv)
|
||||
SetupSharedThread::remove();
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
exit(0);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,9 +1,6 @@
|
||||
#include "sharedFoundation/FirstSharedFoundation.h"
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "sharedFoundation/FirstSharedFoundation.h"
|
||||
#include "ConfigLoginServer.h"
|
||||
#include "LoginServer.h"
|
||||
|
||||
@@ -17,23 +14,28 @@
|
||||
#include "sharedRandom/SetupSharedRandom.h"
|
||||
#include "sharedThread/SetupSharedThread.h"
|
||||
|
||||
// ======================================================================
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
inline void signalHandler(int s){
|
||||
printf("LoginServer terminating, signal %d\n",s);
|
||||
exit(0);
|
||||
}
|
||||
extern "C" int __llvm_profile_write_file(void);
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// ======================================================================
|
||||
|
||||
inline void signalHandler(int s){
|
||||
printf("LoginServer terminating, signal %d\n",s);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
struct sigaction sigIntHandler;
|
||||
sigIntHandler.sa_handler = signalHandler;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
#endif
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
@@ -63,5 +65,9 @@ int main(int argc, char **argv) {
|
||||
SetupSharedFoundation::callbackWithExceptionHandling(LoginServer::run);
|
||||
SetupSharedFoundation::remove();
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
exit(0);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -154,6 +154,7 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
bool authOK = false;
|
||||
bool testMode = false;
|
||||
static const std::string authURL(ConfigLoginServer::getExternalAuthUrl());
|
||||
static const bool useSimpleAuth = ConfigLoginServer::getUseSimpleAuth();
|
||||
|
||||
std::string uname;
|
||||
std::string parentAccount;
|
||||
@@ -161,55 +162,90 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
|
||||
StationId user_id;
|
||||
StationId parent_id;
|
||||
std::unordered_map<StationId, std::string> childAccounts;
|
||||
std::unordered_map<int, std::string> childAccounts;
|
||||
|
||||
if (!authURL.empty()) {
|
||||
// create the object
|
||||
webAPI api(authURL);
|
||||
|
||||
// add our data
|
||||
api.addJsonData<std::string>("user_name", id);
|
||||
api.addJsonData<std::string>("user_password", key);
|
||||
api.addJsonData<std::string>("ip", getRemoteAddress());
|
||||
if (useSimpleAuth) {
|
||||
if (!user_id) {
|
||||
uname = id;
|
||||
|
||||
if (api.submit()) {
|
||||
bool status = api.getNullableValue<bool>("status");
|
||||
uname = api.getString("username");
|
||||
sessionID = api.getString("session_key");
|
||||
if (uname.length() > MAX_ACCOUNT_NAME_LENGTH) {
|
||||
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
if (status && !sessionID.empty() && !uname.empty()) {
|
||||
authOK = true;
|
||||
user_id = std::hash < std::string > {}(uname.c_str());
|
||||
}
|
||||
|
||||
parentAccount = api.getString("mainAccount");
|
||||
childAccounts = api.getStringMap64("subAccounts");
|
||||
std::ostringstream postBuf;
|
||||
postBuf << "user_name=" << id << "&user_password=" << key << "&stationID=" << user_id << "&ip=" << getRemoteAddress();
|
||||
std::string postData = postBuf.str();
|
||||
|
||||
if (!ConfigLoginServer::getUseOldSuidGenerator()) {
|
||||
user_id = static_cast<StationId>(api.getNullableValue<StationId>("user_id"));
|
||||
parent_id = static_cast<StationId>(api.getNullableValue<StationId>("parent_id"));
|
||||
bool done = api.setData(postData);
|
||||
if (done) {
|
||||
done = api.submit(1,1,1);
|
||||
}
|
||||
|
||||
if (done) {
|
||||
std::string response = api.getRaw();
|
||||
|
||||
if (response == "success") {
|
||||
authOK = true;
|
||||
} else {
|
||||
if (parentAccount.length() > MAX_ACCOUNT_NAME_LENGTH) {
|
||||
parentAccount.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
if (uname.length() > MAX_ACCOUNT_NAME_LENGTH) {
|
||||
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
parent_id = std::hash < std::string > {}(parentAccount.c_str());
|
||||
user_id = std::hash < std::string > {}(uname.c_str());
|
||||
ErrorMessage err("Login Failed", response);
|
||||
this->send(err, true);
|
||||
}
|
||||
} else {
|
||||
std::string msg(api.getString("message"));
|
||||
if (msg.empty()) {
|
||||
msg = "Invalid username or password.";
|
||||
}
|
||||
|
||||
ErrorMessage err("Login Failed", msg);
|
||||
ErrorMessage err("Failed to contact auth provider", "Please contact a server admin");
|
||||
this->send(err, true);
|
||||
}
|
||||
} else {
|
||||
ErrorMessage err("Login Failed", "Could not connect to remote.");
|
||||
this->send(err, true);
|
||||
// add our data
|
||||
api.addJsonData<std::string>("user_name", id);
|
||||
api.addJsonData<std::string>("user_password", key);
|
||||
api.addJsonData<std::string>("ip", getRemoteAddress());
|
||||
|
||||
if (api.submit()) {
|
||||
bool status = api.getNullableValue<bool>("status");
|
||||
uname = api.getString("username");
|
||||
sessionID = api.getString("session_key");
|
||||
|
||||
if (status && !sessionID.empty() && !uname.empty()) {
|
||||
authOK = true;
|
||||
|
||||
parentAccount = api.getString("mainAccount");
|
||||
childAccounts = api.getStringMap("subAccounts");
|
||||
|
||||
if (!ConfigLoginServer::getUseOldSuidGenerator()) {
|
||||
user_id = static_cast<StationId>(api.getNullableValue<StationId>("user_id"));
|
||||
parent_id = static_cast<StationId>(api.getNullableValue<StationId>("parent_id"));
|
||||
} else {
|
||||
if (parentAccount.length() > MAX_ACCOUNT_NAME_LENGTH) {
|
||||
parentAccount.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
if (uname.length() > MAX_ACCOUNT_NAME_LENGTH) {
|
||||
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
parent_id = std::hash < std::string > {}(parentAccount.c_str());
|
||||
user_id = std::hash < std::string > {}(uname.c_str());
|
||||
}
|
||||
} else {
|
||||
std::string msg(api.getString("message"));
|
||||
if (msg.empty()) {
|
||||
msg = "Invalid username or password.";
|
||||
}
|
||||
|
||||
ErrorMessage err("Login Failed", msg);
|
||||
this->send(err, true);
|
||||
}
|
||||
} else {
|
||||
ErrorMessage err("Login Failed", "Could not connect to remote.");
|
||||
this->send(err, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// test mode
|
||||
@@ -230,36 +266,41 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
if (!testMode) {
|
||||
REPORT_LOG(true, ("Client connected. Username: %s (%i) \n", uname.c_str(), user_id));
|
||||
|
||||
if (!parentAccount.empty()) {
|
||||
if (parentAccount != uname) {
|
||||
REPORT_LOG(true, ("\t%s's parent is %s (%i) \n", uname.c_str(), parentAccount.c_str(), parent_id));
|
||||
}
|
||||
} else {
|
||||
parentAccount = "(Empty Parent!) " + uname;
|
||||
}
|
||||
|
||||
for (auto i : childAccounts) {
|
||||
StationId child_id = static_cast<StationId>(i.first);
|
||||
std::string child(i.second);
|
||||
|
||||
if (!child.empty() && i.first > 0) {
|
||||
if (ConfigLoginServer::getUseOldSuidGenerator()) {
|
||||
if (child.length() > MAX_ACCOUNT_NAME_LENGTH) {
|
||||
child.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
child_id = std::hash < std::string > {}(child.c_str());
|
||||
}
|
||||
|
||||
REPORT_LOG((parent_id !=
|
||||
child_id), ("\tchild of %s (%i) is %s (%i) \n", parentAccount.c_str(), parent_id, child.c_str(), child_id));
|
||||
|
||||
// insert all related accounts, if not already there, into the db
|
||||
if (parent_id != child_id) {
|
||||
DatabaseConnection::getInstance().upsertAccountRelationship(parent_id, child_id);
|
||||
if (!useSimpleAuth) {
|
||||
if (!parentAccount.empty()) {
|
||||
if (parentAccount != uname) {
|
||||
REPORT_LOG(true,
|
||||
("\t%s's parent is %s (%i) \n", uname.c_str(), parentAccount.c_str(), parent_id));
|
||||
}
|
||||
} else {
|
||||
WARNING(true, ("Login API returned empty child account(s)."));
|
||||
parentAccount = "(Empty Parent!) " + uname;
|
||||
}
|
||||
|
||||
|
||||
for (auto i : childAccounts) {
|
||||
StationId child_id = static_cast<StationId>(i.first);
|
||||
std::string child(i.second);
|
||||
|
||||
if (!child.empty() && i.first > 0) {
|
||||
if (ConfigLoginServer::getUseOldSuidGenerator()) {
|
||||
if (child.length() > MAX_ACCOUNT_NAME_LENGTH) {
|
||||
child.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
child_id = std::hash < std::string > {}(child.c_str());
|
||||
}
|
||||
|
||||
REPORT_LOG((parent_id !=
|
||||
child_id),
|
||||
("\tchild of %s (%i) is %s (%i) \n", parentAccount.c_str(), parent_id, child.c_str(), child_id));
|
||||
|
||||
// insert all related accounts, if not already there, into the db
|
||||
if (parent_id != child_id) {
|
||||
DatabaseConnection::getInstance().upsertAccountRelationship(parent_id, child_id);
|
||||
}
|
||||
} else {
|
||||
WARNING(true, ("Login API returned empty child account(s)."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,20 +74,6 @@ private:
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
// stolen from http://www.codeproject.com/Articles/10880/A-trim-implementation-for-std-string
|
||||
// i'm rusty and haven't gotten to lambdas yet
|
||||
inline const std::string trim(std::string str)
|
||||
{
|
||||
|
||||
str.erase(str.begin(), std::find_if(str.begin(), str.end(),
|
||||
[](char& ch)->bool { return !isspace(ch); }));
|
||||
str.erase(std::find_if(str.rbegin(), str.rend(),
|
||||
[](char& ch)->bool { return !isspace(ch); }).base(), str.end());
|
||||
return str;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const StationId ClientConnection::getStationId() const
|
||||
{
|
||||
return m_stationId;
|
||||
|
||||
@@ -87,6 +87,7 @@ void ConfigLoginServer::install(void)
|
||||
KEY_INT (maxCharactersPerAccount, 20);
|
||||
KEY_BOOL (validateClientVersion, true);
|
||||
KEY_BOOL (validateStationKey, false);
|
||||
KEY_BOOL (easyExternalAccess, false);
|
||||
KEY_BOOL (doSessionLogin, false);
|
||||
KEY_BOOL (doConsumption, false);
|
||||
KEY_STRING (sessionServers, "localhost:3004");
|
||||
@@ -116,6 +117,7 @@ void ConfigLoginServer::install(void)
|
||||
KEY_BOOL(requireSecureLoginForCsTool, true);
|
||||
KEY_BOOL(useExternalAuth, false);
|
||||
KEY_STRING(externalAuthURL, "");
|
||||
KEY_BOOL(useSimpleAuth, true);
|
||||
KEY_BOOL(useOldSuidGenerator, false);
|
||||
|
||||
int index = 0;
|
||||
@@ -163,7 +165,7 @@ void ConfigLoginServer::install(void)
|
||||
}
|
||||
|
||||
{
|
||||
char keyName[500];
|
||||
char keyName[500];
|
||||
for (int index=0; index < ms_numPurgePhases; index++)
|
||||
{
|
||||
snprintf(keyName,sizeof(keyName),"purgePhaseAdvanceDays%i",index);
|
||||
|
||||
@@ -20,6 +20,7 @@ class ConfigLoginServer
|
||||
int httpServicePort;
|
||||
bool validateClientVersion;
|
||||
bool validateStationKey;
|
||||
bool easyExternalAccess;
|
||||
bool doSessionLogin;
|
||||
bool doConsumption;
|
||||
const char * sessionServers;
|
||||
@@ -64,12 +65,13 @@ class ConfigLoginServer
|
||||
int populationLightThresholdPercent;
|
||||
int csToolPort;
|
||||
|
||||
bool requireSecureLoginForCsTool;
|
||||
bool useExternalAuth;
|
||||
bool requireSecureLoginForCsTool;
|
||||
bool useExternalAuth;
|
||||
bool useSimpleAuth;
|
||||
|
||||
const char * externalAuthURL;
|
||||
|
||||
bool useOldSuidGenerator;
|
||||
bool useOldSuidGenerator;
|
||||
};
|
||||
|
||||
static const uint16 getCentralServicePort();
|
||||
@@ -80,6 +82,7 @@ class ConfigLoginServer
|
||||
static const uint16 getHttpServicePort();
|
||||
static const bool getValidateClientVersion();
|
||||
static const bool getValidateStationKey();
|
||||
static const bool getEasyExternalAccess();
|
||||
static const bool getDoSessionLogin();
|
||||
static const bool getDoConsumption();
|
||||
static const char * getSessionServers();
|
||||
@@ -132,8 +135,9 @@ class ConfigLoginServer
|
||||
static int getPopulationMediumThresholdPercent();
|
||||
static int getPopulationLightThresholdPercent();
|
||||
|
||||
static bool getUseExternalAuth();
|
||||
static bool getUseExternalAuth();
|
||||
static const char * getExternalAuthUrl();
|
||||
static const bool getUseSimpleAuth();
|
||||
static bool getUseOldSuidGenerator();
|
||||
|
||||
// has character creation for this cluster been disabled through config option
|
||||
@@ -217,6 +221,13 @@ inline const bool ConfigLoginServer::getValidateStationKey()
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const bool ConfigLoginServer::getEasyExternalAccess()
|
||||
{
|
||||
return (data->easyExternalAccess);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const bool ConfigLoginServer::getDoSessionLogin()
|
||||
{
|
||||
return (data->doSessionLogin);
|
||||
@@ -487,6 +498,10 @@ inline const char * ConfigLoginServer::getExternalAuthUrl()
|
||||
return data->externalAuthURL;
|
||||
}
|
||||
|
||||
inline const bool ConfigLoginServer::getUseSimpleAuth()
|
||||
{
|
||||
return data->useSimpleAuth;
|
||||
}
|
||||
|
||||
inline bool ConfigLoginServer::getUseOldSuidGenerator()
|
||||
{
|
||||
|
||||
@@ -1438,7 +1438,11 @@ void LoginServer::sendClusterStatus(ClientConnection &conn) const {
|
||||
// size_t connectionServerChoice = Random::random(cle->m_connectionServers.size() - 1); //lint !e713 !e732 // loss of precision (arg no 1)
|
||||
ConnectionServerEntry &connServer = cle->m_connectionServers[0];
|
||||
|
||||
item.m_connectionServerAddress = connServer.clientServiceAddress;
|
||||
if (ConfigLoginServer::getEasyExternalAccess()) {
|
||||
item.m_connectionServerAddress = cle->m_address;
|
||||
} else {
|
||||
item.m_connectionServerAddress = connServer.clientServiceAddress;
|
||||
}
|
||||
if (clientIsPrivate) {
|
||||
item.m_connectionServerPort = connServer.clientServicePortPrivate;
|
||||
} else {
|
||||
|
||||
Binary file not shown.
@@ -1,3 +1,5 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include "FirstPlanetServer.h"
|
||||
#include "ConfigPlanetServer.h"
|
||||
#include "PlanetServer.h"
|
||||
@@ -14,10 +16,20 @@
|
||||
#include "sharedThread/SetupSharedThread.h"
|
||||
#include "sharedUtility/SetupSharedUtility.h"
|
||||
|
||||
#ifndef STELLA_INTERNAL
|
||||
#include "webAPIHeartbeat.h"
|
||||
#ifdef ENABLE_PROFILING
|
||||
extern "C" int __llvm_profile_write_file(void);
|
||||
#endif
|
||||
|
||||
inline void signalHandler(int s){
|
||||
printf("PlanetServer terminating, signal %d\n",s);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
void dumpPid(const char * argv)
|
||||
@@ -31,9 +43,11 @@ void dumpPid(const char * argv)
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
#ifndef STELLA_INTERNAL
|
||||
StellaBellum::webAPIHeartbeat();
|
||||
#endif
|
||||
struct sigaction sigIntHandler;
|
||||
sigIntHandler.sa_handler = signalHandler;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
// dumpPid(argv[0]);
|
||||
|
||||
@@ -75,8 +89,8 @@ int main(int argc, char ** argv)
|
||||
SetupSharedThread::remove();
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
exit(0);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ bool ProcessSpawner::isProcessActive(uint32 pid)
|
||||
|
||||
void ProcessSpawner::kill(uint32 pid)
|
||||
{
|
||||
IGNORE_RETURN(::kill(static_cast<int>(pid), SIGKILL));
|
||||
IGNORE_RETURN(::kill(static_cast<int>(pid), SIGTERM));
|
||||
int status;
|
||||
IGNORE_RETURN(waitpid(static_cast<int>(pid), &status, 0));
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,3 +1,5 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include "sharedFoundation/FirstSharedFoundation.h"
|
||||
|
||||
#include "ConfigTaskManager.h"
|
||||
@@ -13,10 +15,30 @@
|
||||
#include "sharedRandom/SetupSharedRandom.h"
|
||||
#include "sharedThread/SetupSharedThread.h"
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
extern "C" int __llvm_profile_write_file(void);
|
||||
#endif
|
||||
|
||||
inline void signalHandler(int s){
|
||||
printf("TaskManager terminating, signal %d\n",s);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct sigaction sigIntHandler;
|
||||
sigIntHandler.sa_handler = signalHandler;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
SetupSharedThread::install();
|
||||
SetupSharedDebug::install(1024);
|
||||
|
||||
@@ -42,6 +64,7 @@ int main(int argc, char ** argv)
|
||||
SetupSharedFoundation::remove();
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
__llvm_profile_write_file();
|
||||
exit(0);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ bool CharacterNameLocator::locateObjects(DB::Session *session, const std::string
|
||||
break;
|
||||
|
||||
m_characterIds.push_back(i->character_id.getValue());
|
||||
m_stationIds.push_back(i->character_station_id.getValue());
|
||||
m_stationIds.push_back(static_cast<int>(i->character_station_id.getValue()));
|
||||
m_characterNames.push_back(i->character_name.getValueASCII());
|
||||
m_characterFullNames.push_back(i->character_full_name.getValueASCII());
|
||||
m_characterCreateTime.push_back(i->character_create_time.getValue() + (7 * 60 * 60));
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "sharedDatabaseInterface/BindableNetworkId.h"
|
||||
#include "sharedDatabaseInterface/DbQuery.h"
|
||||
#include "serverDatabase/ObjectLocator.h"
|
||||
#include "sharedFoundation/StationId.h"
|
||||
#include <vector>
|
||||
|
||||
// ======================================================================
|
||||
@@ -33,11 +32,11 @@ class CharacterNameLocator : public ObjectLocator
|
||||
struct CharacterNameRow
|
||||
{
|
||||
DB::BindableNetworkId character_id;
|
||||
DB::BindableInt64 character_station_id;
|
||||
DB::BindableLong character_station_id;
|
||||
DB::BindableString<127> character_name;
|
||||
DB::BindableString<127> character_full_name;
|
||||
DB::BindableInt64 character_create_time;
|
||||
DB::BindableInt64 character_last_login_time;
|
||||
DB::BindableLong character_create_time;
|
||||
DB::BindableLong character_last_login_time;
|
||||
};
|
||||
|
||||
class CharacterNameQuery : public DB::Query
|
||||
@@ -64,11 +63,11 @@ class CharacterNameLocator : public ObjectLocator
|
||||
|
||||
private:
|
||||
std::vector<NetworkId> m_characterIds;
|
||||
std::vector<StationId> m_stationIds;
|
||||
std::vector<int> m_stationIds;
|
||||
std::vector<std::string> m_characterNames;
|
||||
std::vector<std::string> m_characterFullNames;
|
||||
std::vector<int64> m_characterCreateTime;
|
||||
std::vector<int64> m_characterLastLoginTime;
|
||||
std::vector<int> m_characterCreateTime;
|
||||
std::vector<int> m_characterLastLoginTime;
|
||||
};
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -290,10 +290,10 @@ void Persister::onFrameBarrierReached()
|
||||
|
||||
void Persister::startSave(void)
|
||||
{
|
||||
DEBUG_REPORT_LOG(ConfigServerDatabase::getReportSaveTimes(),("Starting save with data for %i objects (%i new)\n",m_objectSnapshotMap.size(), m_newObjectCount));
|
||||
LOG("SaveTimes",("Starting save with data for %i objects (%i new)",m_objectSnapshotMap.size(), m_newObjectCount));
|
||||
//DEBUG_REPORT_LOG(ConfigServerDatabase::getReportSaveTimes(),("Starting save with data for %i objects (%i new)\n",m_objectSnapshotMap.size(), m_newObjectCount));
|
||||
//LOG("SaveTimes",("Starting save with data for %i objects (%i new)",m_objectSnapshotMap.size(), m_newObjectCount));
|
||||
// notify Central that a save is starting. It needs this to determine when it can perform graceful shutdowns
|
||||
LOG("Database",("Sending DatabaseSaveStart network message to Central."));
|
||||
//LOG("Database",("Sending DatabaseSaveStart network message to Central."));
|
||||
DatabaseSaveStart const startSaveMessage;
|
||||
DatabaseProcess::getInstance().sendToCentralServer(startSaveMessage, true);
|
||||
|
||||
@@ -347,7 +347,7 @@ void Persister::startSave(void)
|
||||
{
|
||||
GenericValueTypeMessage<int> const saveCompleteMessage("DatabaseSaveComplete", ++m_saveCounter);
|
||||
DatabaseProcess::getInstance().sendToCentralServer(saveCompleteMessage, true);
|
||||
LOG("Database",("Sending DatabaseSaveComplete network message to Central."));
|
||||
//LOG("Database",("Sending DatabaseSaveComplete network message to Central."));
|
||||
}
|
||||
|
||||
// clear the buffers
|
||||
@@ -619,19 +619,19 @@ void Persister::saveCompleted(Snapshot *completedSnapshot)
|
||||
if (saveTime > m_maxSaveTime)
|
||||
m_maxSaveTime = saveTime;
|
||||
|
||||
DEBUG_REPORT_LOG(true,("Save completed in %i. (Average %i, max %i)\n", saveTime, m_totalSaveTime/m_saveCount, m_maxSaveTime));
|
||||
LOG("SaveTimes",("Save completed in %i. (Average %i, max %i)", saveTime, m_totalSaveTime/m_saveCount, m_maxSaveTime));
|
||||
//DEBUG_REPORT_LOG(true,("Save completed in %i. (Average %i, max %i)\n", saveTime, m_totalSaveTime/m_saveCount, m_maxSaveTime));
|
||||
//LOG("SaveTimes",("Save completed in %i. (Average %i, max %i)", saveTime, m_totalSaveTime/m_saveCount, m_maxSaveTime));
|
||||
|
||||
m_lastSaveTime = saveTime;
|
||||
}
|
||||
|
||||
LOG("Database",("Sending DatabaseSaveComplete network message to Central."));
|
||||
//LOG("Database",("Sending DatabaseSaveComplete network message to Central."));
|
||||
|
||||
// TODO: so do we send this for the other snapshot type or not? hrmph
|
||||
// message Central Server that the current save cycle is complete
|
||||
GenericValueTypeMessage<int> const saveCompleteMessage("DatabaseSaveComplete", ++m_saveCounter);
|
||||
DatabaseProcess::getInstance().sendToCentralServer(saveCompleteMessage, true);
|
||||
LOG("Database",("Sending DatabaseSaveComplete network message to Central."));
|
||||
//LOG("Database",("Sending DatabaseSaveComplete network message to Central."));
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
@@ -644,7 +644,7 @@ void Persister::saveCompleted(Snapshot *completedSnapshot)
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_REPORT_LOG(ConfigServerDatabase::getReportSaveTimes(),("New character save completed\n"));
|
||||
//DEBUG_REPORT_LOG(ConfigServerDatabase::getReportSaveTimes(),("New character save completed\n"));
|
||||
}
|
||||
|
||||
if (found && completedSnapshot != nullptr) {
|
||||
@@ -716,7 +716,7 @@ void Persister::receiveMessage(const MessageDispatch::Emitter & source, const Me
|
||||
{
|
||||
auto ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
|
||||
AddCharacterMessage ocm(ri);
|
||||
DEBUG_REPORT_LOG(true, ("Got AddCharacterMessage for object %s.\n",ocm.getObjectId().getValueString().c_str()));
|
||||
//DEBUG_REPORT_LOG(true, ("Got AddCharacterMessage for object %s.\n",ocm.getObjectId().getValueString().c_str()));
|
||||
|
||||
addCharacter(ocm.getAccountNumber(), ocm.getObjectId(), ocm.getProcess(), ocm.getName(), ocm.getSpecial());
|
||||
break;
|
||||
|
||||
@@ -31,7 +31,7 @@ Snapshot::Snapshot(DB::ModeQuery::Mode mode, bool useGoldDatabase) :
|
||||
m_mode(mode),
|
||||
m_timestamp(0)
|
||||
{
|
||||
LOG("Snapshot",("Created snapshot"));
|
||||
//LOG("Snapshot",("Created snapshot"));
|
||||
++ms_creationCount;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ Snapshot::~Snapshot()
|
||||
m_customStepList.clear();
|
||||
|
||||
++ms_deletionCount;
|
||||
LOG("Snapshot",("Deleted snapshot. %i outstanding, %i created, %i deleted", ms_creationCount-ms_deletionCount,ms_creationCount,ms_deletionCount));
|
||||
//LOG("Snapshot",("Deleted snapshot. %i outstanding, %i created, %i deleted", ms_creationCount-ms_deletionCount,ms_creationCount,ms_deletionCount));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -574,7 +574,7 @@ float AICreatureController::realAlter(float time)
|
||||
|
||||
setRetreating(false);
|
||||
|
||||
WARNING(true, ("AICreatureController::realAlter() owner(%s) inCombat(%s) Retreating has lasted(%d) > %d seconds. Auto-releasing retreat.", getDebugInformation().c_str(), getCreature()->isInCombat() ? "yes" : "no", retreatingTime, maxRetreatTime));
|
||||
DEBUG_WARNING(true, ("AICreatureController::realAlter() owner(%s) inCombat(%s) Retreating has lasted(%d) > %d seconds. Auto-releasing retreat.", getDebugInformation().c_str(), getCreature()->isInCombat() ? "yes" : "no", retreatingTime, maxRetreatTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -685,7 +685,7 @@ float AICreatureController::realAlter(float time)
|
||||
std::string warningString;
|
||||
m_movement->getDebugInfo(warningString);
|
||||
|
||||
WARNING(true, (FormattedString<4096>().sprintf("AICreatureController::realAlter() owner(%s) movement(%s) alter took %.0fms. Dumping movement info - %s\n", getDebugInformation().c_str(), AiMovementBase::getMovementString(m_movement->getType()), msec, warningString.c_str())));
|
||||
DEBUG_WARNING(true, (FormattedString<4096>().sprintf("AICreatureController::realAlter() owner(%s) movement(%s) alter took %.0fms. Dumping movement info - %s\n", getDebugInformation().c_str(), AiMovementBase::getMovementString(m_movement->getType()), msec, warningString.c_str())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -751,7 +751,7 @@ bool AICreatureController::suspendMovement()
|
||||
else if (m_movement != AiMovementBaseNullPtr)
|
||||
{
|
||||
result = false;
|
||||
WARNING(true, ("AICreatureController::suspendMovement called for creature %s when there is already a suspended movement type %d",
|
||||
DEBUG_WARNING(true, ("AICreatureController::suspendMovement called for creature %s when there is already a suspended movement type %d",
|
||||
getOwner()->getNetworkId().getValueString().c_str(), static_cast<int>(m_movement->getType())));
|
||||
}
|
||||
return result;
|
||||
@@ -1117,7 +1117,7 @@ bool AICreatureController::faceTo( NetworkId const & targetId )
|
||||
|
||||
if (!target)
|
||||
{
|
||||
WARNING(true, ("AICreatureController::faceTo() owner(%s) Unable to resolve target(%s) to a ServerObject", getDebugInformation().c_str(), targetId.getValueString().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::faceTo() owner(%s) Unable to resolve target(%s) to a ServerObject", getDebugInformation().c_str(), targetId.getValueString().c_str()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1162,7 +1162,7 @@ bool AICreatureController::follow( NetworkId const & targetId, float minDistance
|
||||
|
||||
if (!target)
|
||||
{
|
||||
WARNING(true, ("AICreatureController::follow() owner(%s) distance[%.2f...%.2f] Unable to resolve target(%s) to a ServerObject", getDebugInformation().c_str(), minDistance, maxDistance, targetId.getValueString().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::follow() owner(%s) distance[%.2f...%.2f] Unable to resolve target(%s) to a ServerObject", getDebugInformation().c_str(), minDistance, maxDistance, targetId.getValueString().c_str()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1210,7 +1210,7 @@ bool AICreatureController::follow( NetworkId const & targetId, Vector const & of
|
||||
|
||||
if (!target)
|
||||
{
|
||||
WARNING(true, ("AICreatureController::follow() owner(%s) offset(%.0f, %.0f, %.0f) Unable to resolve target(%s) to a ServerObject", getDebugInformation().c_str(), offset.x, offset.y, offset.z, targetId.getValueString().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::follow() owner(%s) offset(%.0f, %.0f, %.0f) Unable to resolve target(%s) to a ServerObject", getDebugInformation().c_str(), offset.x, offset.y, offset.z, targetId.getValueString().c_str()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1905,7 +1905,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != nullptr) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != nullptr) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2402,7 +2402,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr
|
||||
|
||||
if (inventory == nullptr)
|
||||
{
|
||||
WARNING(true, ("AICreatureController::%s() Unable to find inventory for (%s) to place a weapon(%s)", functionName, getDebugInformation().c_str(), weaponName.getString()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::%s() Unable to find inventory for (%s) to place a weapon(%s)", functionName, getDebugInformation().c_str(), weaponName.getString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2432,7 +2432,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr
|
||||
|
||||
if (weaponCrcName.getCrc() == 0)
|
||||
{
|
||||
WARNING(true, ("AICreatureController::%s() Unable to resolve a weapon(%s) crc for (%s)", functionName, weaponTemplateName.c_str(), getDebugInformation().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::%s() Unable to resolve a weapon(%s) crc for (%s)", functionName, weaponTemplateName.c_str(), getDebugInformation().c_str()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2445,7 +2445,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true, ("AICreatureController::%s() Unable to create a WeaponObject(%s) for (%s)", functionName, weaponTemplateName.c_str(), getDebugInformation().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::%s() Unable to create a WeaponObject(%s) for (%s)", functionName, weaponTemplateName.c_str(), getDebugInformation().c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2484,7 +2484,7 @@ void AICreatureController::equipPrimaryWeapon()
|
||||
{
|
||||
if (!isCombatAi())
|
||||
{
|
||||
WARNING(true, ("AICreatureController::equipPrimaryWeapon() owner(%s) A non-combat AI is trying to equip a weapon", getDebugInformation().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::equipPrimaryWeapon() owner(%s) A non-combat AI is trying to equip a weapon", getDebugInformation().c_str()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2524,13 +2524,13 @@ void AICreatureController::equipPrimaryWeapon()
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true, ("AICreatureController::equipPrimaryWeapon() owner(%s) Transfer of primaryWeapon(%s) to the visible equipped slot failed(%d).", getDebugInformation().c_str(), primaryWeaponServerObject->getDebugInformation().c_str(), errorCode));
|
||||
DEBUG_WARNING(true, ("AICreatureController::equipPrimaryWeapon() owner(%s) Transfer of primaryWeapon(%s) to the visible equipped slot failed(%d).", getDebugInformation().c_str(), primaryWeaponServerObject->getDebugInformation().c_str(), errorCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true, ("AICreatureController::equipPrimaryWeapon() owner(%s) Unable to resolve primaryWeapon(%s:%s) to a WeaponObject.", getDebugInformation().c_str(), m_primaryWeapon.get().getValueString().c_str(), m_aiCreatureData->m_primaryWeapon.getString()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::equipPrimaryWeapon() owner(%s) Unable to resolve primaryWeapon(%s:%s) to a WeaponObject.", getDebugInformation().c_str(), m_primaryWeapon.get().getValueString().c_str(), m_aiCreatureData->m_primaryWeapon.getString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2549,7 +2549,7 @@ void AICreatureController::equipSecondaryWeapon()
|
||||
{
|
||||
if (!isCombatAi())
|
||||
{
|
||||
WARNING(true, ("AICreatureController::equipSecondaryWeapon() owner(%s) A non-combat AI is trying to equip a weapon", getDebugInformation().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::equipSecondaryWeapon() owner(%s) A non-combat AI is trying to equip a weapon", getDebugInformation().c_str()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2589,13 +2589,13 @@ void AICreatureController::equipSecondaryWeapon()
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true, ("AICreatureController::equipSecondaryWeapon() owner(%s) Transfer of secondaryWeapon(%s) to the visible equipped slot failed(%d).", getDebugInformation().c_str(), secondaryWeaponServerObject->getDebugInformation().c_str(), errorCode));
|
||||
DEBUG_WARNING(true, ("AICreatureController::equipSecondaryWeapon() owner(%s) Transfer of secondaryWeapon(%s) to the visible equipped slot failed(%d).", getDebugInformation().c_str(), secondaryWeaponServerObject->getDebugInformation().c_str(), errorCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true, ("AICreatureController::equipSecondaryWeapon() owner(%s) Unable to resolve secondaryWeapon(%s:%s) to a WeaponObject.", getDebugInformation().c_str(), m_secondaryWeapon.get().getValueString().c_str(), m_aiCreatureData->m_secondaryWeapon.getString()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::equipSecondaryWeapon() owner(%s) Unable to resolve secondaryWeapon(%s:%s) to a WeaponObject.", getDebugInformation().c_str(), m_secondaryWeapon.get().getValueString().c_str(), m_aiCreatureData->m_secondaryWeapon.getString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2614,7 +2614,7 @@ void AICreatureController::unEquipWeapons()
|
||||
{
|
||||
if (!isCombatAi())
|
||||
{
|
||||
WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) A non-combat AI is trying to unequip a weapon", getDebugInformation().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) A non-combat AI is trying to unequip a weapon", getDebugInformation().c_str()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2636,12 +2636,12 @@ void AICreatureController::unEquipWeapons()
|
||||
|
||||
if (!ContainerInterface::transferItemToVolumeContainer(*inventory, *currentWeaponObject, creatureOwner, error))
|
||||
{
|
||||
WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) Transfer of the currentWeapon(%s) to the inventory failed(%d).", getDebugInformation().c_str(), currentWeaponObject->getDebugInformation().c_str(), error));
|
||||
DEBUG_WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) Transfer of the currentWeapon(%s) to the inventory failed(%d).", getDebugInformation().c_str(), currentWeaponObject->getDebugInformation().c_str(), error));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) Unable to find an inventory.", getDebugInformation().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) Unable to find an inventory.", getDebugInformation().c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2653,7 +2653,7 @@ void AICreatureController::unEquipWeapons()
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) nullptr default weapon", getDebugInformation().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) nullptr default weapon", getDebugInformation().c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2822,7 +2822,7 @@ void AICreatureController::setRetreating(bool const retreating)
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true, ("AICreatureController::setRetreating() ai(%s) Unable to resolve the cellId(%s) to a CellObject", creatureOwner->getDebugInformation().c_str(), cellId.getValueString().c_str()));
|
||||
DEBUG_WARNING(true, ("AICreatureController::setRetreating() ai(%s) Unable to resolve the cellId(%s) to a CellObject", creatureOwner->getDebugInformation().c_str(), cellId.getValueString().c_str()));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -189,7 +189,7 @@ int NameManager::getTotalPlayerCount() const
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void NameManager::addPlayer(const NetworkId &id, StationId stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers)
|
||||
void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers)
|
||||
{
|
||||
std::string normalizedName(normalizeName(name));
|
||||
|
||||
@@ -221,18 +221,18 @@ void NameManager::addPlayer(const NetworkId &id, StationId stationId, const std:
|
||||
if (notifyOtherServers)
|
||||
{
|
||||
std::vector<NetworkId> ids;
|
||||
std::vector<StationId> stationIds;
|
||||
std::vector<int> stationIds;
|
||||
std::vector<std::string> characterNames;
|
||||
std::vector<std::string> characterFullNames;
|
||||
std::vector<int64> characterCreateTimes;
|
||||
std::vector<int64> characterLastLoginTimes;
|
||||
std::vector<int> characterCreateTimes;
|
||||
std::vector<int> characterLastLoginTimes;
|
||||
|
||||
ids.push_back(id);
|
||||
stationIds.push_back(stationId);
|
||||
stationIds.push_back(static_cast<int>(stationId));
|
||||
characterNames.push_back(normalizedName);
|
||||
characterFullNames.push_back(fullName);
|
||||
characterCreateTimes.push_back(static_cast<int64>(createTime));
|
||||
characterLastLoginTimes.push_back(static_cast<int64>(lastLoginTime));
|
||||
characterCreateTimes.push_back(static_cast<int>(createTime));
|
||||
characterLastLoginTimes.push_back(static_cast<int>(lastLoginTime));
|
||||
|
||||
ServerMessageForwarding::beginBroadcast();
|
||||
|
||||
@@ -247,7 +247,7 @@ void NameManager::addPlayer(const NetworkId &id, StationId stationId, const std:
|
||||
|
||||
void NameManager::renamePlayer(const NetworkId &id, const Unicode::String &name, const Unicode::String &fullName)
|
||||
{
|
||||
StationId stationId = 0;
|
||||
uint32 stationId = 0;
|
||||
time_t createTime = 0;
|
||||
time_t lastLoginTime = 0;
|
||||
|
||||
@@ -279,7 +279,7 @@ const NetworkId & NameManager::getPlayerId(const std::string &name) const
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
StationId NameManager::getPlayerStationId(const NetworkId &id) const
|
||||
uint32 NameManager::getPlayerStationId(const NetworkId &id) const
|
||||
{
|
||||
IdToCharacterDataMapType::const_iterator i=m_idToCharacterDataMap->find(id);
|
||||
if (i==m_idToCharacterDataMap->end())
|
||||
@@ -316,24 +316,24 @@ const std::string & NameManager::getPlayerFullName(const NetworkId &id) const
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
int64 NameManager::getPlayerCreateTime(const NetworkId &id) const
|
||||
int NameManager::getPlayerCreateTime(const NetworkId &id) const
|
||||
{
|
||||
IdToCharacterDataMapType::const_iterator i=m_idToCharacterDataMap->find(id);
|
||||
if (i==m_idToCharacterDataMap->end())
|
||||
return -1;
|
||||
else
|
||||
return static_cast<int64>(i->second.createTime);
|
||||
return static_cast<int>(i->second.createTime);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
int64 NameManager::getPlayerLastLoginTime(const NetworkId &id) const
|
||||
int NameManager::getPlayerLastLoginTime(const NetworkId &id) const
|
||||
{
|
||||
IdToCharacterDataMapType::const_iterator i=m_idToCharacterDataMap->find(id);
|
||||
if (i==m_idToCharacterDataMap->end())
|
||||
return -1;
|
||||
else
|
||||
return static_cast<int64>(i->second.lastLoginTime);
|
||||
return static_cast<int>(i->second.lastLoginTime);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -464,7 +464,7 @@ void NameManager::releasePlayerName(const NetworkId &id)
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void NameManager::addPlayers(const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int64> &createTimes, const std::vector<int64> &lastLoginTimes)
|
||||
void NameManager::addPlayers(const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int> &createTimes, const std::vector<int> &lastLoginTimes)
|
||||
{
|
||||
DEBUG_FATAL(ids.size() != stationIds.size(),("Programmer bug: Vectors ids and stationIds must be the same size.\n"));
|
||||
DEBUG_FATAL(ids.size() != names.size(),("Programmer bug: Vectors ids and names must be the same size.\n"));
|
||||
@@ -483,20 +483,20 @@ void NameManager::addPlayers(const std::vector<NetworkId> &ids, const std::vecto
|
||||
void NameManager::sendAllNamesToServer (std::vector<uint32> const & servers) const
|
||||
{
|
||||
std::vector<NetworkId> ids;
|
||||
std::vector<StationId> stationIds;
|
||||
std::vector<int> stationIds;
|
||||
std::vector<std::string> characterNames;
|
||||
std::vector<std::string> characterFullNames;
|
||||
std::vector<int64> characterCreateTimes;
|
||||
std::vector<int64> characterLastLoginTimes;
|
||||
std::vector<int> characterCreateTimes;
|
||||
std::vector<int> characterLastLoginTimes;
|
||||
|
||||
for (IdToCharacterDataMapType::const_iterator i=m_idToCharacterDataMap->begin(); i!=m_idToCharacterDataMap->end(); ++i)
|
||||
{
|
||||
ids.push_back(i->first);
|
||||
stationIds.push_back(i->second.stationId);
|
||||
stationIds.push_back(static_cast<int>(i->second.stationId));
|
||||
characterNames.push_back(i->second.characterName);
|
||||
characterFullNames.push_back(i->second.characterFullName);
|
||||
characterCreateTimes.push_back(static_cast<int64>(i->second.createTime));
|
||||
characterLastLoginTimes.push_back(static_cast<int64>(i->second.lastLoginTime));
|
||||
characterCreateTimes.push_back(static_cast<int>(i->second.createTime));
|
||||
characterLastLoginTimes.push_back(static_cast<int>(i->second.lastLoginTime));
|
||||
}
|
||||
|
||||
ServerMessageForwarding::begin(servers);
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#ifndef INCLUDED_NameManager_H
|
||||
#define INCLUDED_NameManager_H
|
||||
|
||||
#include "sharedFoundation/StationId.h"
|
||||
|
||||
// ======================================================================
|
||||
|
||||
class NameGenerator;
|
||||
@@ -34,17 +32,17 @@ class NameManager
|
||||
|
||||
public:
|
||||
int getTotalPlayerCount () const;
|
||||
void addPlayer (const NetworkId &id, StationId stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers);
|
||||
void addPlayers (const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int64> &createTimes, const std::vector<int64> &lastLoginTimes);
|
||||
void addPlayer (const NetworkId &id, uint32 stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers);
|
||||
void addPlayers (const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int> &createTimes, const std::vector<int> &lastLoginTimes);
|
||||
void renamePlayer (const NetworkId &id, const Unicode::String &name, const Unicode::String &fullName);
|
||||
std::string debugGetNameList () const;
|
||||
bool isPlayer (NetworkId const & possiblePlayer) const;
|
||||
const NetworkId & getPlayerId (const std::string &name) const;
|
||||
StationId getPlayerStationId (const NetworkId &id) const;
|
||||
uint32 getPlayerStationId (const NetworkId &id) const;
|
||||
const std::string & getPlayerName (const NetworkId &id) const;
|
||||
const std::string & getPlayerFullName (const NetworkId &id) const;
|
||||
int64 getPlayerCreateTime (const NetworkId &id) const;
|
||||
int64 getPlayerLastLoginTime (const NetworkId &id) const;
|
||||
int getPlayerCreateTime (const NetworkId &id) const;
|
||||
int getPlayerLastLoginTime (const NetworkId &id) const;
|
||||
void getPlayerWithLastLoginTimeAfter (time_t time, std::multimap<time_t, std::pair<std::pair<NetworkId, uint32>, std::string> > &result) const;
|
||||
void getPlayerWithLastLoginTimeBefore (time_t time, std::multimap<time_t, std::pair<std::pair<NetworkId, uint32>, std::string> > &result) const;
|
||||
void getPlayerWithLastLoginTimeBetween (time_t timeLowerRange, time_t timeUpperRange, std::multimap<time_t, std::pair<std::pair<NetworkId, uint32>, std::string> > &result) const;
|
||||
@@ -80,7 +78,7 @@ class NameManager
|
||||
|
||||
struct CharacterData
|
||||
{
|
||||
StationId stationId;
|
||||
uint32 stationId;
|
||||
std::string characterName;
|
||||
std::string characterFullName;
|
||||
time_t createTime;
|
||||
|
||||
@@ -570,8 +570,8 @@ void ServerUniverse::updateAndValidateData()
|
||||
m_masterCityObject->addToWorld();
|
||||
}
|
||||
|
||||
if (!m_thisPlanet) { // this entire section of code is fucking stupid but less fucking stupid than before, since this loop ran EVERY TIME
|
||||
//-- create planet objects if they don't exist
|
||||
{
|
||||
//-- load planet table
|
||||
Iff iff;
|
||||
if (iff.open ("universe/planets.iff", true))
|
||||
@@ -605,11 +605,7 @@ void ServerUniverse::updateAndValidateData()
|
||||
}
|
||||
else
|
||||
DEBUG_WARNING (true, ("universe/planets.iff not found"));
|
||||
}
|
||||
|
||||
//-- create this planet, in case it's not in the table
|
||||
if (!m_thisPlanet)
|
||||
{
|
||||
FATAL(!ConfigServerGame::getAllowMasterObjectCreation(), ("Planet object %s was not found!", ServerWorld::getSceneId().c_str()));
|
||||
DEBUG_WARNING(true,("Spawning planet %s, which was not listed in planets.iff", ServerWorld::getSceneId().c_str()));
|
||||
IGNORE_RETURN(createPlanetObject(ServerWorld::getSceneId()));
|
||||
|
||||
@@ -398,7 +398,7 @@ GuildInfo const * GuildObject::getGuildInfo(int guildId) const
|
||||
|
||||
GuildMemberInfo const * GuildObject::getGuildMemberInfo(int guildId, NetworkId const &memberId) const
|
||||
{
|
||||
std::map<std::pair<int, NetworkId>, GuildMemberInfo, GuildObject>::const_iterator const iterFind = m_membersInfo.find(std::make_pair(guildId, memberId));
|
||||
const auto iterFind = m_membersInfo.find(std::make_pair(guildId, memberId));
|
||||
if (iterFind != m_membersInfo.end())
|
||||
return &(iterFind->second);
|
||||
|
||||
@@ -486,7 +486,7 @@ void GuildObject::getGuildMemberIds(int guildId, std::vector<NetworkId> &results
|
||||
{
|
||||
results.clear();
|
||||
|
||||
for (std::map<std::pair<int, NetworkId>, GuildMemberInfo, GuildObject>::const_iterator iter = m_membersInfo.lower_bound(std::make_pair(guildId, NetworkId::cms_invalid)); iter != m_membersInfo.end(); ++iter)
|
||||
for (auto iter = m_membersInfo.lower_bound(std::make_pair(guildId, NetworkId::cms_invalid)); iter != m_membersInfo.end(); ++iter)
|
||||
{
|
||||
if (iter->first.first != guildId)
|
||||
break;
|
||||
@@ -501,7 +501,7 @@ void GuildObject::getMemberIdsWithPermissions(int guildId, int permissions, std:
|
||||
{
|
||||
results.clear();
|
||||
|
||||
for (std::map<std::pair<int, NetworkId>, GuildMemberInfo, GuildObject>::const_iterator iter = m_membersInfo.lower_bound(std::make_pair(guildId, NetworkId::cms_invalid)); iter != m_membersInfo.end(); ++iter)
|
||||
for (auto iter = m_membersInfo.lower_bound(std::make_pair(guildId, NetworkId::cms_invalid)); iter != m_membersInfo.end(); ++iter)
|
||||
{
|
||||
if (iter->first.first != guildId)
|
||||
break;
|
||||
@@ -635,7 +635,7 @@ void GuildObject::disbandGuild(int guildId)
|
||||
// remove all members
|
||||
{
|
||||
std::vector<NetworkId> memberIds;
|
||||
for (std::map<std::pair<int, NetworkId>, GuildMemberInfo, GuildObject>::const_iterator iter = m_membersInfo.lower_bound(std::make_pair(guildId, NetworkId::cms_invalid)); iter != m_membersInfo.end(); ++iter)
|
||||
for (auto iter = m_membersInfo.lower_bound(std::make_pair(guildId, NetworkId::cms_invalid)); iter != m_membersInfo.end(); ++iter)
|
||||
{
|
||||
if (iter->first.first != guildId)
|
||||
break;
|
||||
@@ -647,7 +647,7 @@ void GuildObject::disbandGuild(int guildId)
|
||||
m_members.erase(memberSpec);
|
||||
}
|
||||
|
||||
for (std::vector<NetworkId>::const_iterator iterMemberId = memberIds.begin(); iterMemberId != memberIds.end(); ++iterMemberId)
|
||||
for (auto iterMemberId = memberIds.begin(); iterMemberId != memberIds.end(); ++iterMemberId)
|
||||
{
|
||||
std::map<NetworkId, int>::const_iterator iterFind = m_fullMembers.find(*iterMemberId);
|
||||
if ((iterFind != m_fullMembers.end()) && (iterFind->second == guildId))
|
||||
|
||||
+58
-40
@@ -16,6 +16,9 @@
|
||||
#include "sharedMath/Vector.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <stdio.h>
|
||||
@@ -1101,46 +1104,55 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "rating") == 0)
|
||||
m_rating.loadFromIff(file);
|
||||
else if (strcmp(paramName, "integrity") == 0)
|
||||
m_integrity.loadFromIff(file);
|
||||
else if (strcmp(paramName, "effectiveness") == 0)
|
||||
m_effectiveness.loadFromIff(file);
|
||||
else if (strcmp(paramName, "specialProtection") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter)
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("rating"):
|
||||
m_rating.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("integrity"):
|
||||
m_integrity.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("effectiveness"):
|
||||
m_effectiveness.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("specialProtection"):
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_specialProtection.clear();
|
||||
m_specialProtectionAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_specialProtection.push_back(newData);
|
||||
}
|
||||
m_specialProtectionLoaded = true;
|
||||
}
|
||||
m_specialProtection.clear();
|
||||
m_specialProtectionAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("vulnerability"):
|
||||
m_vulnerability.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("encumbrance"):
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_specialProtection.push_back(newData);
|
||||
}
|
||||
m_specialProtectionLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "vulnerability") == 0)
|
||||
m_vulnerability.loadFromIff(file);
|
||||
else if (strcmp(paramName, "encumbrance") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 3, ("Template %s: read array size of %d for array \"encumbrance\" of size 3, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 3 && j < listCount; ++j)
|
||||
m_encumbrance[j].loadFromIff(file);
|
||||
// if there are more params for encumbrance read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 3, ("Template %s: read array size of %d for array \"encumbrance\" of size 3, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 3 && j < listCount; ++j)
|
||||
m_encumbrance[j].loadFromIff(file);
|
||||
// if there are more params for encumbrance read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
@@ -1462,10 +1474,16 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "type") == 0)
|
||||
m_type.loadFromIff(file);
|
||||
else if (strcmp(paramName, "effectiveness") == 0)
|
||||
m_effectiveness.loadFromIff(file);
|
||||
|
||||
switch (runtimeCrc(paramName)) {
|
||||
case constcrc("type"):
|
||||
m_type.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("effectiveness"):
|
||||
m_effectiveness.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -16,6 +16,9 @@
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <stdio.h>
|
||||
@@ -414,10 +417,15 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "maintenanceCost") == 0)
|
||||
m_maintenanceCost.loadFromIff(file);
|
||||
else if (strcmp(paramName, "isPublic") == 0)
|
||||
m_isPublic.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("maintenanceCost"):
|
||||
m_maintenanceCost.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("isPublic"):
|
||||
m_isPublic.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+114
-94
@@ -19,6 +19,9 @@
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
#include "sharedUtility/NameGenerator.h"
|
||||
#include "sharedNetworkMessages/NameErrors.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
#include "ServerWeaponObjectTemplate.h"
|
||||
//@END TFD TEMPLATE REFS
|
||||
@@ -2372,112 +2375,129 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "defaultWeapon") == 0)
|
||||
m_defaultWeapon.loadFromIff(file);
|
||||
else if (strcmp(paramName, "attributes") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 6, ("Template %s: read array size of %d for array \"attributes\" of size 6, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 6 && j < listCount; ++j)
|
||||
m_attributes[j].loadFromIff(file);
|
||||
// if there are more params for attributes read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("defaultWeapon"):
|
||||
m_defaultWeapon.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("attributes"):
|
||||
{
|
||||
IntegerParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 6, ("Template %s: read array size of %d for array \"attributes\" of size 6, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 6 && j < listCount; ++j)
|
||||
m_attributes[j].loadFromIff(file);
|
||||
// if there are more params for attributes read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp(paramName, "minAttributes") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 6, ("Template %s: read array size of %d for array \"minAttributes\" of size 6, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 6 && j < listCount; ++j)
|
||||
m_minAttributes[j].loadFromIff(file);
|
||||
// if there are more params for minAttributes read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("minAttributes"):
|
||||
{
|
||||
IntegerParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 6, ("Template %s: read array size of %d for array \"minAttributes\" of size 6, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 6 && j < listCount; ++j)
|
||||
m_minAttributes[j].loadFromIff(file);
|
||||
// if there are more params for minAttributes read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp(paramName, "maxAttributes") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 6, ("Template %s: read array size of %d for array \"maxAttributes\" of size 6, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 6 && j < listCount; ++j)
|
||||
m_maxAttributes[j].loadFromIff(file);
|
||||
// if there are more params for maxAttributes read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("maxAttributes"):
|
||||
{
|
||||
IntegerParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 6, ("Template %s: read array size of %d for array \"maxAttributes\" of size 6, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 6 && j < listCount; ++j)
|
||||
m_maxAttributes[j].loadFromIff(file);
|
||||
// if there are more params for maxAttributes read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp(paramName, "minDrainModifier") == 0)
|
||||
m_minDrainModifier.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxDrainModifier") == 0)
|
||||
m_maxDrainModifier.loadFromIff(file);
|
||||
else if (strcmp(paramName, "minFaucetModifier") == 0)
|
||||
m_minFaucetModifier.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxFaucetModifier") == 0)
|
||||
m_maxFaucetModifier.loadFromIff(file);
|
||||
else if (strcmp(paramName, "attribMods") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter)
|
||||
break;
|
||||
case constcrc("minDrainModifier"):
|
||||
m_minDrainModifier.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxDrainModifier"):
|
||||
m_maxDrainModifier.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("minFaucetModifier"):
|
||||
m_minFaucetModifier.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxFaucetModifier"):
|
||||
m_maxFaucetModifier.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("attribMods"):
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_attribMods.clear();
|
||||
m_attribModsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_attribMods.push_back(newData);
|
||||
}
|
||||
m_attribModsLoaded = true;
|
||||
}
|
||||
m_attribMods.clear();
|
||||
m_attribModsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("shockWounds"):
|
||||
m_shockWounds.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("canCreateAvatar"):
|
||||
m_canCreateAvatar.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("nameGeneratorType"):
|
||||
m_nameGeneratorType.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("approachTriggerRange"):
|
||||
m_approachTriggerRange.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxMentalStates"):
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_attribMods.push_back(newData);
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 4, ("Template %s: read array size of %d for array \"maxMentalStates\" of size 4, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 4 && j < listCount; ++j)
|
||||
m_maxMentalStates[j].loadFromIff(file);
|
||||
// if there are more params for maxMentalStates read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
m_attribModsLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "shockWounds") == 0)
|
||||
m_shockWounds.loadFromIff(file);
|
||||
else if (strcmp(paramName, "canCreateAvatar") == 0)
|
||||
m_canCreateAvatar.loadFromIff(file);
|
||||
else if (strcmp(paramName, "nameGeneratorType") == 0)
|
||||
m_nameGeneratorType.loadFromIff(file);
|
||||
else if (strcmp(paramName, "approachTriggerRange") == 0)
|
||||
m_approachTriggerRange.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxMentalStates") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 4, ("Template %s: read array size of %d for array \"maxMentalStates\" of size 4, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 4 && j < listCount; ++j)
|
||||
m_maxMentalStates[j].loadFromIff(file);
|
||||
// if there are more params for maxMentalStates read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("mentalStatesDecay"):
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
else if (strcmp(paramName, "mentalStatesDecay") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 4, ("Template %s: read array size of %d for array \"mentalStatesDecay\" of size 4, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 4 && j < listCount; ++j)
|
||||
m_mentalStatesDecay[j].loadFromIff(file);
|
||||
// if there are more params for mentalStatesDecay read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 4, ("Template %s: read array size of %d for array \"mentalStatesDecay\" of size 4, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 4 && j < listCount; ++j)
|
||||
m_mentalStatesDecay[j].loadFromIff(file);
|
||||
// if there are more params for mentalStatesDecay read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
+117
-92
@@ -16,6 +16,9 @@
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
#include "ServerFactoryObjectTemplate.h"
|
||||
#include "ServerObjectTemplate.h"
|
||||
@@ -1280,77 +1283,90 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "category") == 0)
|
||||
m_category.loadFromIff(file);
|
||||
else if (strcmp(paramName, "craftedObjectTemplate") == 0)
|
||||
m_craftedObjectTemplate.loadFromIff(file);
|
||||
else if (strcmp(paramName, "crateObjectTemplate") == 0)
|
||||
m_crateObjectTemplate.loadFromIff(file);
|
||||
else if (strcmp(paramName, "slots") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_slots.begin(); iter != m_slots.end(); ++iter)
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("category"):
|
||||
m_category.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("craftedObjectTemplate"):
|
||||
m_craftedObjectTemplate.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("crateObjectTemplate"):
|
||||
m_crateObjectTemplate.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("slots"):
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_slots.begin(); iter != m_slots.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_slots.clear();
|
||||
m_slotsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_slots.push_back(newData);
|
||||
}
|
||||
m_slotsLoaded = true;
|
||||
}
|
||||
m_slots.clear();
|
||||
m_slotsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("skillCommands"):
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_slots.push_back(newData);
|
||||
std::vector<StringParam *>::iterator iter;
|
||||
for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_skillCommands.clear();
|
||||
m_skillCommandsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StringParam * newData = new StringParam;
|
||||
newData->loadFromIff(file);
|
||||
m_skillCommands.push_back(newData);
|
||||
}
|
||||
m_skillCommandsLoaded = true;
|
||||
}
|
||||
m_slotsLoaded = true;
|
||||
break;
|
||||
case constcrc("destroyIngredients"):
|
||||
m_destroyIngredients.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("manufactureScripts"):
|
||||
{
|
||||
std::vector<StringParam *>::iterator iter;
|
||||
for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_manufactureScripts.clear();
|
||||
m_manufactureScriptsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StringParam * newData = new StringParam;
|
||||
newData->loadFromIff(file);
|
||||
m_manufactureScripts.push_back(newData);
|
||||
}
|
||||
m_manufactureScriptsLoaded = true;
|
||||
}
|
||||
break;
|
||||
case constcrc("itemsPerContainer"):
|
||||
m_itemsPerContainer.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("manufactureTime"):
|
||||
m_manufactureTime.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("prototypeTime"):
|
||||
m_prototypeTime.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
else if (strcmp(paramName, "skillCommands") == 0)
|
||||
{
|
||||
std::vector<StringParam *>::iterator iter;
|
||||
for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_skillCommands.clear();
|
||||
m_skillCommandsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StringParam * newData = new StringParam;
|
||||
newData->loadFromIff(file);
|
||||
m_skillCommands.push_back(newData);
|
||||
}
|
||||
m_skillCommandsLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "destroyIngredients") == 0)
|
||||
m_destroyIngredients.loadFromIff(file);
|
||||
else if (strcmp(paramName, "manufactureScripts") == 0)
|
||||
{
|
||||
std::vector<StringParam *>::iterator iter;
|
||||
for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_manufactureScripts.clear();
|
||||
m_manufactureScriptsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StringParam * newData = new StringParam;
|
||||
newData->loadFromIff(file);
|
||||
m_manufactureScripts.push_back(newData);
|
||||
}
|
||||
m_manufactureScriptsLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "itemsPerContainer") == 0)
|
||||
m_itemsPerContainer.loadFromIff(file);
|
||||
else if (strcmp(paramName, "manufactureTime") == 0)
|
||||
m_manufactureTime.loadFromIff(file);
|
||||
else if (strcmp(paramName, "prototypeTime") == 0)
|
||||
m_prototypeTime.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -1990,35 +2006,44 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "optional") == 0)
|
||||
m_optional.loadFromIff(file);
|
||||
else if (strcmp(paramName, "name") == 0)
|
||||
m_name.loadFromIff(file);
|
||||
else if (strcmp(paramName, "options") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_options.begin(); iter != m_options.end(); ++iter)
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("optional"):
|
||||
m_optional.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("name"):
|
||||
m_name.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("options"):
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_options.begin(); iter != m_options.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_options.clear();
|
||||
m_optionsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_options.push_back(newData);
|
||||
}
|
||||
m_optionsLoaded = true;
|
||||
}
|
||||
m_options.clear();
|
||||
m_optionsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_options.push_back(newData);
|
||||
}
|
||||
m_optionsLoaded = true;
|
||||
break;
|
||||
case constcrc("optionalSkillCommand"):
|
||||
m_optionalSkillCommand.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("complexity"):
|
||||
m_complexity.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("appearance"):
|
||||
m_appearance.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
else if (strcmp(paramName, "optionalSkillCommand") == 0)
|
||||
m_optionalSkillCommand.loadFromIff(file);
|
||||
else if (strcmp(paramName, "complexity") == 0)
|
||||
m_complexity.loadFromIff(file);
|
||||
else if (strcmp(paramName, "appearance") == 0)
|
||||
m_appearance.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+18
-8
@@ -16,6 +16,9 @@
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <stdio.h>
|
||||
@@ -802,14 +805,21 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "maxExtractionRate") == 0)
|
||||
m_maxExtractionRate.loadFromIff(file);
|
||||
else if (strcmp(paramName, "currentExtractionRate") == 0)
|
||||
m_currentExtractionRate.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxHopperSize") == 0)
|
||||
m_maxHopperSize.loadFromIff(file);
|
||||
else if (strcmp(paramName, "masterClassName") == 0)
|
||||
m_masterClassName.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("maxExtractionRate"):
|
||||
m_maxExtractionRate.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("currentExtractionRate"):
|
||||
m_currentExtractionRate.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxHopperSize"):
|
||||
m_maxHopperSize.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("masterClassName"):
|
||||
m_masterClassName.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+53
-32
@@ -16,6 +16,9 @@
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <stdio.h>
|
||||
@@ -371,7 +374,7 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "count") == 0)
|
||||
if (strcmp(paramName, "count"))
|
||||
m_count.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
@@ -905,31 +908,38 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "ingredientType") == 0)
|
||||
m_ingredientType.loadFromIff(file);
|
||||
else if (strcmp(paramName, "ingredients") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter)
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("ingredientType"):
|
||||
m_ingredientType.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("ingredients"):
|
||||
{
|
||||
delete *iter;
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_ingredients.clear();
|
||||
m_ingredientsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_ingredients.push_back(newData);
|
||||
}
|
||||
m_ingredientsLoaded = true;
|
||||
}
|
||||
m_ingredients.clear();
|
||||
m_ingredientsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_ingredients.push_back(newData);
|
||||
}
|
||||
m_ingredientsLoaded = true;
|
||||
break;
|
||||
case constcrc("complexity"):
|
||||
m_complexity.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("skillCommand"):
|
||||
m_skillCommand.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
else if (strcmp(paramName, "complexity") == 0)
|
||||
m_complexity.loadFromIff(file);
|
||||
else if (strcmp(paramName, "skillCommand") == 0)
|
||||
m_skillCommand.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -1250,10 +1260,15 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "name") == 0)
|
||||
m_name.loadFromIff(file);
|
||||
else if (strcmp(paramName, "value") == 0)
|
||||
m_value.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("name"):
|
||||
m_name.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("value"):
|
||||
m_value.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -1617,12 +1632,18 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "name") == 0)
|
||||
m_name.loadFromIff(file);
|
||||
else if (strcmp(paramName, "ingredient") == 0)
|
||||
m_ingredient.loadFromIff(file);
|
||||
else if (strcmp(paramName, "count") == 0)
|
||||
m_count.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("name"):
|
||||
m_name.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("ingredient"):
|
||||
m_ingredient.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("count"):
|
||||
m_count.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+60
-43
@@ -16,6 +16,9 @@
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <stdio.h>
|
||||
@@ -821,49 +824,57 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "draftSchematic") == 0)
|
||||
m_draftSchematic.loadFromIff(file);
|
||||
else if (strcmp(paramName, "creator") == 0)
|
||||
m_creator.loadFromIff(file);
|
||||
else if (strcmp(paramName, "ingredients") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter)
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("draftSchematic"):
|
||||
m_draftSchematic.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("creator"):
|
||||
m_creator.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("ingredients"):
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_ingredients.clear();
|
||||
m_ingredientsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_ingredients.push_back(newData);
|
||||
}
|
||||
m_ingredientsLoaded = true;
|
||||
}
|
||||
m_ingredients.clear();
|
||||
m_ingredientsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("itemCount"):
|
||||
m_itemCount.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("attributes"):
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_ingredients.push_back(newData);
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_attributes.clear();
|
||||
m_attributesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_attributes.push_back(newData);
|
||||
}
|
||||
m_attributesLoaded = true;
|
||||
}
|
||||
m_ingredientsLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "itemCount") == 0)
|
||||
m_itemCount.loadFromIff(file);
|
||||
else if (strcmp(paramName, "attributes") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_attributes.clear();
|
||||
m_attributesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_attributes.push_back(newData);
|
||||
}
|
||||
m_attributesLoaded = true;
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
@@ -1110,10 +1121,16 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "name") == 0)
|
||||
m_name.loadFromIff(file);
|
||||
else if (strcmp(paramName, "ingredient") == 0)
|
||||
m_ingredient.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("name"):
|
||||
m_name.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("ingredient"):
|
||||
m_ingredient.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+220
-171
@@ -16,6 +16,9 @@
|
||||
#include "sharedMath/Vector.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
#include "ServerObjectTemplate.h"
|
||||
//@END TFD TEMPLATE REFS
|
||||
@@ -1900,150 +1903,168 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "sharedTemplate") == 0)
|
||||
m_sharedTemplate.loadFromIff(file);
|
||||
else if (strcmp(paramName, "scripts") == 0)
|
||||
{
|
||||
std::vector<StringParam *>::iterator iter;
|
||||
for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter)
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("sharedTemplate"):
|
||||
m_sharedTemplate.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("scripts"):
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
std::vector<StringParam *>::iterator iter;
|
||||
for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_scripts.clear();
|
||||
m_scriptsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StringParam * newData = new StringParam;
|
||||
newData->loadFromIff(file);
|
||||
m_scripts.push_back(newData);
|
||||
}
|
||||
m_scriptsLoaded = true;
|
||||
}
|
||||
m_scripts.clear();
|
||||
m_scriptsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("objvars"):
|
||||
m_objvars.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("volume"):
|
||||
m_volume.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("visibleFlags"):
|
||||
{
|
||||
StringParam * newData = new StringParam;
|
||||
newData->loadFromIff(file);
|
||||
m_scripts.push_back(newData);
|
||||
std::vector<IntegerParam *>::iterator iter;
|
||||
for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_visibleFlags.clear();
|
||||
m_visibleFlagsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam * newData = new IntegerParam;
|
||||
newData->loadFromIff(file);
|
||||
m_visibleFlags.push_back(newData);
|
||||
}
|
||||
m_visibleFlagsLoaded = true;
|
||||
}
|
||||
m_scriptsLoaded = true;
|
||||
break;
|
||||
case constcrc("deleteFlags"):
|
||||
{
|
||||
std::vector<IntegerParam *>::iterator iter;
|
||||
for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_deleteFlags.clear();
|
||||
m_deleteFlagsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam * newData = new IntegerParam;
|
||||
newData->loadFromIff(file);
|
||||
m_deleteFlags.push_back(newData);
|
||||
}
|
||||
m_deleteFlagsLoaded = true;
|
||||
}
|
||||
break;
|
||||
case constcrc("moveFlags"):
|
||||
{
|
||||
std::vector<IntegerParam *>::iterator iter;
|
||||
for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_moveFlags.clear();
|
||||
m_moveFlagsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam * newData = new IntegerParam;
|
||||
newData->loadFromIff(file);
|
||||
m_moveFlags.push_back(newData);
|
||||
}
|
||||
m_moveFlagsLoaded = true;
|
||||
}
|
||||
break;
|
||||
case constcrc("invulnerable"):
|
||||
m_invulnerable.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("complexity"):
|
||||
m_complexity.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("tintIndex"):
|
||||
m_tintIndex.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("updateRanges"):
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 3, ("Template %s: read array size of %d for array \"updateRanges\" of size 3, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 3 && j < listCount; ++j)
|
||||
m_updateRanges[j].loadFromIff(file);
|
||||
// if there are more params for updateRanges read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case constcrc("contents"):
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_contents.begin(); iter != m_contents.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_contents.clear();
|
||||
m_contentsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_contents.push_back(newData);
|
||||
}
|
||||
m_contentsLoaded = true;
|
||||
}
|
||||
break;
|
||||
case constcrc("xpPoints"):
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_xpPoints.clear();
|
||||
m_xpPointsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_xpPoints.push_back(newData);
|
||||
}
|
||||
m_xpPointsLoaded = true;
|
||||
}
|
||||
break;
|
||||
case constcrc("persistByDefault"):
|
||||
m_persistByDefault.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("persistContents"):
|
||||
m_persistContents.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
else if (strcmp(paramName, "objvars") == 0)
|
||||
m_objvars.loadFromIff(file);
|
||||
else if (strcmp(paramName, "volume") == 0)
|
||||
m_volume.loadFromIff(file);
|
||||
else if (strcmp(paramName, "visibleFlags") == 0)
|
||||
{
|
||||
std::vector<IntegerParam *>::iterator iter;
|
||||
for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_visibleFlags.clear();
|
||||
m_visibleFlagsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam * newData = new IntegerParam;
|
||||
newData->loadFromIff(file);
|
||||
m_visibleFlags.push_back(newData);
|
||||
}
|
||||
m_visibleFlagsLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "deleteFlags") == 0)
|
||||
{
|
||||
std::vector<IntegerParam *>::iterator iter;
|
||||
for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_deleteFlags.clear();
|
||||
m_deleteFlagsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam * newData = new IntegerParam;
|
||||
newData->loadFromIff(file);
|
||||
m_deleteFlags.push_back(newData);
|
||||
}
|
||||
m_deleteFlagsLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "moveFlags") == 0)
|
||||
{
|
||||
std::vector<IntegerParam *>::iterator iter;
|
||||
for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_moveFlags.clear();
|
||||
m_moveFlagsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam * newData = new IntegerParam;
|
||||
newData->loadFromIff(file);
|
||||
m_moveFlags.push_back(newData);
|
||||
}
|
||||
m_moveFlagsLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "invulnerable") == 0)
|
||||
m_invulnerable.loadFromIff(file);
|
||||
else if (strcmp(paramName, "complexity") == 0)
|
||||
m_complexity.loadFromIff(file);
|
||||
else if (strcmp(paramName, "tintIndex") == 0)
|
||||
m_tintIndex.loadFromIff(file);
|
||||
else if (strcmp(paramName, "updateRanges") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 3, ("Template %s: read array size of %d for array \"updateRanges\" of size 3, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 3 && j < listCount; ++j)
|
||||
m_updateRanges[j].loadFromIff(file);
|
||||
// if there are more params for updateRanges read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
else if (strcmp(paramName, "contents") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_contents.begin(); iter != m_contents.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_contents.clear();
|
||||
m_contentsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_contents.push_back(newData);
|
||||
}
|
||||
m_contentsLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "xpPoints") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_xpPoints.clear();
|
||||
m_xpPointsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_xpPoints.push_back(newData);
|
||||
}
|
||||
m_xpPointsLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "persistByDefault") == 0)
|
||||
m_persistByDefault.loadFromIff(file);
|
||||
else if (strcmp(paramName, "persistContents") == 0)
|
||||
m_persistContents.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -2946,16 +2967,24 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "target") == 0)
|
||||
m_target.loadFromIff(file);
|
||||
else if (strcmp(paramName, "value") == 0)
|
||||
m_value.loadFromIff(file);
|
||||
else if (strcmp(paramName, "time") == 0)
|
||||
m_time.loadFromIff(file);
|
||||
else if (strcmp(paramName, "timeAtValue") == 0)
|
||||
m_timeAtValue.loadFromIff(file);
|
||||
else if (strcmp(paramName, "decay") == 0)
|
||||
m_decay.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("target"):
|
||||
m_target.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("value"):
|
||||
m_value.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("time"):
|
||||
m_time.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("timeAtValue"):
|
||||
m_timeAtValue.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("decay"):
|
||||
m_decay.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -3205,12 +3234,18 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "slotName") == 0)
|
||||
m_slotName.loadFromIff(file);
|
||||
else if (strcmp(paramName, "equipObject") == 0)
|
||||
m_equipObject.loadFromIff(file);
|
||||
else if (strcmp(paramName, "content") == 0)
|
||||
m_content.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("slotName"):
|
||||
m_slotName.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("equipObject"):
|
||||
m_equipObject.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("content"):
|
||||
m_content.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -4113,16 +4148,24 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "target") == 0)
|
||||
m_target.loadFromIff(file);
|
||||
else if (strcmp(paramName, "value") == 0)
|
||||
m_value.loadFromIff(file);
|
||||
else if (strcmp(paramName, "time") == 0)
|
||||
m_time.loadFromIff(file);
|
||||
else if (strcmp(paramName, "timeAtValue") == 0)
|
||||
m_timeAtValue.loadFromIff(file);
|
||||
else if (strcmp(paramName, "decay") == 0)
|
||||
m_decay.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("target"):
|
||||
m_target.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("value"):
|
||||
m_value.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("time"):
|
||||
m_time.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("timeAtValue"):
|
||||
m_timeAtValue.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("decay"):
|
||||
m_decay.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -4637,12 +4680,18 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "type") == 0)
|
||||
m_type.loadFromIff(file);
|
||||
else if (strcmp(paramName, "level") == 0)
|
||||
m_level.loadFromIff(file);
|
||||
else if (strcmp(paramName, "value") == 0)
|
||||
m_value.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("type"):
|
||||
m_type.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("level"):
|
||||
m_level.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("value"):
|
||||
m_value.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+44
-30
@@ -16,6 +16,9 @@
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
#include "ServerArmorTemplate.h"
|
||||
//@END TFD TEMPLATE REFS
|
||||
@@ -1143,39 +1146,50 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "triggerVolumes") == 0)
|
||||
{
|
||||
std::vector<TriggerVolumeParam *>::iterator iter;
|
||||
for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter)
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("triggerVolumes"):
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
std::vector<TriggerVolumeParam *>::iterator iter;
|
||||
for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_triggerVolumes.clear();
|
||||
m_triggerVolumesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
TriggerVolumeParam * newData = new TriggerVolumeParam;
|
||||
newData->loadFromIff(file);
|
||||
m_triggerVolumes.push_back(newData);
|
||||
}
|
||||
m_triggerVolumesLoaded = true;
|
||||
}
|
||||
m_triggerVolumes.clear();
|
||||
m_triggerVolumesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
TriggerVolumeParam * newData = new TriggerVolumeParam;
|
||||
newData->loadFromIff(file);
|
||||
m_triggerVolumes.push_back(newData);
|
||||
}
|
||||
m_triggerVolumesLoaded = true;
|
||||
break;
|
||||
case constcrc("combatSkeleton"):
|
||||
m_combatSkeleton.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxHitPoints"):
|
||||
m_maxHitPoints.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("armor"):
|
||||
m_armor.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("interestRadius"):
|
||||
m_interestRadius.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("count"):
|
||||
m_count.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("condition"):
|
||||
m_condition.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("wantSawAttackTriggers"):
|
||||
m_wantSawAttackTriggers.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
else if (strcmp(paramName, "combatSkeleton") == 0)
|
||||
m_combatSkeleton.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxHitPoints") == 0)
|
||||
m_maxHitPoints.loadFromIff(file);
|
||||
else if (strcmp(paramName, "armor") == 0)
|
||||
m_armor.loadFromIff(file);
|
||||
else if (strcmp(paramName, "interestRadius") == 0)
|
||||
m_interestRadius.loadFromIff(file);
|
||||
else if (strcmp(paramName, "count") == 0)
|
||||
m_count.loadFromIff(file);
|
||||
else if (strcmp(paramName, "condition") == 0)
|
||||
m_condition.loadFromIff(file);
|
||||
else if (strcmp(paramName, "wantSawAttackTriggers") == 0)
|
||||
m_wantSawAttackTriggers.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+18
-8
@@ -16,6 +16,9 @@
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <stdio.h>
|
||||
@@ -802,14 +805,21 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "fuelType") == 0)
|
||||
m_fuelType.loadFromIff(file);
|
||||
else if (strcmp(paramName, "currentFuel") == 0)
|
||||
m_currentFuel.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxFuel") == 0)
|
||||
m_maxFuel.loadFromIff(file);
|
||||
else if (strcmp(paramName, "consumpsion") == 0)
|
||||
m_consumpsion.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("fuelType"):
|
||||
m_fuelType.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("currentFuel"):
|
||||
m_currentFuel.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxFuel"):
|
||||
m_maxFuel.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("consumpsion"):
|
||||
m_consumpsion.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+51
-30
@@ -16,6 +16,9 @@
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <stdio.h>
|
||||
@@ -2483,36 +2486,54 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "weaponType") == 0)
|
||||
m_weaponType.loadFromIff(file);
|
||||
else if (strcmp(paramName, "attackType") == 0)
|
||||
m_attackType.loadFromIff(file);
|
||||
else if (strcmp(paramName, "damageType") == 0)
|
||||
m_damageType.loadFromIff(file);
|
||||
else if (strcmp(paramName, "elementalType") == 0)
|
||||
m_elementalType.loadFromIff(file);
|
||||
else if (strcmp(paramName, "elementalValue") == 0)
|
||||
m_elementalValue.loadFromIff(file);
|
||||
else if (strcmp(paramName, "minDamageAmount") == 0)
|
||||
m_minDamageAmount.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxDamageAmount") == 0)
|
||||
m_maxDamageAmount.loadFromIff(file);
|
||||
else if (strcmp(paramName, "attackSpeed") == 0)
|
||||
m_attackSpeed.loadFromIff(file);
|
||||
else if (strcmp(paramName, "audibleRange") == 0)
|
||||
m_audibleRange.loadFromIff(file);
|
||||
else if (strcmp(paramName, "minRange") == 0)
|
||||
m_minRange.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxRange") == 0)
|
||||
m_maxRange.loadFromIff(file);
|
||||
else if (strcmp(paramName, "damageRadius") == 0)
|
||||
m_damageRadius.loadFromIff(file);
|
||||
else if (strcmp(paramName, "woundChance") == 0)
|
||||
m_woundChance.loadFromIff(file);
|
||||
else if (strcmp(paramName, "attackCost") == 0)
|
||||
m_attackCost.loadFromIff(file);
|
||||
else if (strcmp(paramName, "accuracy") == 0)
|
||||
m_accuracy.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("weaponType"):
|
||||
m_weaponType.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("attackType"):
|
||||
m_attackType.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("damageType"):
|
||||
m_damageType.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("elementalType"):
|
||||
m_elementalType.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("elementalValue"):
|
||||
m_elementalValue.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("minDamageAmount"):
|
||||
m_minDamageAmount.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxDamageAmount"):
|
||||
m_maxDamageAmount.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("attackSpeed"):
|
||||
m_attackSpeed.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("audibleRange"):
|
||||
m_audibleRange.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("minRange"):
|
||||
m_minRange.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxRange"):
|
||||
m_maxRange.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("damageRadius"):
|
||||
m_damageRadius.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("woundChance"):
|
||||
m_woundChance.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("attackCost"):
|
||||
m_attackCost.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("accuracy"):
|
||||
m_accuracy.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,43 +116,43 @@ bool ShipComponentDataEngine::readDataFromComponent (TangibleObject const & comp
|
||||
DynamicVariableList const & objvars = component.getObjVars ();
|
||||
|
||||
if (!objvars.getItem (Objvars::engineAccelerationRate, m_engineAccelerationRate))
|
||||
WARNING (true, ("ShipComponentDataEngine [%s] has no engineAccelerationRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineAccelerationRate.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataEngine [%s] has no engineAccelerationRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineAccelerationRate.c_str ()));
|
||||
|
||||
if (!objvars.getItem (Objvars::engineDecelerationRate, m_engineDecelerationRate))
|
||||
WARNING (true, ("ShipComponentDataEngine [%s] has no engineDecelerationRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineDecelerationRate.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataEngine [%s] has no engineDecelerationRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineDecelerationRate.c_str ()));
|
||||
|
||||
if (!objvars.getItem (Objvars::enginePitchAccelerationRate, m_enginePitchAccelerationRate))
|
||||
WARNING (true, ("ShipComponentDataEngine [%s] has no enginePitchAccelerationRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::enginePitchAccelerationRate.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataEngine [%s] has no enginePitchAccelerationRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::enginePitchAccelerationRate.c_str ()));
|
||||
else
|
||||
m_enginePitchAccelerationRate = convertDegreesToRadians(m_enginePitchAccelerationRate);
|
||||
|
||||
if (!objvars.getItem (Objvars::engineYawAccelerationRate, m_engineYawAccelerationRate))
|
||||
WARNING (true, ("ShipComponentDataEngine [%s] has no engineYawAccelerationRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineYawAccelerationRate.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataEngine [%s] has no engineYawAccelerationRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineYawAccelerationRate.c_str ()));
|
||||
else
|
||||
m_engineYawAccelerationRate = convertDegreesToRadians(m_engineYawAccelerationRate);
|
||||
|
||||
if (!objvars.getItem (Objvars::engineRollAccelerationRate, m_engineRollAccelerationRate))
|
||||
WARNING (true, ("ShipComponentDataEngine [%s] has no engineRollAccelerationRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineRollAccelerationRate.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataEngine [%s] has no engineRollAccelerationRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineRollAccelerationRate.c_str ()));
|
||||
else
|
||||
m_engineRollAccelerationRate = convertDegreesToRadians(m_engineRollAccelerationRate);
|
||||
|
||||
if (!objvars.getItem (Objvars::enginePitchRateMaximum, m_enginePitchRateMaximum))
|
||||
WARNING (true, ("ShipComponentDataEngine [%s] has no enginePitchRateMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::enginePitchRateMaximum.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataEngine [%s] has no enginePitchRateMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::enginePitchRateMaximum.c_str ()));
|
||||
else
|
||||
m_enginePitchRateMaximum = convertDegreesToRadians(m_enginePitchRateMaximum);
|
||||
|
||||
if (!objvars.getItem (Objvars::engineYawRateMaximum, m_engineYawRateMaximum))
|
||||
WARNING (true, ("ShipComponentDataEngine [%s] has no engineYawRateMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineYawRateMaximum.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataEngine [%s] has no engineYawRateMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineYawRateMaximum.c_str ()));
|
||||
else
|
||||
m_engineYawRateMaximum = convertDegreesToRadians(m_engineYawRateMaximum);
|
||||
|
||||
if (!objvars.getItem (Objvars::engineRollRateMaximum, m_engineRollRateMaximum))
|
||||
WARNING (true, ("ShipComponentDataEngine [%s] has no engineRollRateMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineRollRateMaximum.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataEngine [%s] has no engineRollRateMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineRollRateMaximum.c_str ()));
|
||||
else
|
||||
m_engineRollRateMaximum = convertDegreesToRadians(m_engineRollRateMaximum);
|
||||
|
||||
if (!objvars.getItem (Objvars::engineSpeedMaximum, m_engineSpeedMaximum))
|
||||
WARNING (true, ("ShipComponentDataEngine [%s] has no engineSpeedMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineSpeedMaximum.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataEngine [%s] has no engineSpeedMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::engineSpeedMaximum.c_str ()));
|
||||
|
||||
if (!objvars.getItem(Objvars::engineSpeedRotationFactorMaximum, m_engineSpeedRotationFactorMaximum))
|
||||
{
|
||||
|
||||
@@ -104,32 +104,32 @@ bool ShipComponentDataWeapon::readDataFromComponent (TangibleObject const & comp
|
||||
DynamicVariableList const & objvars = component.getObjVars ();
|
||||
|
||||
if (!objvars.getItem (Objvars::weaponDamageMaximum, m_weaponDamageMaximum))
|
||||
WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponDamageMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponDamageMaximum.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponDamageMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponDamageMaximum.c_str ()));
|
||||
|
||||
if (!objvars.getItem (Objvars::weaponDamageMinimum, m_weaponDamageMinimum))
|
||||
WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponDamageMinimum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponDamageMinimum.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponDamageMinimum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponDamageMinimum.c_str ()));
|
||||
|
||||
if (!objvars.getItem (Objvars::weaponEffectivenessShields, m_weaponEffectivenessShields))
|
||||
WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponEffectivenessShields [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponEffectivenessShields.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponEffectivenessShields [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponEffectivenessShields.c_str ()));
|
||||
|
||||
if (!objvars.getItem (Objvars::weaponEffectivenessArmor, m_weaponEffectivenessArmor))
|
||||
WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponEffectivenessArmor [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponEffectivenessArmor.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponEffectivenessArmor [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponEffectivenessArmor.c_str ()));
|
||||
|
||||
if (!objvars.getItem (Objvars::weaponEnergyPerShot, m_weaponEnergyPerShot))
|
||||
WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponEnergyPerShot [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponEnergyPerShot.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponEnergyPerShot [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponEnergyPerShot.c_str ()));
|
||||
|
||||
if (!objvars.getItem (Objvars::weaponRefireRate, m_weaponRefireRate))
|
||||
WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponRefireRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponRefireRate.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataWeapon [%s] has no weaponRefireRate [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponRefireRate.c_str ()));
|
||||
|
||||
if (!objvars.getItem (Objvars::weaponAmmoCurrent, m_weaponAmmoCurrent))
|
||||
WARNING (true, ("ShipComponentDataWeapon [%s] has no m_weaponAmmoCurrent [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponAmmoCurrent.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataWeapon [%s] has no m_weaponAmmoCurrent [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponAmmoCurrent.c_str ()));
|
||||
|
||||
if (!objvars.getItem (Objvars::weaponAmmoMaximum, m_weaponAmmoMaximum))
|
||||
WARNING (true, ("ShipComponentDataWeapon [%s] has no m_weaponAmmoMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponAmmoMaximum.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataWeapon [%s] has no m_weaponAmmoMaximum [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponAmmoMaximum.c_str ()));
|
||||
|
||||
int ammoType = 0;
|
||||
if (!objvars.getItem (Objvars::weaponAmmoType, ammoType))
|
||||
WARNING (true, ("ShipComponentDataWeapon [%s] has no m_weaponAmmoType [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponAmmoType.c_str ()));
|
||||
DEBUG_WARNING (true, ("ShipComponentDataWeapon [%s] has no m_weaponAmmoType [%s]", component.getNetworkId ().getValueString ().c_str (), Objvars::weaponAmmoType.c_str ()));
|
||||
else
|
||||
m_weaponAmmoType = static_cast<uint32>(ammoType);
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
// ======================================================================
|
||||
|
||||
CharacterNamesMessage::CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int64> &createTimes, const std::vector<int64> &loginTimes) :
|
||||
CharacterNamesMessage::CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int> &createTimes, const std::vector<int> &loginTimes) :
|
||||
GameNetworkMessage("CharacterNamesMessage"),
|
||||
m_ids(),
|
||||
m_stationIds(),
|
||||
|
||||
+10
-11
@@ -8,7 +8,6 @@
|
||||
#ifndef INCLUDED_CharacterNamesMessage_H
|
||||
#define INCLUDED_CharacterNamesMessage_H
|
||||
|
||||
#include "sharedFoundation/StationId.h"
|
||||
#include "sharedNetworkMessages/GameNetworkMessage.h"
|
||||
|
||||
// ======================================================================
|
||||
@@ -22,24 +21,24 @@
|
||||
class CharacterNamesMessage : public GameNetworkMessage
|
||||
{
|
||||
public:
|
||||
CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int64> &createTimes, const std::vector<int64> &loginTimes);
|
||||
CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int> &createTimes, const std::vector<int> &loginTimes);
|
||||
CharacterNamesMessage(Archive::ReadIterator & source);
|
||||
~CharacterNamesMessage();
|
||||
|
||||
const std::vector<NetworkId> &getIds() const;
|
||||
const std::vector<StationId> &getStationIds() const;
|
||||
const std::vector<int> &getStationIds() const;
|
||||
const std::vector<std::string> &getNames() const;
|
||||
const std::vector<std::string> &getFullNames() const;
|
||||
const std::vector<int64> &getCreateTimes() const;
|
||||
const std::vector<int64> &getLoginTimes() const;
|
||||
const std::vector<int> &getCreateTimes() const;
|
||||
const std::vector<int> &getLoginTimes() const;
|
||||
|
||||
private:
|
||||
Archive::AutoArray<NetworkId> m_ids;
|
||||
Archive::AutoArray<StationId> m_stationIds;
|
||||
Archive::AutoArray<int> m_stationIds;
|
||||
Archive::AutoArray<std::string> m_names;
|
||||
Archive::AutoArray<std::string> m_fullNames;
|
||||
Archive::AutoArray<int64> m_createTimes;
|
||||
Archive::AutoArray<int64> m_loginTimes;
|
||||
Archive::AutoArray<int> m_createTimes;
|
||||
Archive::AutoArray<int> m_loginTimes;
|
||||
|
||||
private:
|
||||
//disabled functions:
|
||||
@@ -58,7 +57,7 @@ inline const std::vector<NetworkId> & CharacterNamesMessage::getIds() const
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const std::vector<StationId> & CharacterNamesMessage::getStationIds() const
|
||||
inline const std::vector<int> & CharacterNamesMessage::getStationIds() const
|
||||
{
|
||||
return m_stationIds.get();
|
||||
}
|
||||
@@ -79,14 +78,14 @@ inline const std::vector<std::string> & CharacterNamesMessage::getFullNames() co
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const std::vector<int64> & CharacterNamesMessage::getCreateTimes() const
|
||||
inline const std::vector<int> & CharacterNamesMessage::getCreateTimes() const
|
||||
{
|
||||
return m_createTimes.get();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const std::vector<int64> & CharacterNamesMessage::getLoginTimes() const
|
||||
inline const std::vector<int> & CharacterNamesMessage::getLoginTimes() const
|
||||
{
|
||||
return m_loginTimes.get();
|
||||
}
|
||||
|
||||
@@ -424,12 +424,12 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const
|
||||
{
|
||||
DEBUG_WARNING(doWarnings,("CityPathNode::sanityCheck - Node has an edge to a non-existent node\n"));
|
||||
insaneCount++;
|
||||
}
|
||||
|
||||
if(!neighborNode->hasEdge(getIndex()))
|
||||
{
|
||||
DEBUG_WARNING(doWarnings,("CityPathNode::sanityCheck - Node has a one-way edge to another node\n"));
|
||||
insaneCount++;
|
||||
} else {
|
||||
if(!neighborNode->hasEdge(getIndex()))
|
||||
{
|
||||
DEBUG_WARNING(doWarnings,("CityPathNode::sanityCheck - Node has a one-way edge to another node\n"));
|
||||
insaneCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1141,30 +1141,31 @@ void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const
|
||||
|
||||
float dist2 = REAL_MAX;
|
||||
|
||||
if(m_path && !m_path->empty()) dist2 = m_path->back().getPosition_w().magnitudeBetweenSquared(loc.getPosition_w());
|
||||
if(m_path && !m_path->empty()) {
|
||||
dist2 = m_path->back().getPosition_w().magnitudeBetweenSquared(loc.getPosition_w());
|
||||
|
||||
if(dist2 > 0.01)
|
||||
{
|
||||
// jitter the node if it's a city waypoint
|
||||
|
||||
if(m_enableJitter && (node->getType() == PNT_CityWaypoint))
|
||||
if(dist2 > 0.01)
|
||||
{
|
||||
Vector offset = Vector::zero;
|
||||
|
||||
do
|
||||
// jitter the node if it's a city waypoint
|
||||
if(m_enableJitter && (node->getType() == PNT_CityWaypoint))
|
||||
{
|
||||
offset = Vector( Random::randomReal(-1.0f,1.0f), 0.0f, Random::randomReal(-1.0f,1.0f) );
|
||||
Vector offset = Vector::zero;
|
||||
|
||||
do
|
||||
{
|
||||
offset = Vector( Random::randomReal(-1.0f,1.0f), 0.0f, Random::randomReal(-1.0f,1.0f) );
|
||||
}
|
||||
while(offset.magnitudeSquared() > 1.0f);
|
||||
|
||||
static float tweakValue = 1.0f;
|
||||
|
||||
offset *= tweakValue;
|
||||
|
||||
loc.setPosition_p( loc.getPosition_p() + offset );
|
||||
}
|
||||
while(offset.magnitudeSquared() > 1.0f);
|
||||
|
||||
static float tweakValue = 1.0f;
|
||||
|
||||
offset *= tweakValue;
|
||||
|
||||
loc.setPosition_p( loc.getPosition_p() + offset );
|
||||
|
||||
m_path->push_back(loc);
|
||||
}
|
||||
|
||||
m_path->push_back(loc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -954,13 +954,13 @@ void JavaLibrary::install(void)
|
||||
if (ms_instance == nullptr)
|
||||
{
|
||||
JavaLibrary *lib = new JavaLibrary;
|
||||
if (lib != ms_instance)
|
||||
if (lib)
|
||||
{
|
||||
if (ms_instance == nullptr)
|
||||
{
|
||||
delete lib;
|
||||
if (ms_javaVmType != JV_none)
|
||||
FATAL(true, ("Unable to initialize Java"));
|
||||
ms_instance = lib;
|
||||
} else {
|
||||
delete lib;
|
||||
if (ms_javaVmType != JV_none) {
|
||||
FATAL(true, ("Unable to initialize Java"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -975,7 +975,7 @@ void JavaLibrary::install(void)
|
||||
*/
|
||||
void JavaLibrary::remove(void)
|
||||
{
|
||||
if (ms_instance != nullptr)
|
||||
if (ms_instance)
|
||||
{
|
||||
JavaLibrary * temp = ms_instance;
|
||||
ms_instance = nullptr;
|
||||
@@ -1065,7 +1065,7 @@ void JavaLibrary::initializeJavaThread()
|
||||
}
|
||||
|
||||
// initial and minimum jvm allocation size
|
||||
tempOption.optionString = "-Xms128m";
|
||||
tempOption.optionString = "-Xms1m";
|
||||
options.push_back(tempOption);
|
||||
|
||||
// maximum jvm allocation - max 512m on 32-bit
|
||||
@@ -3985,6 +3985,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg
|
||||
else
|
||||
{
|
||||
WARNING_STRICT_FATAL(true, ("Error getting back string id param on script return"));
|
||||
delete value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
+5
-11
@@ -118,13 +118,10 @@ File fp;
|
||||
return;
|
||||
|
||||
File temp_fp;
|
||||
char tmpname[] = "/tmp/templatecompXXXXXX";
|
||||
int tmpfd = mkstemp(tmpname);
|
||||
|
||||
if (tmpfd >= 0 && temp_fp.open(tmpname, "wt"))
|
||||
if (!temp_fp.open(tmpnam(nullptr), "wt"))
|
||||
{
|
||||
fprintf(stderr, "error opening temp file for template header "
|
||||
"replacement [%s]\n", fp.getFilename().getFullFilename().c_str());
|
||||
"replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -175,7 +172,7 @@ File fp;
|
||||
}
|
||||
else if (temp_fp.puts(buffer) < 0)
|
||||
{
|
||||
fprintf(stderr, "error writing to temp header file [%s]\n", fp.getFilename().getFullFilename().c_str());
|
||||
fprintf(stderr, "error writing to temp header file [%s]\n", temp_fp.getFilename().getFullFilename().c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -246,11 +243,8 @@ int result;
|
||||
return -1;
|
||||
}
|
||||
|
||||
File temp_fp;
|
||||
char tmpname[] = "/tmp/templatecompXXXXXX";
|
||||
int tmpfd = mkstemp(tmpname);
|
||||
|
||||
if (tmpfd >= 0 && temp_fp.open(tmpname, "wt"))
|
||||
File temp_fp;
|
||||
if (!temp_fp.open(tmpnam(nullptr), "wt"))
|
||||
{
|
||||
fprintf(stderr, "error opening temp file for template source "
|
||||
"replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str());
|
||||
|
||||
@@ -29,14 +29,10 @@ namespace DB {
|
||||
void setValue(const long int rhs);
|
||||
BindableLong &operator=(const long int rhs);
|
||||
|
||||
// following alternate getValue's are provided for convenience, particularly in
|
||||
// the auto-generated code:
|
||||
void getValue(unsigned int &buffer) const;
|
||||
void getValue(uint32 &buffer) const; // for some reason, our compiler is convinced that uint32 != unsigned int
|
||||
void getValue(long int &buffer) const;
|
||||
void getValue(int &buffer) const;
|
||||
void getValue(int8 &buffer) const;
|
||||
void getValue(uint8 &buffer) const;
|
||||
template <typename T>
|
||||
inline void getValue(T &buffer) const {
|
||||
buffer = static_cast<T>(getValue());
|
||||
}
|
||||
|
||||
void *getBuffer();
|
||||
|
||||
@@ -48,48 +44,4 @@ namespace DB {
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline void DB::BindableLong::getValue(unsigned int &buffer) const
|
||||
{
|
||||
buffer=static_cast<unsigned int>(getValue());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline void DB::BindableLong::getValue(uint32 &buffer) const
|
||||
{
|
||||
buffer=static_cast<uint32>(getValue());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline void DB::BindableLong::getValue(long int &buffer) const
|
||||
{
|
||||
buffer=getValue();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline void DB::BindableLong::getValue(int &buffer) const
|
||||
{
|
||||
buffer=getValue();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline void DB::BindableLong::getValue(int8 &buffer) const
|
||||
{
|
||||
buffer=static_cast<int8>(getValue());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline void DB::BindableLong::getValue(uint8 &buffer) const
|
||||
{
|
||||
buffer=static_cast<uint8>(getValue());
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
#endif
|
||||
|
||||
@@ -68,18 +68,17 @@ bool DB::OCIServer::checkerr(OCISession const & session, int status)
|
||||
|
||||
WARNING(true,("Database error: %.*s",512,errbuf));
|
||||
LOG("DatabaseError",("Database error: %.*s",512,errbuf));
|
||||
FATAL(DB::Server::getFatalOnError() || session.getFatalOnError(),("Database error: %.*s",512,errbuf));
|
||||
|
||||
switch ((int) errcode)
|
||||
{
|
||||
case 1013:
|
||||
FATAL(true,("Cancelled by user request (ctrl-c or kill signal).\n"));
|
||||
FATAL(DB::Server::getFatalOnError() || session.getFatalOnError(),("Cancelled by user request (ctrl-c or kill signal).\n"));
|
||||
break;
|
||||
case 12541:
|
||||
REPORT_LOG(true,("Database Error - %.*s\n", 512, errbuf));
|
||||
return false;
|
||||
default:
|
||||
FATAL(true,("Unhandled Database Error - %.*s\n", 512, errbuf));
|
||||
FATAL(DB::Server::getFatalOnError() || session.getFatalOnError(),("Unhandled Database Error - %.*s\n", 512, errbuf));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,13 @@ char SymbolCache::ms_memPool[SymbolCache::cms_memPoolMaxBytes];
|
||||
char *SymbolCache::ms_memPoolFreeList;
|
||||
Mutex SymbolCache::ms_memPoolMutex;
|
||||
SymbolCache::SymbolInfo SymbolCache::ms_nullSym;
|
||||
typedef std::map<void const *, SymbolCache::SymbolInfo, std::less<void const *>, SymbolCacheAllocator<std::pair<void const *, SymbolCache::SymbolInfo> > > SymbolMap;
|
||||
|
||||
typedef std::map<
|
||||
void const *,
|
||||
SymbolCache::SymbolInfo
|
||||
> SymbolMap;
|
||||
|
||||
|
||||
typedef std::vector<char const *, SymbolCacheAllocator<char const *> > UniqueStringVector;
|
||||
static SymbolMap ms_cacheMap;
|
||||
static UniqueStringVector ms_uniqueStringVector;
|
||||
@@ -567,7 +573,7 @@ static bool stabsFind(void const *addr, Dl_info const &info, char const *& retSr
|
||||
|
||||
SymbolCache::SymbolInfo const &SymbolCache::lookup(void const *addr)
|
||||
{
|
||||
SymbolMap::const_iterator i = ms_cacheMap.find(addr);
|
||||
auto i = ms_cacheMap.find(addr);
|
||||
if (i != ms_cacheMap.end())
|
||||
return (*i).second;
|
||||
|
||||
|
||||
+14
-2
@@ -3,6 +3,7 @@
|
||||
// CrcConstexpr.hpp
|
||||
//
|
||||
// adapted from Ross Williams' public domain crc code.
|
||||
// copied and modified to work as a constexpr by Darth
|
||||
//
|
||||
// Portions copyright 1998 Bootprint Entertainment
|
||||
// Portions copyright 2002 Sony Online Entertainment
|
||||
@@ -54,16 +55,27 @@ constexpr uint32 CRC_INIT = 0xFFFFFFFF;
|
||||
|
||||
constexpr const uint32 constcrc(const char *string)
|
||||
{
|
||||
uint32 crc = 0;
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
uint32 crc = 0;
|
||||
for (crc = CRC_INIT; *string; ++string)
|
||||
crc = crctable[((crc>>24) ^ static_cast<byte>(*string)) & 0xFF] ^ (crc << 8);
|
||||
|
||||
return (crc ^ CRC_INIT);
|
||||
}
|
||||
|
||||
inline const uint32 runtimeCrc(const char *string)
|
||||
{
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
uint32 crc = 0;
|
||||
for (crc = CRC_INIT; *string; ++string)
|
||||
crc = crctable[((crc>>24) ^ static_cast<byte>(*string)) & 0xFF] ^ (crc << 8);
|
||||
|
||||
return (crc ^ CRC_INIT);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
|
||||
@@ -57,7 +57,6 @@ static const uint32 crctable[256] =
|
||||
};
|
||||
|
||||
const uint32 CRC_INIT = 0xFFFFFFFF;
|
||||
|
||||
const uint32 Crc::crcInit = CRC_INIT;
|
||||
|
||||
|
||||
@@ -65,11 +64,10 @@ const uint32 Crc::crcInit = CRC_INIT;
|
||||
|
||||
uint32 Crc::calculate(const char *string)
|
||||
{
|
||||
uint32 crc;
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
uint32 crc = 0;
|
||||
for (crc = CRC_INIT; *string; ++string)
|
||||
crc = crctable[((crc>>24) ^ static_cast<byte>(*string)) & 0xFF] ^ (crc << 8);
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
|
||||
// ======================================================================
|
||||
|
||||
typedef int64 StationId;
|
||||
// if this is per the SOE provided types header, this is acutally an unsigned long and not a uint32_t
|
||||
typedef uint32 StationId;
|
||||
|
||||
// ======================================================================
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#define PLATFORM_LINUX
|
||||
|
||||
#include <cstdio>
|
||||
#include <sys/bitypes.h>
|
||||
|
||||
// ======================================================================
|
||||
// basic types that we assume to be around
|
||||
|
||||
@@ -22,12 +20,11 @@ typedef unsigned long uint32;
|
||||
typedef signed char int8;
|
||||
typedef signed short int16;
|
||||
typedef signed long int32;
|
||||
typedef signed long long int int64;
|
||||
typedef unsigned long long int uint64;
|
||||
typedef float real;
|
||||
typedef FILE* FILE_HANDLE;
|
||||
|
||||
typedef int64_t int64;
|
||||
typedef u_int64_t uint64;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
//
|
||||
// ======================================================================
|
||||
|
||||
#include <sys/bitypes.h>
|
||||
|
||||
#ifndef INCLUDED_FoundationTypesWin32_H
|
||||
#define INCLUDED_FoundationTypesWin32_H
|
||||
|
||||
@@ -30,10 +28,6 @@ typedef signed long int32;
|
||||
typedef signed __int64 int64;
|
||||
typedef int FILE_HANDLE;
|
||||
|
||||
typedef int64_t int64;
|
||||
typedef u_int64_t uint64;
|
||||
|
||||
|
||||
// ======================================================================
|
||||
|
||||
#endif
|
||||
|
||||
+12
-4
@@ -17,6 +17,9 @@
|
||||
#include "sharedMath/Vector.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <algorithm>
|
||||
@@ -557,10 +560,15 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "numberOfPoles") == 0)
|
||||
m_numberOfPoles.loadFromIff(file);
|
||||
else if (strcmp(paramName, "radius") == 0)
|
||||
m_radius.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("numberOfPoles"):
|
||||
m_numberOfPoles.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("radius"):
|
||||
m_radius.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -16,6 +16,9 @@
|
||||
#include "sharedMath/Vector.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <algorithm>
|
||||
@@ -254,10 +257,15 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "terrainModificationFileName") == 0)
|
||||
m_terrainModificationFileName.loadFromIff(file);
|
||||
else if (strcmp(paramName, "interiorLayoutFileName") == 0)
|
||||
m_interiorLayoutFileName.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("terrainModificationFileName"):
|
||||
m_terrainModificationFileName.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("interiorLayoutFileName"):
|
||||
m_interiorLayoutFileName.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+111
-83
@@ -22,6 +22,9 @@
|
||||
#include "sharedObject/Object.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
#include "sharedObject/BasicRangedIntCustomizationVariable.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <algorithm>
|
||||
@@ -3286,98 +3289,123 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "gender") == 0)
|
||||
m_gender.loadFromIff(file);
|
||||
else if (strcmp(paramName, "niche") == 0)
|
||||
m_niche.loadFromIff(file);
|
||||
else if (strcmp(paramName, "species") == 0)
|
||||
m_species.loadFromIff(file);
|
||||
else if (strcmp(paramName, "race") == 0)
|
||||
m_race.loadFromIff(file);
|
||||
else if (strcmp(paramName, "acceleration") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 2, ("Template %s: read array size of %d for array \"acceleration\" of size 2, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 2 && j < listCount; ++j)
|
||||
m_acceleration[j].loadFromIff(file);
|
||||
// if there are more params for acceleration read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("gender"):
|
||||
m_gender.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("niche"):
|
||||
m_niche.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("species"):
|
||||
m_species.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("race"):
|
||||
m_race.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("acceleration"):
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 2, ("Template %s: read array size of %d for array \"acceleration\" of size 2, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 2 && j < listCount; ++j)
|
||||
m_acceleration[j].loadFromIff(file);
|
||||
// if there are more params for acceleration read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp(paramName, "speed") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 2, ("Template %s: read array size of %d for array \"speed\" of size 2, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 2 && j < listCount; ++j)
|
||||
m_speed[j].loadFromIff(file);
|
||||
// if there are more params for speed read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("speed"):
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 2, ("Template %s: read array size of %d for array \"speed\" of size 2, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 2 && j < listCount; ++j)
|
||||
m_speed[j].loadFromIff(file);
|
||||
// if there are more params for speed read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp(paramName, "turnRate") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 2, ("Template %s: read array size of %d for array \"turnRate\" of size 2, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 2 && j < listCount; ++j)
|
||||
m_turnRate[j].loadFromIff(file);
|
||||
// if there are more params for turnRate read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("turnRate"):
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 2, ("Template %s: read array size of %d for array \"turnRate\" of size 2, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 2 && j < listCount; ++j)
|
||||
m_turnRate[j].loadFromIff(file);
|
||||
// if there are more params for turnRate read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp(paramName, "animationMapFilename") == 0)
|
||||
m_animationMapFilename.loadFromIff(file);
|
||||
else if (strcmp(paramName, "slopeModAngle") == 0)
|
||||
m_slopeModAngle.loadFromIff(file);
|
||||
else if (strcmp(paramName, "slopeModPercent") == 0)
|
||||
m_slopeModPercent.loadFromIff(file);
|
||||
else if (strcmp(paramName, "waterModPercent") == 0)
|
||||
m_waterModPercent.loadFromIff(file);
|
||||
else if (strcmp(paramName, "stepHeight") == 0)
|
||||
m_stepHeight.loadFromIff(file);
|
||||
else if (strcmp(paramName, "collisionHeight") == 0)
|
||||
m_collisionHeight.loadFromIff(file);
|
||||
else if (strcmp(paramName, "collisionRadius") == 0)
|
||||
m_collisionRadius.loadFromIff(file);
|
||||
else if (strcmp(paramName, "movementDatatable") == 0)
|
||||
m_movementDatatable.loadFromIff(file);
|
||||
else if (strcmp(paramName, "postureAlignToTerrain") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 15, ("Template %s: read array size of %d for array \"postureAlignToTerrain\" of size 15, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 15 && j < listCount; ++j)
|
||||
m_postureAlignToTerrain[j].loadFromIff(file);
|
||||
// if there are more params for postureAlignToTerrain read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("animationMapFilename"):
|
||||
m_animationMapFilename.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("slopeModAngle"):
|
||||
m_slopeModAngle.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("slopeModPercent"):
|
||||
m_slopeModPercent.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("waterModPercent"):
|
||||
m_waterModPercent.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("stepHeight"):
|
||||
m_stepHeight.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("collisionHeight"):
|
||||
m_collisionHeight.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("collisionRadius"):
|
||||
m_collisionRadius.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("movementDatatable"):
|
||||
m_movementDatatable.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("postureAlignToTerrain"):
|
||||
{
|
||||
BoolParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 15, ("Template %s: read array size of %d for array \"postureAlignToTerrain\" of size 15, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 15 && j < listCount; ++j)
|
||||
m_postureAlignToTerrain[j].loadFromIff(file);
|
||||
// if there are more params for postureAlignToTerrain read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
BoolParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case constcrc("swimHeight"):
|
||||
m_swimHeight.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("warpTolerance"):
|
||||
m_warpTolerance.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("collisionOffsetX"):
|
||||
m_collisionOffsetX.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("collisionOffsetZ"):
|
||||
m_collisionOffsetZ.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("collisionLength"):
|
||||
m_collisionLength.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("cameraHeight"):
|
||||
m_cameraHeight.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
else if (strcmp(paramName, "swimHeight") == 0)
|
||||
m_swimHeight.loadFromIff(file);
|
||||
else if (strcmp(paramName, "warpTolerance") == 0)
|
||||
m_warpTolerance.loadFromIff(file);
|
||||
else if (strcmp(paramName, "collisionOffsetX") == 0)
|
||||
m_collisionOffsetX.loadFromIff(file);
|
||||
else if (strcmp(paramName, "collisionOffsetZ") == 0)
|
||||
m_collisionOffsetZ.loadFromIff(file);
|
||||
else if (strcmp(paramName, "collisionLength") == 0)
|
||||
m_collisionLength.loadFromIff(file);
|
||||
else if (strcmp(paramName, "cameraHeight") == 0)
|
||||
m_cameraHeight.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+64
-45
@@ -16,6 +16,9 @@
|
||||
#include "sharedMath/Vector.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <algorithm>
|
||||
@@ -542,46 +545,52 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "slots") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_slots.begin(); iter != m_slots.end(); ++iter)
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("slots"):
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_slots.begin(); iter != m_slots.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_slots.clear();
|
||||
m_slotsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_slots.push_back(newData);
|
||||
}
|
||||
m_slotsLoaded = true;
|
||||
}
|
||||
m_slots.clear();
|
||||
m_slotsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("attributes"):
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_slots.push_back(newData);
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_attributes.clear();
|
||||
m_attributesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_attributes.push_back(newData);
|
||||
}
|
||||
m_attributesLoaded = true;
|
||||
}
|
||||
m_slotsLoaded = true;
|
||||
break;
|
||||
case constcrc("craftedSharedTemplate"):
|
||||
m_craftedSharedTemplate.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
else if (strcmp(paramName, "attributes") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_attributes.clear();
|
||||
m_attributesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_attributes.push_back(newData);
|
||||
}
|
||||
m_attributesLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "craftedSharedTemplate") == 0)
|
||||
m_craftedSharedTemplate.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -753,10 +762,14 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "name") == 0)
|
||||
m_name.loadFromIff(file);
|
||||
else if (strcmp(paramName, "hardpoint") == 0)
|
||||
m_hardpoint.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("name"):
|
||||
m_name.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("hardpoint"):
|
||||
m_hardpoint.loadFromIff(file);
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -1120,12 +1133,18 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "name") == 0)
|
||||
m_name.loadFromIff(file);
|
||||
else if (strcmp(paramName, "experiment") == 0)
|
||||
m_experiment.loadFromIff(file);
|
||||
else if (strcmp(paramName, "value") == 0)
|
||||
m_value.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("name"):
|
||||
m_name.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("experiment"):
|
||||
m_experiment.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("value"):
|
||||
m_value.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+54
-24
@@ -26,6 +26,9 @@
|
||||
#include "sharedObject/PortalPropertyTemplateList.h"
|
||||
#include "sharedObject/SlotDescriptor.h"
|
||||
#include "sharedObject/SlotDescriptorList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <algorithm>
|
||||
@@ -2135,8 +2138,8 @@ void SharedObjectTemplate::testValues(void) const
|
||||
*/
|
||||
void SharedObjectTemplate::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() != SharedObjectTemplate_tag)
|
||||
{
|
||||
@@ -2177,54 +2180,81 @@ char paramName[MAX_NAME_SIZE];
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
|
||||
for (int i = 0; i < paramCount; ++i)
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "objectName") == 0)
|
||||
|
||||
switch (runtimeCrc(paramName)) {
|
||||
case constcrc("objectName"):
|
||||
m_objectName.loadFromIff(file);
|
||||
else if (strcmp(paramName, "detailedDescription") == 0)
|
||||
break;
|
||||
case constcrc("detailedDescription"):
|
||||
m_detailedDescription.loadFromIff(file);
|
||||
else if (strcmp(paramName, "lookAtText") == 0)
|
||||
break;
|
||||
case constcrc("lookAtText"):
|
||||
m_lookAtText.loadFromIff(file);
|
||||
else if (strcmp(paramName, "snapToTerrain") == 0)
|
||||
break;
|
||||
case constcrc("snapToTerrain"):
|
||||
m_snapToTerrain.loadFromIff(file);
|
||||
else if (strcmp(paramName, "containerType") == 0)
|
||||
break;
|
||||
case constcrc("containerType"):
|
||||
m_containerType.loadFromIff(file);
|
||||
else if (strcmp(paramName, "containerVolumeLimit") == 0)
|
||||
break;
|
||||
case constcrc("containerVolumeLimit"):
|
||||
m_containerVolumeLimit.loadFromIff(file);
|
||||
else if (strcmp(paramName, "tintPalette") == 0)
|
||||
break;
|
||||
case constcrc("tintPalette"):
|
||||
m_tintPalette.loadFromIff(file);
|
||||
else if (strcmp(paramName, "slotDescriptorFilename") == 0)
|
||||
break;
|
||||
case constcrc("slotDescriptorFilename"):
|
||||
m_slotDescriptorFilename.loadFromIff(file);
|
||||
else if (strcmp(paramName, "arrangementDescriptorFilename") == 0)
|
||||
break;
|
||||
case constcrc("arrangementDescriptorFilename"):
|
||||
m_arrangementDescriptorFilename.loadFromIff(file);
|
||||
else if (strcmp(paramName, "appearanceFilename") == 0)
|
||||
break;
|
||||
case constcrc("appearanceFilename"):
|
||||
m_appearanceFilename.loadFromIff(file);
|
||||
else if (strcmp(paramName, "portalLayoutFilename") == 0)
|
||||
break;
|
||||
case constcrc("portalLayoutFilename"):
|
||||
m_portalLayoutFilename.loadFromIff(file);
|
||||
else if (strcmp(paramName, "clientDataFile") == 0)
|
||||
break;
|
||||
case constcrc("clientDataFile"):
|
||||
m_clientDataFile.loadFromIff(file);
|
||||
else if (strcmp(paramName, "scale") == 0)
|
||||
break;
|
||||
case constcrc("scale"):
|
||||
m_scale.loadFromIff(file);
|
||||
else if (strcmp(paramName, "gameObjectType") == 0)
|
||||
break;
|
||||
case constcrc("gameObjectType"):
|
||||
m_gameObjectType.loadFromIff(file);
|
||||
else if (strcmp(paramName, "sendToClient") == 0)
|
||||
break;
|
||||
case constcrc("sendToClient"):
|
||||
m_sendToClient.loadFromIff(file);
|
||||
else if (strcmp(paramName, "scaleThresholdBeforeExtentTest") == 0)
|
||||
break;
|
||||
case constcrc("scaleThresholdBeforeExtentTest"):
|
||||
m_scaleThresholdBeforeExtentTest.loadFromIff(file);
|
||||
else if (strcmp(paramName, "clearFloraRadius") == 0)
|
||||
break;
|
||||
case constcrc("clearFloraRadius"):
|
||||
m_clearFloraRadius.loadFromIff(file);
|
||||
else if (strcmp(paramName, "surfaceType") == 0)
|
||||
break;
|
||||
case constcrc("surfaceType"):
|
||||
m_surfaceType.loadFromIff(file);
|
||||
else if (strcmp(paramName, "noBuildRadius") == 0)
|
||||
break;
|
||||
case constcrc("noBuildRadius"):
|
||||
m_noBuildRadius.loadFromIff(file);
|
||||
else if (strcmp(paramName, "onlyVisibleInTools") == 0)
|
||||
break;
|
||||
case constcrc("onlyVisibleInTools"):
|
||||
m_onlyVisibleInTools.loadFromIff(file);
|
||||
else if (strcmp(paramName, "locationReservationRadius") == 0)
|
||||
break;
|
||||
case constcrc("locationReservationRadius"):
|
||||
m_locationReservationRadius.loadFromIff(file);
|
||||
else if (strcmp(paramName, "forceNoCollision") == 0)
|
||||
break;
|
||||
case constcrc("forceNoCollision"):
|
||||
m_forceNoCollision.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+17
-8
@@ -23,6 +23,8 @@
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <algorithm>
|
||||
@@ -384,14 +386,21 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "cockpitFilename") == 0)
|
||||
m_cockpitFilename.loadFromIff(file);
|
||||
else if (strcmp(paramName, "hasWings") == 0)
|
||||
m_hasWings.loadFromIff(file);
|
||||
else if (strcmp(paramName, "playerControlled") == 0)
|
||||
m_playerControlled.loadFromIff(file);
|
||||
else if (strcmp(paramName, "interiorLayoutFileName") == 0)
|
||||
m_interiorLayoutFileName.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("cockpitFilename"):
|
||||
m_cockpitFilename.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("hasWings"):
|
||||
m_hasWings.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("playerControlled"):
|
||||
m_playerControlled.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("interiorLayoutFileName"):
|
||||
m_interiorLayoutFileName.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+178
-139
@@ -25,6 +25,9 @@
|
||||
#include "sharedObject/PaletteColorCustomizationVariable.h"
|
||||
#include "sharedObject/StructureFootprint.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <algorithm>
|
||||
@@ -1328,128 +1331,141 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "paletteColorCustomizationVariables") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter)
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("paletteColorCustomizationVariables"):
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_paletteColorCustomizationVariables.clear();
|
||||
m_paletteColorCustomizationVariablesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_paletteColorCustomizationVariables.push_back(newData);
|
||||
}
|
||||
m_paletteColorCustomizationVariablesLoaded = true;
|
||||
}
|
||||
m_paletteColorCustomizationVariables.clear();
|
||||
m_paletteColorCustomizationVariablesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
break;
|
||||
case constcrc("rangedIntCustomizationVariables"):
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_paletteColorCustomizationVariables.push_back(newData);
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_rangedIntCustomizationVariables.clear();
|
||||
m_rangedIntCustomizationVariablesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_rangedIntCustomizationVariables.push_back(newData);
|
||||
}
|
||||
m_rangedIntCustomizationVariablesLoaded = true;
|
||||
}
|
||||
m_paletteColorCustomizationVariablesLoaded = true;
|
||||
break;
|
||||
case constcrc("constStringCustomizationVariables"):
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_constStringCustomizationVariables.clear();
|
||||
m_constStringCustomizationVariablesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_constStringCustomizationVariables.push_back(newData);
|
||||
}
|
||||
m_constStringCustomizationVariablesLoaded = true;
|
||||
}
|
||||
break;
|
||||
case constcrc("socketDestinations"):
|
||||
{
|
||||
std::vector<IntegerParam *>::iterator iter;
|
||||
for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_socketDestinations.clear();
|
||||
m_socketDestinationsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam * newData = new IntegerParam;
|
||||
newData->loadFromIff(file);
|
||||
m_socketDestinations.push_back(newData);
|
||||
}
|
||||
m_socketDestinationsLoaded = true;
|
||||
}
|
||||
break;
|
||||
case constcrc("structureFootprintFileName"):
|
||||
m_structureFootprintFileName.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("useStructureFootprintOutline"):
|
||||
m_useStructureFootprintOutline.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("targetable"):
|
||||
m_targetable.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("certificationsRequired"):
|
||||
{
|
||||
std::vector<StringParam *>::iterator iter;
|
||||
for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_certificationsRequired.clear();
|
||||
m_certificationsRequiredAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StringParam * newData = new StringParam;
|
||||
newData->loadFromIff(file);
|
||||
m_certificationsRequired.push_back(newData);
|
||||
}
|
||||
m_certificationsRequiredLoaded = true;
|
||||
}
|
||||
break;
|
||||
case constcrc("customizationVariableMapping"):
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_customizationVariableMapping.clear();
|
||||
m_customizationVariableMappingAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_customizationVariableMapping.push_back(newData);
|
||||
}
|
||||
m_customizationVariableMappingLoaded = true;
|
||||
}
|
||||
break;
|
||||
case constcrc("clientVisabilityFlag"):
|
||||
m_clientVisabilityFlag.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
else if (strcmp(paramName, "rangedIntCustomizationVariables") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_rangedIntCustomizationVariables.clear();
|
||||
m_rangedIntCustomizationVariablesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_rangedIntCustomizationVariables.push_back(newData);
|
||||
}
|
||||
m_rangedIntCustomizationVariablesLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "constStringCustomizationVariables") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_constStringCustomizationVariables.clear();
|
||||
m_constStringCustomizationVariablesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_constStringCustomizationVariables.push_back(newData);
|
||||
}
|
||||
m_constStringCustomizationVariablesLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "socketDestinations") == 0)
|
||||
{
|
||||
std::vector<IntegerParam *>::iterator iter;
|
||||
for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_socketDestinations.clear();
|
||||
m_socketDestinationsAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
IntegerParam * newData = new IntegerParam;
|
||||
newData->loadFromIff(file);
|
||||
m_socketDestinations.push_back(newData);
|
||||
}
|
||||
m_socketDestinationsLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "structureFootprintFileName") == 0)
|
||||
m_structureFootprintFileName.loadFromIff(file);
|
||||
else if (strcmp(paramName, "useStructureFootprintOutline") == 0)
|
||||
m_useStructureFootprintOutline.loadFromIff(file);
|
||||
else if (strcmp(paramName, "targetable") == 0)
|
||||
m_targetable.loadFromIff(file);
|
||||
else if (strcmp(paramName, "certificationsRequired") == 0)
|
||||
{
|
||||
std::vector<StringParam *>::iterator iter;
|
||||
for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_certificationsRequired.clear();
|
||||
m_certificationsRequiredAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StringParam * newData = new StringParam;
|
||||
newData->loadFromIff(file);
|
||||
m_certificationsRequired.push_back(newData);
|
||||
}
|
||||
m_certificationsRequiredLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "customizationVariableMapping") == 0)
|
||||
{
|
||||
std::vector<StructParamOT *>::iterator iter;
|
||||
for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_customizationVariableMapping.clear();
|
||||
m_customizationVariableMappingAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
StructParamOT * newData = new StructParamOT;
|
||||
newData->loadFromIff(file);
|
||||
m_customizationVariableMapping.push_back(newData);
|
||||
}
|
||||
m_customizationVariableMappingLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "clientVisabilityFlag") == 0)
|
||||
m_clientVisabilityFlag.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -1621,10 +1637,15 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "variableName") == 0)
|
||||
m_variableName.loadFromIff(file);
|
||||
else if (strcmp(paramName, "constValue") == 0)
|
||||
m_constValue.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)){
|
||||
case constcrc("variableName"):
|
||||
m_variableName.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("constValue"):
|
||||
m_constValue.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -1794,10 +1815,15 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "sourceVariable") == 0)
|
||||
m_sourceVariable.loadFromIff(file);
|
||||
else if (strcmp(paramName, "dependentVariable") == 0)
|
||||
m_dependentVariable.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("sourceVariable"):
|
||||
m_sourceVariable.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("dependentVariable"):
|
||||
m_dependentVariable.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -2161,12 +2187,18 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "variableName") == 0)
|
||||
m_variableName.loadFromIff(file);
|
||||
else if (strcmp(paramName, "palettePathName") == 0)
|
||||
m_palettePathName.loadFromIff(file);
|
||||
else if (strcmp(paramName, "defaultPaletteIndex") == 0)
|
||||
m_defaultPaletteIndex.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("variableName"):
|
||||
m_variableName.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("palettePathName"):
|
||||
m_palettePathName.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("defaultPaletteIndex"):
|
||||
m_defaultPaletteIndex.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
@@ -2875,14 +2907,21 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "variableName") == 0)
|
||||
m_variableName.loadFromIff(file);
|
||||
else if (strcmp(paramName, "minValueInclusive") == 0)
|
||||
m_minValueInclusive.loadFromIff(file);
|
||||
else if (strcmp(paramName, "defaultValue") == 0)
|
||||
m_defaultValue.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxValueExclusive") == 0)
|
||||
m_maxValueExclusive.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("variableName"):
|
||||
m_variableName.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("minValueInclusive"):
|
||||
m_minValueInclusive.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("defaultValue"):
|
||||
m_defaultValue.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxValueExclusive"):
|
||||
m_maxValueExclusive.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -16,6 +16,9 @@
|
||||
#include "sharedFile/Iff.h"
|
||||
#include "sharedMath/Vector.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <algorithm>
|
||||
@@ -403,10 +406,15 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "cover") == 0)
|
||||
m_cover.loadFromIff(file);
|
||||
else if (strcmp(paramName, "surfaceType") == 0)
|
||||
m_surfaceType.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("cover"):
|
||||
m_cover.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("surfaceType"):
|
||||
m_surfaceType.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+36
-23
@@ -16,6 +16,9 @@
|
||||
#include "sharedMath/Vector.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <algorithm>
|
||||
@@ -1479,32 +1482,42 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "speed") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 5, ("Template %s: read array size of %d for array \"speed\" of size 5, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 5 && j < listCount; ++j)
|
||||
m_speed[j].loadFromIff(file);
|
||||
// if there are more params for speed read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("speed"):
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 5, ("Template %s: read array size of %d for array \"speed\" of size 5, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 5 && j < listCount; ++j)
|
||||
m_speed[j].loadFromIff(file);
|
||||
// if there are more params for speed read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case constcrc("slopeAversion"):
|
||||
m_slopeAversion.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("hoverValue"):
|
||||
m_hoverValue.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("turnRate"):
|
||||
m_turnRate.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxVelocity"):
|
||||
m_maxVelocity.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("acceleration"):
|
||||
m_acceleration.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("braking"):
|
||||
m_braking.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
else if (strcmp(paramName, "slopeAversion") == 0)
|
||||
m_slopeAversion.loadFromIff(file);
|
||||
else if (strcmp(paramName, "hoverValue") == 0)
|
||||
m_hoverValue.loadFromIff(file);
|
||||
else if (strcmp(paramName, "turnRate") == 0)
|
||||
m_turnRate.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxVelocity") == 0)
|
||||
m_maxVelocity.loadFromIff(file);
|
||||
else if (strcmp(paramName, "acceleration") == 0)
|
||||
m_acceleration.loadFromIff(file);
|
||||
else if (strcmp(paramName, "braking") == 0)
|
||||
m_braking.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+15
-6
@@ -16,6 +16,9 @@
|
||||
#include "sharedMath/Vector.h"
|
||||
#include "sharedObject/ObjectTemplate.h"
|
||||
#include "sharedObject/ObjectTemplateList.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//@BEGIN TFD TEMPLATE REFS
|
||||
//@END TFD TEMPLATE REFS
|
||||
#include <algorithm>
|
||||
@@ -448,12 +451,18 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "weaponEffect") == 0)
|
||||
m_weaponEffect.loadFromIff(file);
|
||||
else if (strcmp(paramName, "weaponEffectIndex") == 0)
|
||||
m_weaponEffectIndex.loadFromIff(file);
|
||||
else if (strcmp(paramName, "attackType") == 0)
|
||||
m_attackType.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("weaponEffect"):
|
||||
m_weaponEffect.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("weaponEffectIndex"):
|
||||
m_weaponEffectIndex.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("attackType"):
|
||||
m_attackType.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ void LogManager::registerObserverType(std::string const &name, LogObserverCreate
|
||||
|
||||
// run through SharedLog keys looking for logTarget#=name:
|
||||
{
|
||||
char key[16];
|
||||
char key[25];
|
||||
strcpy(key, "logTarget");
|
||||
|
||||
for (int i = 0; i < 20; ++i)
|
||||
|
||||
@@ -765,16 +765,16 @@ void Connection::receive(const Archive::ByteStream & bs)
|
||||
|
||||
m_recvAverageBytesPerSecond = m_bytesReceived / lifeTime;
|
||||
|
||||
std::string logChan = "Network:ConnectionStatsRecv:" + getRemoteAddress() + ":";
|
||||
//std::string logChan = "Network:ConnectionStatsRecv:" + getRemoteAddress() + ":";
|
||||
char portBuf[7] = {"\0"};
|
||||
snprintf(portBuf, sizeof(portBuf), "%d", getRemotePort());
|
||||
logChan += portBuf;
|
||||
LOG(logChan, ("Current(%d/sec), Average(%d/sec), Peak(%d/sec) Total Bytes(%d) Total Time(%lu)", bytesPerSecond, m_recvAverageBytesPerSecond, m_recvPeakBytesPerSecond, m_bytesReceived, lifeTime));
|
||||
//logChan += portBuf;
|
||||
//LOG(logChan, ("Current(%d/sec), Average(%d/sec), Peak(%d/sec) Total Bytes(%d) Total Time(%lu)", bytesPerSecond, m_recvAverageBytesPerSecond, m_recvPeakBytesPerSecond, m_bytesReceived, lifeTime));
|
||||
m_lastRecvReportTime = m_lastRecvTime;
|
||||
m_recvBytesReportInterval = 0;
|
||||
|
||||
if (m_managerHandler->getRecvCompressedByteCount() > 0)
|
||||
LOG(logChan, ("Compression Ratio: %.2f : 1.0 - Recv(%d / %d)", m_managerHandler->getCompressionRatio(), m_managerHandler->getRecvUncompressedByteCount(), m_managerHandler->getRecvCompressedByteCount()));
|
||||
//if (m_managerHandler->getRecvCompressedByteCount() > 0)
|
||||
// LOG(logChan, ("Compression Ratio: %.2f : 1.0 - Recv(%d / %d)", m_managerHandler->getCompressionRatio(), m_managerHandler->getRecvUncompressedByteCount(), m_managerHandler->getRecvCompressedByteCount()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -833,16 +833,16 @@ void Connection::reportSend(const int sendSize)
|
||||
|
||||
m_sendAverageBytesPerSecond = m_bytesSent / lifeTime;
|
||||
|
||||
std::string logChan = "Network:ConnectionStatsSend:" + getRemoteAddress() + ":";
|
||||
//std::string logChan = "Network:ConnectionStatsSend:" + getRemoteAddress() + ":";
|
||||
char portBuf[7] = {"\0"};
|
||||
snprintf(portBuf, sizeof(portBuf), "%d", getRemotePort());
|
||||
logChan += portBuf;
|
||||
LOG(logChan, ("Current(%d/sec), Average(%d/sec), Peak(%d/sec) Total Bytes(%d) Total Time(%lu)", bytesPerSecond, m_sendAverageBytesPerSecond, m_sendPeakBytesPerSecond, m_bytesSent, lifeTime));
|
||||
//logChan += portBuf;
|
||||
//LOG(logChan, ("Current(%d/sec), Average(%d/sec), Peak(%d/sec) Total Bytes(%d) Total Time(%lu)", bytesPerSecond, m_sendAverageBytesPerSecond, m_sendPeakBytesPerSecond, m_bytesSent, lifeTime));
|
||||
m_lastSendReportTime = m_lastSendTime;
|
||||
m_sendBytesReportInterval = 0;
|
||||
|
||||
if (m_managerHandler->getSendCompressedByteCount() > 0)
|
||||
LOG(logChan, ("Compression Ratio: %.2f : 1.0 Send(%d / %d)", m_managerHandler->getCompressionRatio(), m_managerHandler->getSendUncompressedByteCount(), m_managerHandler->getSendCompressedByteCount()));
|
||||
// if (m_managerHandler->getSendCompressedByteCount() > 0)
|
||||
// LOG(logChan, ("Compression Ratio: %.2f : 1.0 Send(%d / %d)", m_managerHandler->getCompressionRatio(), m_managerHandler->getSendUncompressedByteCount(), m_managerHandler->getSendCompressedByteCount()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,7 +600,7 @@ AppearanceTemplate *AppearanceTemplateListNamespace::create(const char *const fi
|
||||
{
|
||||
char tagString[5];
|
||||
ConvertTagToString(tag, tagString);
|
||||
WARNING(true, ("AppearanceTemplate binding %s not found for file %s", tagString, actualFileName.getString()));
|
||||
DEBUG_WARNING(true, ("AppearanceTemplate binding %s not found for file %s", tagString, actualFileName.getString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+476
-526
File diff suppressed because it is too large
Load Diff
+177
-212
@@ -20,62 +20,56 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
ServerBuildingObjectTemplate::ServerBuildingObjectTemplate(const std::string & filename)
|
||||
ServerBuildingObjectTemplate::ServerBuildingObjectTemplate(const std::string &filename)
|
||||
//@BEGIN TFD INIT
|
||||
: ServerTangibleObjectTemplate(filename)
|
||||
: ServerTangibleObjectTemplate(filename)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerBuildingObjectTemplate::ServerBuildingObjectTemplate
|
||||
} // ServerBuildingObjectTemplate::ServerBuildingObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
ServerBuildingObjectTemplate::~ServerBuildingObjectTemplate()
|
||||
{
|
||||
ServerBuildingObjectTemplate::~ServerBuildingObjectTemplate() {
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // ServerBuildingObjectTemplate::~ServerBuildingObjectTemplate
|
||||
} // ServerBuildingObjectTemplate::~ServerBuildingObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void ServerBuildingObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(ServerBuildingObjectTemplate_tag, create);
|
||||
} // ServerBuildingObjectTemplate::registerMe
|
||||
void ServerBuildingObjectTemplate::registerMe(void) {
|
||||
ObjectTemplateList::registerTemplate(ServerBuildingObjectTemplate_tag, create);
|
||||
} // ServerBuildingObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a ServerBuildingObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * ServerBuildingObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new ServerBuildingObjectTemplate(filename);
|
||||
} // ServerBuildingObjectTemplate::create
|
||||
ObjectTemplate *ServerBuildingObjectTemplate::create(const std::string &filename) {
|
||||
return new ServerBuildingObjectTemplate(filename);
|
||||
} // ServerBuildingObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag ServerBuildingObjectTemplate::getId(void) const
|
||||
{
|
||||
return ServerBuildingObjectTemplate_tag;
|
||||
} // ServerBuildingObjectTemplate::getId
|
||||
Tag ServerBuildingObjectTemplate::getId(void) const {
|
||||
return ServerBuildingObjectTemplate_tag;
|
||||
} // ServerBuildingObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const {
|
||||
return m_templateVersion;
|
||||
} // ServerBuildingObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
@@ -83,121 +77,100 @@ Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag ServerBuildingObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerBuildingObjectTemplate * base = dynamic_cast<const ServerBuildingObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
Tag ServerBuildingObjectTemplate::getHighestTemplateVersion(void) const {
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerBuildingObjectTemplate *base = dynamic_cast<const ServerBuildingObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerBuildingObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
CompilerIntegerParam * ServerBuildingObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "maintenanceCost") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maintenanceCost;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maintenanceCost\" as an array\n");
|
||||
}
|
||||
else
|
||||
return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerBuildingObjectTemplate::getCompilerIntegerParam
|
||||
CompilerIntegerParam *
|
||||
ServerBuildingObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index) {
|
||||
if (strcmp(name, "maintenanceCost") == 0) {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maintenanceCost;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maintenanceCost\" as an array\n");
|
||||
} else
|
||||
return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerBuildingObjectTemplate::getCompilerIntegerParam
|
||||
|
||||
FloatParam * ServerBuildingObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getFloatParam
|
||||
FloatParam *ServerBuildingObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getFloatParam
|
||||
|
||||
BoolParam * ServerBuildingObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "isPublic") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getBoolParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_isPublic;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"isPublic\" as an array\n");
|
||||
}
|
||||
else
|
||||
return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerBuildingObjectTemplate::getBoolParam
|
||||
BoolParam *ServerBuildingObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) {
|
||||
if (strcmp(name, "isPublic") == 0) {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getBoolParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_isPublic;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"isPublic\" as an array\n");
|
||||
} else
|
||||
return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerBuildingObjectTemplate::getBoolParam
|
||||
|
||||
StringParam * ServerBuildingObjectTemplate::getStringParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getStringParam
|
||||
StringParam *ServerBuildingObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getStringParam
|
||||
|
||||
StringIdParam * ServerBuildingObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getStringIdParam
|
||||
StringIdParam *ServerBuildingObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getStringIdParam
|
||||
|
||||
VectorParam * ServerBuildingObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getVectorParam
|
||||
VectorParam *ServerBuildingObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getVectorParam
|
||||
|
||||
DynamicVariableParam * ServerBuildingObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getDynamicVariableParam
|
||||
DynamicVariableParam *
|
||||
ServerBuildingObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getDynamicVariableParam
|
||||
|
||||
StructParamOT * ServerBuildingObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getStructParamOT
|
||||
StructParamOT *ServerBuildingObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getStructParamOT
|
||||
|
||||
TriggerVolumeParam * ServerBuildingObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getTriggerVolumeParam
|
||||
TriggerVolumeParam *ServerBuildingObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //ServerBuildingObjectTemplate::getTriggerVolumeParam
|
||||
|
||||
void ServerBuildingObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name)
|
||||
{
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerTangibleObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerBuildingObjectTemplate::initStructParamOT
|
||||
void ServerBuildingObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) {
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerTangibleObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerBuildingObjectTemplate::initStructParamOT
|
||||
|
||||
void ServerBuildingObjectTemplate::setAsEmptyList(const char *name)
|
||||
{
|
||||
ServerTangibleObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerBuildingObjectTemplate::setAsEmptyList
|
||||
void ServerBuildingObjectTemplate::setAsEmptyList(const char *name) {
|
||||
ServerTangibleObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerBuildingObjectTemplate::setAsEmptyList
|
||||
|
||||
void ServerBuildingObjectTemplate::setAppend(const char *name)
|
||||
{
|
||||
ServerTangibleObjectTemplate::setAppend(name);
|
||||
} // ServerBuildingObjectTemplate::setAppend
|
||||
void ServerBuildingObjectTemplate::setAppend(const char *name) {
|
||||
ServerTangibleObjectTemplate::setAppend(name);
|
||||
} // ServerBuildingObjectTemplate::setAppend
|
||||
|
||||
bool ServerBuildingObjectTemplate::isAppend(const char *name) const
|
||||
{
|
||||
return ServerTangibleObjectTemplate::isAppend(name);
|
||||
} // ServerBuildingObjectTemplate::isAppend
|
||||
bool ServerBuildingObjectTemplate::isAppend(const char *name) const {
|
||||
return ServerTangibleObjectTemplate::isAppend(name);
|
||||
} // ServerBuildingObjectTemplate::isAppend
|
||||
|
||||
|
||||
int ServerBuildingObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getListLength(name);
|
||||
} // ServerBuildingObjectTemplate::getListLength
|
||||
int ServerBuildingObjectTemplate::getListLength(const char *name) const {
|
||||
return ServerTangibleObjectTemplate::getListLength(name);
|
||||
} // ServerBuildingObjectTemplate::getListLength
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
@@ -205,66 +178,60 @@ int ServerBuildingObjectTemplate::getListLength(const char *name) const
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void ServerBuildingObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
void ServerBuildingObjectTemplate::load(Iff &file) {
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerBuildingObjectTemplate_tag)
|
||||
{
|
||||
ServerTangibleObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
if (file.getCurrentName() != ServerBuildingObjectTemplate_tag) {
|
||||
ServerTangibleObjectTemplate::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,1))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
}
|
||||
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, 1)) {
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
file.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i)
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "maintenanceCost") == 0)
|
||||
m_maintenanceCost.loadFromIff(file);
|
||||
else if (strcmp(paramName, "isPublic") == 0)
|
||||
m_isPublic.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i) {
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "isPublic") == 0)
|
||||
m_isPublic.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maintenanceCost") == 0)
|
||||
m_maintenanceCost.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
file.exitForm();
|
||||
ServerTangibleObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerBuildingObjectTemplate::load
|
||||
file.exitForm();
|
||||
ServerTangibleObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerBuildingObjectTemplate::load
|
||||
|
||||
/**
|
||||
* Saves the template data to an iff file.
|
||||
@@ -272,47 +239,45 @@ char paramName[MAX_NAME_SIZE];
|
||||
* @param file file to save to
|
||||
* @param location file type (client or server)
|
||||
*/
|
||||
void ServerBuildingObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
void ServerBuildingObjectTemplate::save(Iff &file) {
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerBuildingObjectTemplate_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,1));
|
||||
file.allowNonlinearFunctions();
|
||||
file.insertForm(ServerBuildingObjectTemplate_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, 1));
|
||||
file.allowNonlinearFunctions();
|
||||
|
||||
int paramCount = 0;
|
||||
int paramCount = 0;
|
||||
|
||||
// save maintenanceCost
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maintenanceCost");
|
||||
m_maintenanceCost.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save isPublic
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("isPublic");
|
||||
m_isPublic.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maintenanceCost
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maintenanceCost");
|
||||
m_maintenanceCost.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save isPublic
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("isPublic");
|
||||
m_isPublic.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
|
||||
file.exitForm(true);
|
||||
ServerTangibleObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
UNREF(count);
|
||||
} // ServerBuildingObjectTemplate::save
|
||||
file.exitForm(true);
|
||||
ServerTangibleObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
UNREF(count);
|
||||
} // ServerBuildingObjectTemplate::save
|
||||
|
||||
//@END TFD
|
||||
|
||||
+616
-653
File diff suppressed because it is too large
Load Diff
+802
-846
File diff suppressed because it is too large
Load Diff
+226
-255
@@ -19,63 +19,59 @@
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
ServerHarvesterInstallationObjectTemplate::ServerHarvesterInstallationObjectTemplate(const std::string & filename)
|
||||
ServerHarvesterInstallationObjectTemplate::ServerHarvesterInstallationObjectTemplate(const std::string &filename)
|
||||
//@BEGIN TFD INIT
|
||||
: ServerInstallationObjectTemplate(filename)
|
||||
: ServerInstallationObjectTemplate(filename)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerHarvesterInstallationObjectTemplate::ServerHarvesterInstallationObjectTemplate
|
||||
} // ServerHarvesterInstallationObjectTemplate::ServerHarvesterInstallationObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
ServerHarvesterInstallationObjectTemplate::~ServerHarvesterInstallationObjectTemplate()
|
||||
{
|
||||
ServerHarvesterInstallationObjectTemplate::~ServerHarvesterInstallationObjectTemplate() {
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // ServerHarvesterInstallationObjectTemplate::~ServerHarvesterInstallationObjectTemplate
|
||||
} // ServerHarvesterInstallationObjectTemplate::~ServerHarvesterInstallationObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void ServerHarvesterInstallationObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(ServerHarvesterInstallationObjectTemplate_tag, create);
|
||||
} // ServerHarvesterInstallationObjectTemplate::registerMe
|
||||
void ServerHarvesterInstallationObjectTemplate::registerMe(void) {
|
||||
ObjectTemplateList::registerTemplate(ServerHarvesterInstallationObjectTemplate_tag, create);
|
||||
} // ServerHarvesterInstallationObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a ServerHarvesterInstallationObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * ServerHarvesterInstallationObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new ServerHarvesterInstallationObjectTemplate(filename);
|
||||
} // ServerHarvesterInstallationObjectTemplate::create
|
||||
ObjectTemplate *ServerHarvesterInstallationObjectTemplate::create(const std::string &filename) {
|
||||
return new ServerHarvesterInstallationObjectTemplate(filename);
|
||||
} // ServerHarvesterInstallationObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag ServerHarvesterInstallationObjectTemplate::getId(void) const
|
||||
{
|
||||
return ServerHarvesterInstallationObjectTemplate_tag;
|
||||
} // ServerHarvesterInstallationObjectTemplate::getId
|
||||
Tag ServerHarvesterInstallationObjectTemplate::getId(void) const {
|
||||
return ServerHarvesterInstallationObjectTemplate_tag;
|
||||
} // ServerHarvesterInstallationObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const {
|
||||
return m_templateVersion;
|
||||
} // ServerHarvesterInstallationObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
@@ -83,149 +79,132 @@ Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerHarvesterInstallationObjectTemplate * base = dynamic_cast<const ServerHarvesterInstallationObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
Tag ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion(void) const {
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerHarvesterInstallationObjectTemplate *base = dynamic_cast<const ServerHarvesterInstallationObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "maxExtractionRate") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maxExtractionRate;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxExtractionRate\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "currentExtractionRate") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_currentExtractionRate;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"currentExtractionRate\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "maxHopperSize") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maxHopperSize;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxHopperSize\" as an array\n");
|
||||
}
|
||||
else
|
||||
return ServerInstallationObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerHarvesterInstallationObjectTemplate::getCompilerIntegerParam
|
||||
CompilerIntegerParam *
|
||||
ServerHarvesterInstallationObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index) {
|
||||
switch (runtimeCrc(name)) {
|
||||
case constcrc("maxExtractionRate"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maxExtractionRate;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxExtractionRate\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("currentExtractionRate"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_currentExtractionRate;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"currentExtractionRate\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("maxHopperSize"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maxHopperSize;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxHopperSize\" as an array\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ServerInstallationObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
break;
|
||||
}
|
||||
return nullptr;
|
||||
} //ServerHarvesterInstallationObjectTemplate::getCompilerIntegerParam
|
||||
|
||||
FloatParam * ServerHarvesterInstallationObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerInstallationObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getFloatParam
|
||||
FloatParam *ServerHarvesterInstallationObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerInstallationObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getFloatParam
|
||||
|
||||
BoolParam * ServerHarvesterInstallationObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerInstallationObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getBoolParam
|
||||
BoolParam *ServerHarvesterInstallationObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerInstallationObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getBoolParam
|
||||
|
||||
StringParam * ServerHarvesterInstallationObjectTemplate::getStringParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "masterClassName") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_masterClassName;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"masterClassName\" as an array\n");
|
||||
}
|
||||
else
|
||||
return ServerInstallationObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerHarvesterInstallationObjectTemplate::getStringParam
|
||||
StringParam *ServerHarvesterInstallationObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) {
|
||||
if (strcmp(name, "masterClassName") == 0) {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_masterClassName;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"masterClassName\" as an array\n");
|
||||
} else
|
||||
return ServerInstallationObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerHarvesterInstallationObjectTemplate::getStringParam
|
||||
|
||||
StringIdParam * ServerHarvesterInstallationObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerInstallationObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getStringIdParam
|
||||
StringIdParam *
|
||||
ServerHarvesterInstallationObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerInstallationObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getStringIdParam
|
||||
|
||||
VectorParam * ServerHarvesterInstallationObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerInstallationObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getVectorParam
|
||||
VectorParam *ServerHarvesterInstallationObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerInstallationObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getVectorParam
|
||||
|
||||
DynamicVariableParam * ServerHarvesterInstallationObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerInstallationObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getDynamicVariableParam
|
||||
DynamicVariableParam *
|
||||
ServerHarvesterInstallationObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerInstallationObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getDynamicVariableParam
|
||||
|
||||
StructParamOT * ServerHarvesterInstallationObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerInstallationObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getStructParamOT
|
||||
StructParamOT *
|
||||
ServerHarvesterInstallationObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) {
|
||||
return ServerInstallationObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getStructParamOT
|
||||
|
||||
TriggerVolumeParam * ServerHarvesterInstallationObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerInstallationObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getTriggerVolumeParam
|
||||
TriggerVolumeParam *
|
||||
ServerHarvesterInstallationObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerInstallationObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //ServerHarvesterInstallationObjectTemplate::getTriggerVolumeParam
|
||||
|
||||
void ServerHarvesterInstallationObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name)
|
||||
{
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerInstallationObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerHarvesterInstallationObjectTemplate::initStructParamOT
|
||||
void ServerHarvesterInstallationObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) {
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerInstallationObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerHarvesterInstallationObjectTemplate::initStructParamOT
|
||||
|
||||
void ServerHarvesterInstallationObjectTemplate::setAsEmptyList(const char *name)
|
||||
{
|
||||
ServerInstallationObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerHarvesterInstallationObjectTemplate::setAsEmptyList
|
||||
void ServerHarvesterInstallationObjectTemplate::setAsEmptyList(const char *name) {
|
||||
ServerInstallationObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerHarvesterInstallationObjectTemplate::setAsEmptyList
|
||||
|
||||
void ServerHarvesterInstallationObjectTemplate::setAppend(const char *name)
|
||||
{
|
||||
ServerInstallationObjectTemplate::setAppend(name);
|
||||
} // ServerHarvesterInstallationObjectTemplate::setAppend
|
||||
void ServerHarvesterInstallationObjectTemplate::setAppend(const char *name) {
|
||||
ServerInstallationObjectTemplate::setAppend(name);
|
||||
} // ServerHarvesterInstallationObjectTemplate::setAppend
|
||||
|
||||
bool ServerHarvesterInstallationObjectTemplate::isAppend(const char *name) const
|
||||
{
|
||||
return ServerInstallationObjectTemplate::isAppend(name);
|
||||
} // ServerHarvesterInstallationObjectTemplate::isAppend
|
||||
bool ServerHarvesterInstallationObjectTemplate::isAppend(const char *name) const {
|
||||
return ServerInstallationObjectTemplate::isAppend(name);
|
||||
} // ServerHarvesterInstallationObjectTemplate::isAppend
|
||||
|
||||
|
||||
int ServerHarvesterInstallationObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
return ServerInstallationObjectTemplate::getListLength(name);
|
||||
} // ServerHarvesterInstallationObjectTemplate::getListLength
|
||||
int ServerHarvesterInstallationObjectTemplate::getListLength(const char *name) const {
|
||||
return ServerInstallationObjectTemplate::getListLength(name);
|
||||
} // ServerHarvesterInstallationObjectTemplate::getListLength
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
@@ -233,70 +212,64 @@ int ServerHarvesterInstallationObjectTemplate::getListLength(const char *name) c
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void ServerHarvesterInstallationObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
void ServerHarvesterInstallationObjectTemplate::load(Iff &file) {
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerHarvesterInstallationObjectTemplate_tag)
|
||||
{
|
||||
ServerInstallationObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
if (file.getCurrentName() != ServerHarvesterInstallationObjectTemplate_tag) {
|
||||
ServerInstallationObjectTemplate::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();
|
||||
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.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i)
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "maxExtractionRate") == 0)
|
||||
m_maxExtractionRate.loadFromIff(file);
|
||||
else if (strcmp(paramName, "currentExtractionRate") == 0)
|
||||
m_currentExtractionRate.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxHopperSize") == 0)
|
||||
m_maxHopperSize.loadFromIff(file);
|
||||
else if (strcmp(paramName, "masterClassName") == 0)
|
||||
m_masterClassName.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i) {
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "maxExtractionRate") == 0)
|
||||
m_maxExtractionRate.loadFromIff(file);
|
||||
else if (strcmp(paramName, "currentExtractionRate") == 0)
|
||||
m_currentExtractionRate.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxHopperSize") == 0)
|
||||
m_maxHopperSize.loadFromIff(file);
|
||||
else if (strcmp(paramName, "masterClassName") == 0)
|
||||
m_masterClassName.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
file.exitForm();
|
||||
ServerInstallationObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerHarvesterInstallationObjectTemplate::load
|
||||
file.exitForm();
|
||||
ServerInstallationObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerHarvesterInstallationObjectTemplate::load
|
||||
|
||||
/**
|
||||
* Saves the template data to an iff file.
|
||||
@@ -304,59 +277,57 @@ char paramName[MAX_NAME_SIZE];
|
||||
* @param file file to save to
|
||||
* @param location file type (client or server)
|
||||
*/
|
||||
void ServerHarvesterInstallationObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
void ServerHarvesterInstallationObjectTemplate::save(Iff &file) {
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerHarvesterInstallationObjectTemplate_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();
|
||||
file.insertForm(ServerHarvesterInstallationObjectTemplate_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;
|
||||
int paramCount = 0;
|
||||
|
||||
// save maxExtractionRate
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxExtractionRate");
|
||||
m_maxExtractionRate.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save currentExtractionRate
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("currentExtractionRate");
|
||||
m_currentExtractionRate.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxHopperSize
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxHopperSize");
|
||||
m_maxHopperSize.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save masterClassName
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("masterClassName");
|
||||
m_masterClassName.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxExtractionRate
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxExtractionRate");
|
||||
m_maxExtractionRate.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save currentExtractionRate
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("currentExtractionRate");
|
||||
m_currentExtractionRate.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxHopperSize
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxHopperSize");
|
||||
m_maxHopperSize.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save masterClassName
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("masterClassName");
|
||||
m_masterClassName.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
|
||||
file.exitForm(true);
|
||||
ServerInstallationObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
UNREF(count);
|
||||
} // ServerHarvesterInstallationObjectTemplate::save
|
||||
file.exitForm(true);
|
||||
ServerInstallationObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
UNREF(count);
|
||||
} // ServerHarvesterInstallationObjectTemplate::save
|
||||
|
||||
//@END TFD
|
||||
|
||||
+523
-540
File diff suppressed because it is too large
Load Diff
+1522
-1611
File diff suppressed because it is too large
Load Diff
+257
-277
@@ -19,63 +19,59 @@
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
ServerResourceClassObjectTemplate::ServerResourceClassObjectTemplate(const std::string & filename)
|
||||
ServerResourceClassObjectTemplate::ServerResourceClassObjectTemplate(const std::string &filename)
|
||||
//@BEGIN TFD INIT
|
||||
: ServerUniverseObjectTemplate(filename)
|
||||
: ServerUniverseObjectTemplate(filename)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerResourceClassObjectTemplate::ServerResourceClassObjectTemplate
|
||||
} // ServerResourceClassObjectTemplate::ServerResourceClassObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
ServerResourceClassObjectTemplate::~ServerResourceClassObjectTemplate()
|
||||
{
|
||||
ServerResourceClassObjectTemplate::~ServerResourceClassObjectTemplate() {
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // ServerResourceClassObjectTemplate::~ServerResourceClassObjectTemplate
|
||||
} // ServerResourceClassObjectTemplate::~ServerResourceClassObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void ServerResourceClassObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(ServerResourceClassObjectTemplate_tag, create);
|
||||
} // ServerResourceClassObjectTemplate::registerMe
|
||||
void ServerResourceClassObjectTemplate::registerMe(void) {
|
||||
ObjectTemplateList::registerTemplate(ServerResourceClassObjectTemplate_tag, create);
|
||||
} // ServerResourceClassObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a ServerResourceClassObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * ServerResourceClassObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new ServerResourceClassObjectTemplate(filename);
|
||||
} // ServerResourceClassObjectTemplate::create
|
||||
ObjectTemplate *ServerResourceClassObjectTemplate::create(const std::string &filename) {
|
||||
return new ServerResourceClassObjectTemplate(filename);
|
||||
} // ServerResourceClassObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag ServerResourceClassObjectTemplate::getId(void) const
|
||||
{
|
||||
return ServerResourceClassObjectTemplate_tag;
|
||||
} // ServerResourceClassObjectTemplate::getId
|
||||
Tag ServerResourceClassObjectTemplate::getId(void) const {
|
||||
return ServerResourceClassObjectTemplate_tag;
|
||||
} // ServerResourceClassObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag ServerResourceClassObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
Tag ServerResourceClassObjectTemplate::getTemplateVersion(void) const {
|
||||
return m_templateVersion;
|
||||
} // ServerResourceClassObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
@@ -83,163 +79,147 @@ Tag ServerResourceClassObjectTemplate::getTemplateVersion(void) const
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag ServerResourceClassObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerResourceClassObjectTemplate * base = dynamic_cast<const ServerResourceClassObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
Tag ServerResourceClassObjectTemplate::getHighestTemplateVersion(void) const {
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerResourceClassObjectTemplate *base = dynamic_cast<const ServerResourceClassObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerResourceClassObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "numTypes") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != NULL)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
}
|
||||
return &m_numTypes;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"numTypes\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "minTypes") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != NULL)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
}
|
||||
return &m_minTypes;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"minTypes\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "maxTypes") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != NULL)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
}
|
||||
return &m_maxTypes;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxTypes\" as an array\n");
|
||||
}
|
||||
else
|
||||
return ServerUniverseObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
} //ServerResourceClassObjectTemplate::getCompilerIntegerParam
|
||||
CompilerIntegerParam *
|
||||
ServerResourceClassObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index) {
|
||||
switch (runtimeCrc(name)) {
|
||||
case constcrc("numTypes"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != NULL)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
}
|
||||
return &m_numTypes;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"numTypes\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("minTypes"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != NULL)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
}
|
||||
return &m_minTypes;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"minTypes\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("maxTypes"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != NULL)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
}
|
||||
return &m_maxTypes;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxTypes\" as an array\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ServerUniverseObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
} //ServerResourceClassObjectTemplate::getCompilerIntegerParam
|
||||
|
||||
FloatParam * ServerResourceClassObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getFloatParam
|
||||
FloatParam *ServerResourceClassObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerUniverseObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getFloatParam
|
||||
|
||||
BoolParam * ServerResourceClassObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getBoolParam
|
||||
BoolParam *ServerResourceClassObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerUniverseObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getBoolParam
|
||||
|
||||
StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "resourceClassName") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != NULL)
|
||||
return getBaseTemplate()->getStringParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
}
|
||||
return &m_resourceClassName;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"resourceClassName\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "parentClass") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != NULL)
|
||||
return getBaseTemplate()->getStringParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
}
|
||||
return &m_parentClass;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"parentClass\" as an array\n");
|
||||
}
|
||||
else
|
||||
return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
} //ServerResourceClassObjectTemplate::getStringParam
|
||||
StringParam *ServerResourceClassObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) {
|
||||
switch (runtimeCrc(name)) {
|
||||
case constcrc("resourceClassName"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != NULL)
|
||||
return getBaseTemplate()->getStringParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
}
|
||||
return &m_resourceClassName;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"resourceClassName\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("parentClass"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != NULL)
|
||||
return getBaseTemplate()->getStringParam(name, deepCheck, index);
|
||||
return NULL;
|
||||
}
|
||||
return &m_parentClass;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"parentClass\" as an array\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
} //ServerResourceClassObjectTemplate::getStringParam
|
||||
|
||||
StringIdParam * ServerResourceClassObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getStringIdParam
|
||||
StringIdParam *ServerResourceClassObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerUniverseObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getStringIdParam
|
||||
|
||||
VectorParam * ServerResourceClassObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getVectorParam
|
||||
VectorParam *ServerResourceClassObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerUniverseObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getVectorParam
|
||||
|
||||
DynamicVariableParam * ServerResourceClassObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getDynamicVariableParam
|
||||
DynamicVariableParam *
|
||||
ServerResourceClassObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerUniverseObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getDynamicVariableParam
|
||||
|
||||
StructParamOT * ServerResourceClassObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getStructParamOT
|
||||
StructParamOT *ServerResourceClassObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) {
|
||||
return ServerUniverseObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getStructParamOT
|
||||
|
||||
TriggerVolumeParam * ServerResourceClassObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getTriggerVolumeParam
|
||||
TriggerVolumeParam *
|
||||
ServerResourceClassObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerUniverseObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //ServerResourceClassObjectTemplate::getTriggerVolumeParam
|
||||
|
||||
void ServerResourceClassObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name)
|
||||
{
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerUniverseObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerResourceClassObjectTemplate::initStructParamOT
|
||||
void ServerResourceClassObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) {
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerUniverseObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerResourceClassObjectTemplate::initStructParamOT
|
||||
|
||||
void ServerResourceClassObjectTemplate::setAsEmptyList(const char *name)
|
||||
{
|
||||
ServerUniverseObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerResourceClassObjectTemplate::setAsEmptyList
|
||||
void ServerResourceClassObjectTemplate::setAsEmptyList(const char *name) {
|
||||
ServerUniverseObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerResourceClassObjectTemplate::setAsEmptyList
|
||||
|
||||
void ServerResourceClassObjectTemplate::setAppend(const char *name)
|
||||
{
|
||||
ServerUniverseObjectTemplate::setAppend(name);
|
||||
} // ServerResourceClassObjectTemplate::setAppend
|
||||
void ServerResourceClassObjectTemplate::setAppend(const char *name) {
|
||||
ServerUniverseObjectTemplate::setAppend(name);
|
||||
} // ServerResourceClassObjectTemplate::setAppend
|
||||
|
||||
bool ServerResourceClassObjectTemplate::isAppend(const char *name) const
|
||||
{
|
||||
return ServerUniverseObjectTemplate::isAppend(name);
|
||||
} // ServerResourceClassObjectTemplate::isAppend
|
||||
bool ServerResourceClassObjectTemplate::isAppend(const char *name) const {
|
||||
return ServerUniverseObjectTemplate::isAppend(name);
|
||||
} // ServerResourceClassObjectTemplate::isAppend
|
||||
|
||||
|
||||
int ServerResourceClassObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
return ServerUniverseObjectTemplate::getListLength(name);
|
||||
} // ServerResourceClassObjectTemplate::getListLength
|
||||
int ServerResourceClassObjectTemplate::getListLength(const char *name) const {
|
||||
return ServerUniverseObjectTemplate::getListLength(name);
|
||||
} // ServerResourceClassObjectTemplate::getListLength
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
@@ -247,72 +227,74 @@ int ServerResourceClassObjectTemplate::getListLength(const char *name) const
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void ServerResourceClassObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
void ServerResourceClassObjectTemplate::load(Iff &file) {
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerResourceClassObjectTemplate_tag)
|
||||
{
|
||||
ServerUniverseObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
if (file.getCurrentName() != ServerResourceClassObjectTemplate_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 == NULL, ("was unable to load base template %s", baseFilename.c_str()));
|
||||
if (m_baseData == base && base != NULL)
|
||||
base->releaseReference();
|
||||
else
|
||||
{
|
||||
if (m_baseData != NULL)
|
||||
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();
|
||||
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 == NULL, ("was unable to load base template %s", baseFilename.c_str()));
|
||||
if (m_baseData == base && base != NULL)
|
||||
base->releaseReference();
|
||||
else {
|
||||
if (m_baseData != NULL)
|
||||
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.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i)
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "resourceClassName") == 0)
|
||||
m_resourceClassName.loadFromIff(file);
|
||||
else if (strcmp(paramName, "numTypes") == 0)
|
||||
m_numTypes.loadFromIff(file);
|
||||
else if (strcmp(paramName, "minTypes") == 0)
|
||||
m_minTypes.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxTypes") == 0)
|
||||
m_maxTypes.loadFromIff(file);
|
||||
else if (strcmp(paramName, "parentClass") == 0)
|
||||
m_parentClass.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i) {
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
|
||||
file.exitForm();
|
||||
ServerUniverseObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerResourceClassObjectTemplate::load
|
||||
switch (runtimeCrc(paramName)) {
|
||||
case constcrc("resourceClassName"):
|
||||
m_resourceClassName.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("numTypes"):
|
||||
m_numTypes.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("minTypes") :
|
||||
m_minTypes.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxTypes") :
|
||||
m_maxTypes.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("parentClass") :
|
||||
m_parentClass.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
file.exitForm();
|
||||
ServerUniverseObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerResourceClassObjectTemplate::load
|
||||
|
||||
/**
|
||||
* Saves the template data to an iff file.
|
||||
@@ -320,65 +302,63 @@ char paramName[MAX_NAME_SIZE];
|
||||
* @param file file to save to
|
||||
* @param location file type (client or server)
|
||||
*/
|
||||
void ServerResourceClassObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
void ServerResourceClassObjectTemplate::save(Iff &file) {
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerResourceClassObjectTemplate_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();
|
||||
file.insertForm(ServerResourceClassObjectTemplate_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;
|
||||
int paramCount = 0;
|
||||
|
||||
// save resourceClassName
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("resourceClassName");
|
||||
m_resourceClassName.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save numTypes
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("numTypes");
|
||||
m_numTypes.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save minTypes
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("minTypes");
|
||||
m_minTypes.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxTypes
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxTypes");
|
||||
m_maxTypes.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save parentClass
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("parentClass");
|
||||
m_parentClass.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save resourceClassName
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("resourceClassName");
|
||||
m_resourceClassName.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save numTypes
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("numTypes");
|
||||
m_numTypes.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save minTypes
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("minTypes");
|
||||
m_minTypes.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxTypes
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxTypes");
|
||||
m_maxTypes.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save parentClass
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("parentClass");
|
||||
m_parentClass.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
// 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);
|
||||
} // ServerResourceClassObjectTemplate::save
|
||||
file.exitForm(true);
|
||||
ServerUniverseObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
UNREF(count);
|
||||
} // ServerResourceClassObjectTemplate::save
|
||||
|
||||
//@END TFD
|
||||
|
||||
+357
-398
@@ -19,74 +19,67 @@
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
ServerTangibleObjectTemplate::ServerTangibleObjectTemplate(const std::string & filename)
|
||||
ServerTangibleObjectTemplate::ServerTangibleObjectTemplate(const std::string &filename)
|
||||
//@BEGIN TFD INIT
|
||||
: ServerObjectTemplate(filename)
|
||||
,m_triggerVolumesLoaded(false)
|
||||
,m_triggerVolumesAppend(false)
|
||||
: ServerObjectTemplate(filename), m_triggerVolumesLoaded(false), m_triggerVolumesAppend(false)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerTangibleObjectTemplate::ServerTangibleObjectTemplate
|
||||
} // ServerTangibleObjectTemplate::ServerTangibleObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate()
|
||||
{
|
||||
ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() {
|
||||
//@BEGIN TFD CLEANUP
|
||||
{
|
||||
std::vector<TriggerVolumeParam *>::iterator iter;
|
||||
for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_triggerVolumes.clear();
|
||||
}
|
||||
{
|
||||
std::vector<TriggerVolumeParam *>::iterator iter;
|
||||
for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) {
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_triggerVolumes.clear();
|
||||
}
|
||||
//@END TFD CLEANUP
|
||||
} // ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate
|
||||
} // ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void ServerTangibleObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(ServerTangibleObjectTemplate_tag, create);
|
||||
} // ServerTangibleObjectTemplate::registerMe
|
||||
void ServerTangibleObjectTemplate::registerMe(void) {
|
||||
ObjectTemplateList::registerTemplate(ServerTangibleObjectTemplate_tag, create);
|
||||
} // ServerTangibleObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a ServerTangibleObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * ServerTangibleObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new ServerTangibleObjectTemplate(filename);
|
||||
} // ServerTangibleObjectTemplate::create
|
||||
ObjectTemplate *ServerTangibleObjectTemplate::create(const std::string &filename) {
|
||||
return new ServerTangibleObjectTemplate(filename);
|
||||
} // ServerTangibleObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag ServerTangibleObjectTemplate::getId(void) const
|
||||
{
|
||||
return ServerTangibleObjectTemplate_tag;
|
||||
} // ServerTangibleObjectTemplate::getId
|
||||
Tag ServerTangibleObjectTemplate::getId(void) const {
|
||||
return ServerTangibleObjectTemplate_tag;
|
||||
} // ServerTangibleObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag ServerTangibleObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
Tag ServerTangibleObjectTemplate::getTemplateVersion(void) const {
|
||||
return m_templateVersion;
|
||||
} // ServerTangibleObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
@@ -94,224 +87,189 @@ Tag ServerTangibleObjectTemplate::getTemplateVersion(void) const
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag ServerTangibleObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerTangibleObjectTemplate * base = dynamic_cast<const ServerTangibleObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
Tag ServerTangibleObjectTemplate::getHighestTemplateVersion(void) const {
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerTangibleObjectTemplate *base = dynamic_cast<const ServerTangibleObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerTangibleObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "combatSkeleton") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_combatSkeleton;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"combatSkeleton\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "maxHitPoints") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maxHitPoints;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxHitPoints\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "interestRadius") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_interestRadius;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"interestRadius\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "count") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_count;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"count\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "condition") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_condition;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"condition\" as an array\n");
|
||||
}
|
||||
else
|
||||
return ServerObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerTangibleObjectTemplate::getCompilerIntegerParam
|
||||
CompilerIntegerParam *
|
||||
ServerTangibleObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index) {
|
||||
switch (runtimeCrc(name)) {
|
||||
case constcrc("combatSkeleton"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_combatSkeleton;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"combatSkeleton\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("maxHitPoints"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maxHitPoints;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxHitPoints\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("interestRadius"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_interestRadius;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"interestRadius\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("count"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_count;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"count\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("condition"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_condition;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"condition\" as an array\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ServerObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
break;
|
||||
}
|
||||
return nullptr;
|
||||
} //ServerTangibleObjectTemplate::getCompilerIntegerParam
|
||||
|
||||
FloatParam * ServerTangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
} //ServerTangibleObjectTemplate::getFloatParam
|
||||
FloatParam *ServerTangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
} //ServerTangibleObjectTemplate::getFloatParam
|
||||
|
||||
BoolParam * ServerTangibleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "wantSawAttackTriggers") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getBoolParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_wantSawAttackTriggers;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"wantSawAttackTriggers\" as an array\n");
|
||||
}
|
||||
else
|
||||
return ServerObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerTangibleObjectTemplate::getBoolParam
|
||||
BoolParam *ServerTangibleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) {
|
||||
if (strcmp(name, "wantSawAttackTriggers") == 0) {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getBoolParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_wantSawAttackTriggers;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"wantSawAttackTriggers\" as an array\n");
|
||||
} else
|
||||
return ServerObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerTangibleObjectTemplate::getBoolParam
|
||||
|
||||
StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "armor") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_armor;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"armor\" as an array\n");
|
||||
}
|
||||
else
|
||||
return ServerObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerTangibleObjectTemplate::getStringParam
|
||||
StringParam *ServerTangibleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) {
|
||||
if (strcmp(name, "armor") == 0) {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_armor;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"armor\" as an array\n");
|
||||
} else
|
||||
return ServerObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerTangibleObjectTemplate::getStringParam
|
||||
|
||||
StringIdParam * ServerTangibleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerTangibleObjectTemplate::getStringIdParam
|
||||
StringIdParam *ServerTangibleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerTangibleObjectTemplate::getStringIdParam
|
||||
|
||||
VectorParam * ServerTangibleObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerTangibleObjectTemplate::getVectorParam
|
||||
VectorParam *ServerTangibleObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerTangibleObjectTemplate::getVectorParam
|
||||
|
||||
DynamicVariableParam * ServerTangibleObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerTangibleObjectTemplate::getDynamicVariableParam
|
||||
DynamicVariableParam *
|
||||
ServerTangibleObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerTangibleObjectTemplate::getDynamicVariableParam
|
||||
|
||||
StructParamOT * ServerTangibleObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerTangibleObjectTemplate::getStructParamOT
|
||||
StructParamOT *ServerTangibleObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) {
|
||||
return ServerObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerTangibleObjectTemplate::getStructParamOT
|
||||
|
||||
TriggerVolumeParam * ServerTangibleObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "triggerVolumes") == 0)
|
||||
{
|
||||
if (index >= 0 && index < static_cast<int>(m_triggerVolumes.size()))
|
||||
return m_triggerVolumes[index];
|
||||
if (index == static_cast<int>(m_triggerVolumes.size()))
|
||||
{
|
||||
TriggerVolumeParam *temp = new TriggerVolumeParam();
|
||||
m_triggerVolumes.push_back(temp);
|
||||
return temp;
|
||||
}
|
||||
fprintf(stderr, "index for parameter \"triggerVolumes\" out of bounds\n");
|
||||
}
|
||||
else
|
||||
return ServerObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerTangibleObjectTemplate::getTriggerVolumeParam
|
||||
TriggerVolumeParam *ServerTangibleObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) {
|
||||
if (strcmp(name, "triggerVolumes") == 0) {
|
||||
if (index >= 0 && index < static_cast<int>(m_triggerVolumes.size()))
|
||||
return m_triggerVolumes[index];
|
||||
if (index == static_cast<int>(m_triggerVolumes.size())) {
|
||||
TriggerVolumeParam *temp = new TriggerVolumeParam();
|
||||
m_triggerVolumes.push_back(temp);
|
||||
return temp;
|
||||
}
|
||||
fprintf(stderr, "index for parameter \"triggerVolumes\" out of bounds\n");
|
||||
} else
|
||||
return ServerObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerTangibleObjectTemplate::getTriggerVolumeParam
|
||||
|
||||
void ServerTangibleObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name)
|
||||
{
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerTangibleObjectTemplate::initStructParamOT
|
||||
void ServerTangibleObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) {
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerTangibleObjectTemplate::initStructParamOT
|
||||
|
||||
void ServerTangibleObjectTemplate::setAsEmptyList(const char *name)
|
||||
{
|
||||
if (strcmp(name, "triggerVolumes") == 0)
|
||||
{
|
||||
m_triggerVolumes.clear();
|
||||
m_triggerVolumesLoaded = true;
|
||||
}
|
||||
else
|
||||
ServerObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerTangibleObjectTemplate::setAsEmptyList
|
||||
void ServerTangibleObjectTemplate::setAsEmptyList(const char *name) {
|
||||
if (strcmp(name, "triggerVolumes") == 0) {
|
||||
m_triggerVolumes.clear();
|
||||
m_triggerVolumesLoaded = true;
|
||||
} else
|
||||
ServerObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerTangibleObjectTemplate::setAsEmptyList
|
||||
|
||||
void ServerTangibleObjectTemplate::setAppend(const char *name)
|
||||
{
|
||||
if (strcmp(name, "triggerVolumes") == 0)
|
||||
m_triggerVolumesAppend = true;
|
||||
else
|
||||
ServerObjectTemplate::setAppend(name);
|
||||
} // ServerTangibleObjectTemplate::setAppend
|
||||
void ServerTangibleObjectTemplate::setAppend(const char *name) {
|
||||
if (strcmp(name, "triggerVolumes") == 0)
|
||||
m_triggerVolumesAppend = true;
|
||||
else
|
||||
ServerObjectTemplate::setAppend(name);
|
||||
} // ServerTangibleObjectTemplate::setAppend
|
||||
|
||||
bool ServerTangibleObjectTemplate::isAppend(const char *name) const
|
||||
{
|
||||
if (strcmp(name, "triggerVolumes") == 0)
|
||||
return m_triggerVolumesAppend;
|
||||
else
|
||||
return ServerObjectTemplate::isAppend(name);
|
||||
} // ServerTangibleObjectTemplate::isAppend
|
||||
bool ServerTangibleObjectTemplate::isAppend(const char *name) const {
|
||||
if (strcmp(name, "triggerVolumes") == 0)
|
||||
return m_triggerVolumesAppend;
|
||||
else
|
||||
return ServerObjectTemplate::isAppend(name);
|
||||
} // ServerTangibleObjectTemplate::isAppend
|
||||
|
||||
|
||||
int ServerTangibleObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
if (strcmp(name, "triggerVolumes") == 0)
|
||||
{
|
||||
return m_triggerVolumes.size();
|
||||
}
|
||||
else
|
||||
return ServerObjectTemplate::getListLength(name);
|
||||
} // ServerTangibleObjectTemplate::getListLength
|
||||
int ServerTangibleObjectTemplate::getListLength(const char *name) const {
|
||||
if (strcmp(name, "triggerVolumes") == 0) {
|
||||
return m_triggerVolumes.size();
|
||||
} else
|
||||
return ServerObjectTemplate::getListLength(name);
|
||||
} // ServerTangibleObjectTemplate::getListLength
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
@@ -319,95 +277,97 @@ int ServerTangibleObjectTemplate::getListLength(const char *name) const
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void ServerTangibleObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
void ServerTangibleObjectTemplate::load(Iff &file) {
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerTangibleObjectTemplate_tag)
|
||||
{
|
||||
ServerObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
if (file.getCurrentName() != ServerTangibleObjectTemplate_tag) {
|
||||
ServerObjectTemplate::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,4))
|
||||
{
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
}
|
||||
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, 4)) {
|
||||
if (DataLint::isEnabled())
|
||||
DEBUG_WARNING(true, ("template %s version out of date", file.getFileName()));
|
||||
}
|
||||
|
||||
file.enterForm();
|
||||
file.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i)
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "triggerVolumes") == 0)
|
||||
{
|
||||
std::vector<TriggerVolumeParam *>::iterator iter;
|
||||
for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_triggerVolumes.clear();
|
||||
m_triggerVolumesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j)
|
||||
{
|
||||
TriggerVolumeParam * newData = new TriggerVolumeParam;
|
||||
newData->loadFromIff(file);
|
||||
m_triggerVolumes.push_back(newData);
|
||||
}
|
||||
m_triggerVolumesLoaded = true;
|
||||
}
|
||||
else if (strcmp(paramName, "combatSkeleton") == 0)
|
||||
m_combatSkeleton.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxHitPoints") == 0)
|
||||
m_maxHitPoints.loadFromIff(file);
|
||||
else if (strcmp(paramName, "armor") == 0)
|
||||
m_armor.loadFromIff(file);
|
||||
else if (strcmp(paramName, "interestRadius") == 0)
|
||||
m_interestRadius.loadFromIff(file);
|
||||
else if (strcmp(paramName, "count") == 0)
|
||||
m_count.loadFromIff(file);
|
||||
else if (strcmp(paramName, "condition") == 0)
|
||||
m_condition.loadFromIff(file);
|
||||
else if (strcmp(paramName, "wantSawAttackTriggers") == 0)
|
||||
m_wantSawAttackTriggers.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i) {
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
|
||||
file.exitForm();
|
||||
ServerObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerTangibleObjectTemplate::load
|
||||
switch (runtimeCrc(paramName)) {
|
||||
case constcrc("triggerVolumes"): {
|
||||
std::vector<TriggerVolumeParam *>::iterator iter;
|
||||
for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) {
|
||||
delete *iter;
|
||||
*iter = nullptr;
|
||||
}
|
||||
m_triggerVolumes.clear();
|
||||
m_triggerVolumesAppend = file.read_bool8();
|
||||
int listCount = file.read_int32();
|
||||
for (int j = 0; j < listCount; ++j) {
|
||||
TriggerVolumeParam *newData = new TriggerVolumeParam;
|
||||
newData->loadFromIff(file);
|
||||
m_triggerVolumes.push_back(newData);
|
||||
}
|
||||
m_triggerVolumesLoaded = true;
|
||||
}
|
||||
break;
|
||||
case constcrc("combatSkeleton"):
|
||||
m_combatSkeleton.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxHitPoints"):
|
||||
m_maxHitPoints.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("armor"):
|
||||
m_armor.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("interestRadius"):
|
||||
m_interestRadius.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("count"):
|
||||
m_count.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("condition"):
|
||||
m_condition.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("wantSawAttackTriggers"):
|
||||
m_wantSawAttackTriggers.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
file.exitForm();
|
||||
ServerObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerTangibleObjectTemplate::load
|
||||
|
||||
/**
|
||||
* Saves the template data to an iff file.
|
||||
@@ -415,91 +375,90 @@ char paramName[MAX_NAME_SIZE];
|
||||
* @param file file to save to
|
||||
* @param location file type (client or server)
|
||||
*/
|
||||
void ServerTangibleObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
void ServerTangibleObjectTemplate::save(Iff &file) {
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerTangibleObjectTemplate_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,4));
|
||||
file.allowNonlinearFunctions();
|
||||
file.insertForm(ServerTangibleObjectTemplate_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, 4));
|
||||
file.allowNonlinearFunctions();
|
||||
|
||||
int paramCount = 0;
|
||||
int paramCount = 0;
|
||||
|
||||
if (!m_triggerVolumesLoaded)
|
||||
{
|
||||
// mark the list as empty and extending the base list
|
||||
m_triggerVolumesAppend = true;
|
||||
}
|
||||
// save triggerVolumes
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("triggerVolumes");
|
||||
file.insertChunkData(&m_triggerVolumesAppend, sizeof(bool));
|
||||
count = m_triggerVolumes.size();
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < count; ++i)
|
||||
m_triggerVolumes[i]->saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save combatSkeleton
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("combatSkeleton");
|
||||
m_combatSkeleton.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxHitPoints
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxHitPoints");
|
||||
m_maxHitPoints.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save armor
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("armor");
|
||||
m_armor.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save interestRadius
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("interestRadius");
|
||||
m_interestRadius.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save count
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("count");
|
||||
m_count.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save condition
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("condition");
|
||||
m_condition.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save wantSawAttackTriggers
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("wantSawAttackTriggers");
|
||||
m_wantSawAttackTriggers.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
if (!m_triggerVolumesLoaded) {
|
||||
// mark the list as empty and extending the base list
|
||||
m_triggerVolumesAppend = true;
|
||||
}
|
||||
// save triggerVolumes
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("triggerVolumes");
|
||||
file.insertChunkData(&m_triggerVolumesAppend, sizeof(bool));
|
||||
count = m_triggerVolumes.size();
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{
|
||||
for (int i = 0; i < count; ++i)
|
||||
m_triggerVolumes[i]->saveToIff(file);
|
||||
}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save combatSkeleton
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("combatSkeleton");
|
||||
m_combatSkeleton.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxHitPoints
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxHitPoints");
|
||||
m_maxHitPoints.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save armor
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("armor");
|
||||
m_armor.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save interestRadius
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("interestRadius");
|
||||
m_interestRadius.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save count
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("count");
|
||||
m_count.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save condition
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("condition");
|
||||
m_condition.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save wantSawAttackTriggers
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("wantSawAttackTriggers");
|
||||
m_wantSawAttackTriggers.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
|
||||
file.exitForm(true);
|
||||
ServerObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
} // ServerTangibleObjectTemplate::save
|
||||
file.exitForm(true);
|
||||
ServerObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
} // ServerTangibleObjectTemplate::save
|
||||
|
||||
//@END TFD
|
||||
|
||||
+3416
-3507
File diff suppressed because it is too large
Load Diff
+230
-255
@@ -19,63 +19,59 @@
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
ServerVehicleObjectTemplate::ServerVehicleObjectTemplate(const std::string & filename)
|
||||
ServerVehicleObjectTemplate::ServerVehicleObjectTemplate(const std::string &filename)
|
||||
//@BEGIN TFD INIT
|
||||
: ServerTangibleObjectTemplate(filename)
|
||||
: ServerTangibleObjectTemplate(filename)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // ServerVehicleObjectTemplate::ServerVehicleObjectTemplate
|
||||
} // ServerVehicleObjectTemplate::ServerVehicleObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
ServerVehicleObjectTemplate::~ServerVehicleObjectTemplate()
|
||||
{
|
||||
ServerVehicleObjectTemplate::~ServerVehicleObjectTemplate() {
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // ServerVehicleObjectTemplate::~ServerVehicleObjectTemplate
|
||||
} // ServerVehicleObjectTemplate::~ServerVehicleObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void ServerVehicleObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(ServerVehicleObjectTemplate_tag, create);
|
||||
} // ServerVehicleObjectTemplate::registerMe
|
||||
void ServerVehicleObjectTemplate::registerMe(void) {
|
||||
ObjectTemplateList::registerTemplate(ServerVehicleObjectTemplate_tag, create);
|
||||
} // ServerVehicleObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a ServerVehicleObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * ServerVehicleObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new ServerVehicleObjectTemplate(filename);
|
||||
} // ServerVehicleObjectTemplate::create
|
||||
ObjectTemplate *ServerVehicleObjectTemplate::create(const std::string &filename) {
|
||||
return new ServerVehicleObjectTemplate(filename);
|
||||
} // ServerVehicleObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag ServerVehicleObjectTemplate::getId(void) const
|
||||
{
|
||||
return ServerVehicleObjectTemplate_tag;
|
||||
} // ServerVehicleObjectTemplate::getId
|
||||
Tag ServerVehicleObjectTemplate::getId(void) const {
|
||||
return ServerVehicleObjectTemplate_tag;
|
||||
} // ServerVehicleObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag ServerVehicleObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
Tag ServerVehicleObjectTemplate::getTemplateVersion(void) const {
|
||||
return m_templateVersion;
|
||||
} // ServerVehicleObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
@@ -83,149 +79,129 @@ Tag ServerVehicleObjectTemplate::getTemplateVersion(void) const
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag ServerVehicleObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerVehicleObjectTemplate * base = dynamic_cast<const ServerVehicleObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
Tag ServerVehicleObjectTemplate::getHighestTemplateVersion(void) const {
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const ServerVehicleObjectTemplate *base = dynamic_cast<const ServerVehicleObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // ServerVehicleObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
CompilerIntegerParam * ServerVehicleObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getCompilerIntegerParam
|
||||
CompilerIntegerParam *
|
||||
ServerVehicleObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getCompilerIntegerParam
|
||||
|
||||
FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "currentFuel") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_currentFuel;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"currentFuel\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "maxFuel") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maxFuel;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxFuel\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "consumpsion") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_consumpsion;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"consumpsion\" as an array\n");
|
||||
}
|
||||
else
|
||||
return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerVehicleObjectTemplate::getFloatParam
|
||||
FloatParam *ServerVehicleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) {
|
||||
switch (runtimeCrc(name)) {
|
||||
case constcrc("currentFuel"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_currentFuel;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"currentFuel\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("maxFuel"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maxFuel;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxFuel\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("consumpsion"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_consumpsion;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"consumpsion\" as an array\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
break;
|
||||
}
|
||||
return nullptr;
|
||||
} //ServerVehicleObjectTemplate::getFloatParam
|
||||
|
||||
BoolParam * ServerVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getBoolParam
|
||||
BoolParam *ServerVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getBoolParam
|
||||
|
||||
StringParam * ServerVehicleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "fuelType") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_fuelType;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"fuelType\" as an array\n");
|
||||
}
|
||||
else
|
||||
return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerVehicleObjectTemplate::getStringParam
|
||||
StringParam *ServerVehicleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) {
|
||||
if (strcmp(name, "fuelType") == 0) {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_fuelType;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"fuelType\" as an array\n");
|
||||
} else
|
||||
return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //ServerVehicleObjectTemplate::getStringParam
|
||||
|
||||
StringIdParam * ServerVehicleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getStringIdParam
|
||||
StringIdParam *ServerVehicleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getStringIdParam
|
||||
|
||||
VectorParam * ServerVehicleObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getVectorParam
|
||||
VectorParam *ServerVehicleObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getVectorParam
|
||||
|
||||
DynamicVariableParam * ServerVehicleObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getDynamicVariableParam
|
||||
DynamicVariableParam *
|
||||
ServerVehicleObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getDynamicVariableParam
|
||||
|
||||
StructParamOT * ServerVehicleObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getStructParamOT
|
||||
StructParamOT *ServerVehicleObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getStructParamOT
|
||||
|
||||
TriggerVolumeParam * ServerVehicleObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getTriggerVolumeParam
|
||||
TriggerVolumeParam *ServerVehicleObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) {
|
||||
return ServerTangibleObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //ServerVehicleObjectTemplate::getTriggerVolumeParam
|
||||
|
||||
void ServerVehicleObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name)
|
||||
{
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerTangibleObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerVehicleObjectTemplate::initStructParamOT
|
||||
void ServerVehicleObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) {
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
ServerTangibleObjectTemplate::initStructParamOT(param, name);
|
||||
} // ServerVehicleObjectTemplate::initStructParamOT
|
||||
|
||||
void ServerVehicleObjectTemplate::setAsEmptyList(const char *name)
|
||||
{
|
||||
ServerTangibleObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerVehicleObjectTemplate::setAsEmptyList
|
||||
void ServerVehicleObjectTemplate::setAsEmptyList(const char *name) {
|
||||
ServerTangibleObjectTemplate::setAsEmptyList(name);
|
||||
} // ServerVehicleObjectTemplate::setAsEmptyList
|
||||
|
||||
void ServerVehicleObjectTemplate::setAppend(const char *name)
|
||||
{
|
||||
ServerTangibleObjectTemplate::setAppend(name);
|
||||
} // ServerVehicleObjectTemplate::setAppend
|
||||
void ServerVehicleObjectTemplate::setAppend(const char *name) {
|
||||
ServerTangibleObjectTemplate::setAppend(name);
|
||||
} // ServerVehicleObjectTemplate::setAppend
|
||||
|
||||
bool ServerVehicleObjectTemplate::isAppend(const char *name) const
|
||||
{
|
||||
return ServerTangibleObjectTemplate::isAppend(name);
|
||||
} // ServerVehicleObjectTemplate::isAppend
|
||||
bool ServerVehicleObjectTemplate::isAppend(const char *name) const {
|
||||
return ServerTangibleObjectTemplate::isAppend(name);
|
||||
} // ServerVehicleObjectTemplate::isAppend
|
||||
|
||||
|
||||
int ServerVehicleObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
return ServerTangibleObjectTemplate::getListLength(name);
|
||||
} // ServerVehicleObjectTemplate::getListLength
|
||||
int ServerVehicleObjectTemplate::getListLength(const char *name) const {
|
||||
return ServerTangibleObjectTemplate::getListLength(name);
|
||||
} // ServerVehicleObjectTemplate::getListLength
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
@@ -233,70 +209,71 @@ int ServerVehicleObjectTemplate::getListLength(const char *name) const
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void ServerVehicleObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
void ServerVehicleObjectTemplate::load(Iff &file) {
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != ServerVehicleObjectTemplate_tag)
|
||||
{
|
||||
ServerTangibleObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
if (file.getCurrentName() != ServerVehicleObjectTemplate_tag) {
|
||||
ServerTangibleObjectTemplate::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();
|
||||
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.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i)
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "fuelType") == 0)
|
||||
m_fuelType.loadFromIff(file);
|
||||
else if (strcmp(paramName, "currentFuel") == 0)
|
||||
m_currentFuel.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxFuel") == 0)
|
||||
m_maxFuel.loadFromIff(file);
|
||||
else if (strcmp(paramName, "consumpsion") == 0)
|
||||
m_consumpsion.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i) {
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
|
||||
file.exitForm();
|
||||
ServerTangibleObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerVehicleObjectTemplate::load
|
||||
switch (runtimeCrc(paramName)) {
|
||||
case constcrc("fuelType"):
|
||||
m_fuelType.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("currentFuel"):
|
||||
m_currentFuel.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxFuel"):
|
||||
m_maxFuel.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("consumpsion"):
|
||||
m_consumpsion.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
file.exitForm();
|
||||
ServerTangibleObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // ServerVehicleObjectTemplate::load
|
||||
|
||||
/**
|
||||
* Saves the template data to an iff file.
|
||||
@@ -304,59 +281,57 @@ char paramName[MAX_NAME_SIZE];
|
||||
* @param file file to save to
|
||||
* @param location file type (client or server)
|
||||
*/
|
||||
void ServerVehicleObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
void ServerVehicleObjectTemplate::save(Iff &file) {
|
||||
int count;
|
||||
|
||||
file.insertForm(ServerVehicleObjectTemplate_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();
|
||||
file.insertForm(ServerVehicleObjectTemplate_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;
|
||||
int paramCount = 0;
|
||||
|
||||
// save fuelType
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("fuelType");
|
||||
m_fuelType.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save currentFuel
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("currentFuel");
|
||||
m_currentFuel.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxFuel
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxFuel");
|
||||
m_maxFuel.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save consumpsion
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("consumpsion");
|
||||
m_consumpsion.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save fuelType
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("fuelType");
|
||||
m_fuelType.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save currentFuel
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("currentFuel");
|
||||
m_currentFuel.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxFuel
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxFuel");
|
||||
m_maxFuel.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save consumpsion
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("consumpsion");
|
||||
m_consumpsion.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
|
||||
file.exitForm(true);
|
||||
ServerTangibleObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
UNREF(count);
|
||||
} // ServerVehicleObjectTemplate::save
|
||||
file.exitForm(true);
|
||||
ServerTangibleObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
UNREF(count);
|
||||
} // ServerVehicleObjectTemplate::save
|
||||
|
||||
//@END TFD
|
||||
|
||||
+464
-497
File diff suppressed because it is too large
Load Diff
+706
-731
File diff suppressed because it is too large
Load Diff
+639
-669
File diff suppressed because it is too large
Load Diff
+626
-658
File diff suppressed because it is too large
Load Diff
+16
-9
@@ -19,7 +19,7 @@
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
@@ -281,14 +281,21 @@ char paramName[MAX_NAME_SIZE];
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "cockpitFilename") == 0)
|
||||
m_cockpitFilename.loadFromIff(file);
|
||||
else if (strcmp(paramName, "hasWings") == 0)
|
||||
m_hasWings.loadFromIff(file);
|
||||
else if (strcmp(paramName, "playerControlled") == 0)
|
||||
m_playerControlled.loadFromIff(file);
|
||||
else if (strcmp(paramName, "interiorLayoutFileName") == 0)
|
||||
m_interiorLayoutFileName.loadFromIff(file);
|
||||
|
||||
switch(runtimeCrc(paramName)) {
|
||||
case constcrc("cockpitFilename"):
|
||||
m_cockpitFilename.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("hasWings"):
|
||||
m_hasWings.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("playerControlled"):
|
||||
m_playerControlled.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("interiorLayoutFileName"):
|
||||
m_interiorLayoutFileName.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
|
||||
+1375
-1374
File diff suppressed because it is too large
Load Diff
+311
-339
@@ -19,63 +19,58 @@
|
||||
#include "sharedTemplateDefinition/ObjectTemplate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
SharedVehicleObjectTemplate::SharedVehicleObjectTemplate(const std::string & filename)
|
||||
SharedVehicleObjectTemplate::SharedVehicleObjectTemplate(const std::string &filename)
|
||||
//@BEGIN TFD INIT
|
||||
: SharedTangibleObjectTemplate(filename)
|
||||
: SharedTangibleObjectTemplate(filename)
|
||||
//@END TFD INIT
|
||||
{
|
||||
} // SharedVehicleObjectTemplate::SharedVehicleObjectTemplate
|
||||
} // SharedVehicleObjectTemplate::SharedVehicleObjectTemplate
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
SharedVehicleObjectTemplate::~SharedVehicleObjectTemplate()
|
||||
{
|
||||
SharedVehicleObjectTemplate::~SharedVehicleObjectTemplate() {
|
||||
//@BEGIN TFD CLEANUP
|
||||
//@END TFD CLEANUP
|
||||
} // SharedVehicleObjectTemplate::~SharedVehicleObjectTemplate
|
||||
} // SharedVehicleObjectTemplate::~SharedVehicleObjectTemplate
|
||||
|
||||
/**
|
||||
* Static function used to register this template.
|
||||
*/
|
||||
void SharedVehicleObjectTemplate::registerMe(void)
|
||||
{
|
||||
ObjectTemplateList::registerTemplate(SharedVehicleObjectTemplate_tag, create);
|
||||
} // SharedVehicleObjectTemplate::registerMe
|
||||
void SharedVehicleObjectTemplate::registerMe(void) {
|
||||
ObjectTemplateList::registerTemplate(SharedVehicleObjectTemplate_tag, create);
|
||||
} // SharedVehicleObjectTemplate::registerMe
|
||||
|
||||
/**
|
||||
* Creates a SharedVehicleObjectTemplate template.
|
||||
*
|
||||
* @return a new instance of the template
|
||||
*/
|
||||
ObjectTemplate * SharedVehicleObjectTemplate::create(const std::string & filename)
|
||||
{
|
||||
return new SharedVehicleObjectTemplate(filename);
|
||||
} // SharedVehicleObjectTemplate::create
|
||||
ObjectTemplate *SharedVehicleObjectTemplate::create(const std::string &filename) {
|
||||
return new SharedVehicleObjectTemplate(filename);
|
||||
} // SharedVehicleObjectTemplate::create
|
||||
|
||||
/**
|
||||
* Returns the template id.
|
||||
*
|
||||
* @return the template id
|
||||
*/
|
||||
Tag SharedVehicleObjectTemplate::getId(void) const
|
||||
{
|
||||
return SharedVehicleObjectTemplate_tag;
|
||||
} // SharedVehicleObjectTemplate::getId
|
||||
Tag SharedVehicleObjectTemplate::getId(void) const {
|
||||
return SharedVehicleObjectTemplate_tag;
|
||||
} // SharedVehicleObjectTemplate::getId
|
||||
|
||||
/**
|
||||
* Returns this template's version.
|
||||
*
|
||||
* @return the version
|
||||
*/
|
||||
Tag SharedVehicleObjectTemplate::getTemplateVersion(void) const
|
||||
{
|
||||
return m_templateVersion;
|
||||
Tag SharedVehicleObjectTemplate::getTemplateVersion(void) const {
|
||||
return m_templateVersion;
|
||||
} // SharedVehicleObjectTemplate::getTemplateVersion
|
||||
|
||||
/**
|
||||
@@ -83,194 +78,168 @@ Tag SharedVehicleObjectTemplate::getTemplateVersion(void) const
|
||||
*
|
||||
* @return the highest version
|
||||
*/
|
||||
Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const
|
||||
{
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const SharedVehicleObjectTemplate * base = dynamic_cast<const SharedVehicleObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const {
|
||||
if (m_baseData == NULL)
|
||||
return m_templateVersion;
|
||||
const SharedVehicleObjectTemplate *base = dynamic_cast<const SharedVehicleObjectTemplate *>(m_baseData);
|
||||
if (base == NULL)
|
||||
return m_templateVersion;
|
||||
return std::max(m_templateVersion, base->getHighestTemplateVersion());
|
||||
} // SharedVehicleObjectTemplate::getHighestTemplateVersion
|
||||
|
||||
//@BEGIN TFD
|
||||
CompilerIntegerParam * SharedVehicleObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getCompilerIntegerParam
|
||||
CompilerIntegerParam *
|
||||
SharedVehicleObjectTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index) {
|
||||
return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getCompilerIntegerParam
|
||||
|
||||
FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
if (strcmp(name, "speed") == 0)
|
||||
{
|
||||
if (index >= 0 && index < 5)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, index))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_speed[index];
|
||||
}
|
||||
fprintf(stderr, "index for parameter \"speed\" out of bounds\n");
|
||||
}
|
||||
else if (strcmp(name, "slopeAversion") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_slopeAversion;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"slopeAversion\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "hoverValue") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_hoverValue;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"hoverValue\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "turnRate") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_turnRate;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"turnRate\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "maxVelocity") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maxVelocity;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxVelocity\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "acceleration") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_acceleration;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"acceleration\" as an array\n");
|
||||
}
|
||||
else if (strcmp(name, "braking") == 0)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
if (deepCheck && !isParamLoaded(name, false, 0))
|
||||
{
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_braking;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"braking\" as an array\n");
|
||||
}
|
||||
else
|
||||
return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
} //SharedVehicleObjectTemplate::getFloatParam
|
||||
FloatParam *SharedVehicleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) {
|
||||
switch (runtimeCrc(name)) {
|
||||
case constcrc("speed"): {
|
||||
if (index >= 0 && index < 5) {
|
||||
if (deepCheck && !isParamLoaded(name, false, index)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_speed[index];
|
||||
}
|
||||
fprintf(stderr, "index for parameter \"speed\" out of bounds\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("slopeAversion"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_slopeAversion;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"slopeAversion\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("hoverValue"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_hoverValue;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"hoverValue\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("turnRate"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_turnRate;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"turnRate\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("maxVelocity"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_maxVelocity;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"maxVelocity\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("acceleration"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_acceleration;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"acceleration\" as an array\n");
|
||||
}
|
||||
break;
|
||||
case constcrc("braking"): {
|
||||
if (index == 0) {
|
||||
if (deepCheck && !isParamLoaded(name, false, 0)) {
|
||||
if (getBaseTemplate() != nullptr)
|
||||
return getBaseTemplate()->getFloatParam(name, deepCheck, index);
|
||||
return nullptr;
|
||||
}
|
||||
return &m_braking;
|
||||
}
|
||||
fprintf(stderr, "trying to access single-parameter \"braking\" as an array\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index);
|
||||
break;
|
||||
}
|
||||
return nullptr;
|
||||
} //SharedVehicleObjectTemplate::getFloatParam
|
||||
|
||||
BoolParam * SharedVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return SharedTangibleObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getBoolParam
|
||||
BoolParam *SharedVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) {
|
||||
return SharedTangibleObjectTemplate::getBoolParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getBoolParam
|
||||
|
||||
StringParam * SharedVehicleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getStringParam
|
||||
StringParam *SharedVehicleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) {
|
||||
return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getStringParam
|
||||
|
||||
StringIdParam * SharedVehicleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return SharedTangibleObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getStringIdParam
|
||||
StringIdParam *SharedVehicleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) {
|
||||
return SharedTangibleObjectTemplate::getStringIdParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getStringIdParam
|
||||
|
||||
VectorParam * SharedVehicleObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return SharedTangibleObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getVectorParam
|
||||
VectorParam *SharedVehicleObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) {
|
||||
return SharedTangibleObjectTemplate::getVectorParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getVectorParam
|
||||
|
||||
DynamicVariableParam * SharedVehicleObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return SharedTangibleObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getDynamicVariableParam
|
||||
DynamicVariableParam *
|
||||
SharedVehicleObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) {
|
||||
return SharedTangibleObjectTemplate::getDynamicVariableParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getDynamicVariableParam
|
||||
|
||||
StructParamOT * SharedVehicleObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return SharedTangibleObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getStructParamOT
|
||||
StructParamOT *SharedVehicleObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) {
|
||||
return SharedTangibleObjectTemplate::getStructParamOT(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getStructParamOT
|
||||
|
||||
TriggerVolumeParam * SharedVehicleObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index)
|
||||
{
|
||||
return SharedTangibleObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getTriggerVolumeParam
|
||||
TriggerVolumeParam *SharedVehicleObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) {
|
||||
return SharedTangibleObjectTemplate::getTriggerVolumeParam(name, deepCheck, index);
|
||||
} //SharedVehicleObjectTemplate::getTriggerVolumeParam
|
||||
|
||||
void SharedVehicleObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name)
|
||||
{
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
SharedTangibleObjectTemplate::initStructParamOT(param, name);
|
||||
} // SharedVehicleObjectTemplate::initStructParamOT
|
||||
void SharedVehicleObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) {
|
||||
if (param.isInitialized())
|
||||
return;
|
||||
SharedTangibleObjectTemplate::initStructParamOT(param, name);
|
||||
} // SharedVehicleObjectTemplate::initStructParamOT
|
||||
|
||||
void SharedVehicleObjectTemplate::setAsEmptyList(const char *name)
|
||||
{
|
||||
SharedTangibleObjectTemplate::setAsEmptyList(name);
|
||||
} // SharedVehicleObjectTemplate::setAsEmptyList
|
||||
void SharedVehicleObjectTemplate::setAsEmptyList(const char *name) {
|
||||
SharedTangibleObjectTemplate::setAsEmptyList(name);
|
||||
} // SharedVehicleObjectTemplate::setAsEmptyList
|
||||
|
||||
void SharedVehicleObjectTemplate::setAppend(const char *name)
|
||||
{
|
||||
SharedTangibleObjectTemplate::setAppend(name);
|
||||
} // SharedVehicleObjectTemplate::setAppend
|
||||
void SharedVehicleObjectTemplate::setAppend(const char *name) {
|
||||
SharedTangibleObjectTemplate::setAppend(name);
|
||||
} // SharedVehicleObjectTemplate::setAppend
|
||||
|
||||
bool SharedVehicleObjectTemplate::isAppend(const char *name) const
|
||||
{
|
||||
return SharedTangibleObjectTemplate::isAppend(name);
|
||||
} // SharedVehicleObjectTemplate::isAppend
|
||||
bool SharedVehicleObjectTemplate::isAppend(const char *name) const {
|
||||
return SharedTangibleObjectTemplate::isAppend(name);
|
||||
} // SharedVehicleObjectTemplate::isAppend
|
||||
|
||||
|
||||
int SharedVehicleObjectTemplate::getListLength(const char *name) const
|
||||
{
|
||||
if (strcmp(name, "speed") == 0)
|
||||
{
|
||||
return sizeof(m_speed) / sizeof(FloatParam);
|
||||
}
|
||||
else
|
||||
return SharedTangibleObjectTemplate::getListLength(name);
|
||||
} // SharedVehicleObjectTemplate::getListLength
|
||||
int SharedVehicleObjectTemplate::getListLength(const char *name) const {
|
||||
if (strcmp(name, "speed") == 0) {
|
||||
return sizeof(m_speed) / sizeof(FloatParam);
|
||||
} else
|
||||
return SharedTangibleObjectTemplate::getListLength(name);
|
||||
} // SharedVehicleObjectTemplate::getListLength
|
||||
|
||||
/**
|
||||
* Loads the template data from an iff file. We should already be in the form
|
||||
@@ -278,88 +247,91 @@ int SharedVehicleObjectTemplate::getListLength(const char *name) const
|
||||
*
|
||||
* @param file file to load from
|
||||
*/
|
||||
void SharedVehicleObjectTemplate::load(Iff &file)
|
||||
{
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
void SharedVehicleObjectTemplate::load(Iff &file) {
|
||||
static const int MAX_NAME_SIZE = 256;
|
||||
char paramName[MAX_NAME_SIZE];
|
||||
|
||||
if (file.getCurrentName() != SharedVehicleObjectTemplate_tag)
|
||||
{
|
||||
SharedTangibleObjectTemplate::load(file);
|
||||
return;
|
||||
}
|
||||
if (file.getCurrentName() != SharedVehicleObjectTemplate_tag) {
|
||||
SharedTangibleObjectTemplate::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();
|
||||
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.enterForm();
|
||||
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i)
|
||||
{
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
if (strcmp(paramName, "speed") == 0)
|
||||
{
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 5, ("Template %s: read array size of %d for array \"speed\" of size 5, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 5 && j < listCount; ++j)
|
||||
m_speed[j].loadFromIff(file);
|
||||
// if there are more params for speed read and dump them
|
||||
for (; j < listCount; ++j)
|
||||
{
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
else if (strcmp(paramName, "slopeAversion") == 0)
|
||||
m_slopeAversion.loadFromIff(file);
|
||||
else if (strcmp(paramName, "hoverValue") == 0)
|
||||
m_hoverValue.loadFromIff(file);
|
||||
else if (strcmp(paramName, "turnRate") == 0)
|
||||
m_turnRate.loadFromIff(file);
|
||||
else if (strcmp(paramName, "maxVelocity") == 0)
|
||||
m_maxVelocity.loadFromIff(file);
|
||||
else if (strcmp(paramName, "acceleration") == 0)
|
||||
m_acceleration.loadFromIff(file);
|
||||
else if (strcmp(paramName, "braking") == 0)
|
||||
m_braking.loadFromIff(file);
|
||||
file.exitChunk(true);
|
||||
}
|
||||
file.enterChunk();
|
||||
int paramCount = file.read_int32();
|
||||
file.exitChunk();
|
||||
for (int i = 0; i < paramCount; ++i) {
|
||||
file.enterChunk();
|
||||
file.read_string(paramName, MAX_NAME_SIZE);
|
||||
|
||||
file.exitForm();
|
||||
SharedTangibleObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // SharedVehicleObjectTemplate::load
|
||||
switch (runtimeCrc(paramName)) {
|
||||
case constcrc("speed"): {
|
||||
int listCount = file.read_int32();
|
||||
DEBUG_WARNING(listCount != 5,
|
||||
("Template %s: read array size of %d for array \"speed\" of size 5, reading values anyway", file.getFileName(), listCount));
|
||||
int j;
|
||||
for (j = 0; j < 5 && j < listCount; ++j)
|
||||
m_speed[j].loadFromIff(file);
|
||||
// if there are more params for speed read and dump them
|
||||
for (; j < listCount; ++j) {
|
||||
FloatParam dummy;
|
||||
dummy.loadFromIff(file);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case constcrc("slopeAversion"):
|
||||
m_slopeAversion.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("hoverValue"):
|
||||
m_hoverValue.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("turnRate"):
|
||||
m_turnRate.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("maxVelocity"):
|
||||
m_maxVelocity.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("acceleration"):
|
||||
m_acceleration.loadFromIff(file);
|
||||
break;
|
||||
case constcrc("braking"):
|
||||
m_braking.loadFromIff(file);
|
||||
break;
|
||||
}
|
||||
file.exitChunk(true);
|
||||
}
|
||||
|
||||
file.exitForm();
|
||||
SharedTangibleObjectTemplate::load(file);
|
||||
file.exitForm();
|
||||
return;
|
||||
} // SharedVehicleObjectTemplate::load
|
||||
|
||||
/**
|
||||
* Saves the template data to an iff file.
|
||||
@@ -367,79 +339,79 @@ char paramName[MAX_NAME_SIZE];
|
||||
* @param file file to save to
|
||||
* @param location file type (client or server)
|
||||
*/
|
||||
void SharedVehicleObjectTemplate::save(Iff &file)
|
||||
{
|
||||
int count;
|
||||
void SharedVehicleObjectTemplate::save(Iff &file) {
|
||||
int count;
|
||||
|
||||
file.insertForm(SharedVehicleObjectTemplate_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();
|
||||
file.insertForm(SharedVehicleObjectTemplate_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;
|
||||
int paramCount = 0;
|
||||
|
||||
// save speed
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("speed");
|
||||
count = 5;
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{for (int i = 0; i < 5; ++i)
|
||||
m_speed[i].saveToIff(file);}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save slopeAversion
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("slopeAversion");
|
||||
m_slopeAversion.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save hoverValue
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("hoverValue");
|
||||
m_hoverValue.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save turnRate
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("turnRate");
|
||||
m_turnRate.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxVelocity
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxVelocity");
|
||||
m_maxVelocity.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save acceleration
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("acceleration");
|
||||
m_acceleration.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save braking
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("braking");
|
||||
m_braking.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save speed
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("speed");
|
||||
count = 5;
|
||||
file.insertChunkData(&count, sizeof(count));
|
||||
{
|
||||
for (int i = 0; i < 5; ++i)
|
||||
m_speed[i].saveToIff(file);
|
||||
}
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save slopeAversion
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("slopeAversion");
|
||||
m_slopeAversion.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save hoverValue
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("hoverValue");
|
||||
m_hoverValue.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save turnRate
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("turnRate");
|
||||
m_turnRate.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save maxVelocity
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("maxVelocity");
|
||||
m_maxVelocity.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save acceleration
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("acceleration");
|
||||
m_acceleration.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
// save braking
|
||||
file.insertChunk(TAG(X, X, X, X));
|
||||
file.insertChunkString("braking");
|
||||
m_braking.saveToIff(file);
|
||||
file.exitChunk();
|
||||
++paramCount;
|
||||
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
// write number of parameters
|
||||
file.goToTopOfForm();
|
||||
file.insertChunk(TAG(P, C, N, T));
|
||||
file.insertChunkData(¶mCount, sizeof(paramCount));
|
||||
file.exitChunk();
|
||||
|
||||
file.exitForm(true);
|
||||
SharedTangibleObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
} // SharedVehicleObjectTemplate::save
|
||||
file.exitForm(true);
|
||||
SharedTangibleObjectTemplate::save(file);
|
||||
file.exitForm();
|
||||
} // SharedVehicleObjectTemplate::save
|
||||
|
||||
//@END TFD
|
||||
|
||||
@@ -1942,8 +1942,10 @@ std::string name;
|
||||
{
|
||||
// we need to read the next line to continue parsing
|
||||
line = goToNextLine();
|
||||
if (line == CHAR_ERROR)
|
||||
if (line == CHAR_ERROR) {
|
||||
delete newData;
|
||||
return line;
|
||||
}
|
||||
}
|
||||
line = parseDynamicVariableParameterList(*newData, line);
|
||||
}
|
||||
|
||||
+2
@@ -1202,6 +1202,7 @@ void ProceduralTerrainAppearance::_legacyCreateFlora(const Chunk* const chunk)
|
||||
IGNORE_RETURN (m_floraMap->insert (std::make_pair (key, object)));
|
||||
} else {
|
||||
DEBUG_WARNING(true, ("FIX ME: Appearance template in ProceduralTerrainAppearance::_legacyCreateFlora is not found"));
|
||||
delete object;
|
||||
}
|
||||
} //lint !e429 //-- collisionProperty has not been freed or returned
|
||||
}
|
||||
@@ -1361,6 +1362,7 @@ void ProceduralTerrainAppearance::createFlora (const Chunk* const chunk)
|
||||
IGNORE_RETURN (m_floraMap->insert (std::make_pair (key, object)));
|
||||
} else {
|
||||
DEBUG_WARNING(true, ("FIX ME: Appearance template in ProceduralTerrainAppearance::createFlora is not found"));
|
||||
delete object;
|
||||
}
|
||||
|
||||
} //lint !e429 //-- collisionProperty has not been freed or returned
|
||||
|
||||
@@ -206,7 +206,6 @@ bool CMonitorData::processHierarchyRequestBlock(UdpConnection *con, short & sequ
|
||||
send(con, sequence, MON_MSG_REPLY_HIERARCHY_BLOCK, m_buffer, size + 1);
|
||||
memset(m_buffer, 0, 16);
|
||||
count++;
|
||||
size = 0;
|
||||
}
|
||||
memset(m_buffer, 0, 16);
|
||||
send(con, sequence, MON_MSG_REPLY_HIERARCHY_BLOCK_END, m_buffer);
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@ namespace Base
|
||||
bool CConfig::LoadFile(char * file)
|
||||
//-----------------------------------
|
||||
{
|
||||
char ch;
|
||||
char ch;
|
||||
FILE * fp;
|
||||
|
||||
UnloadFile();
|
||||
@@ -31,7 +31,7 @@ bool CConfig::LoadFile(char * file)
|
||||
if (fp == nullptr || fp == (FILE *)-1)
|
||||
{
|
||||
//fprintf(stderr,"Failed to open config file %s!",file);
|
||||
delete fp;
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ bool CConfig::LoadFile(char * file)
|
||||
}
|
||||
pConfig[i] = 0; // mark end of file buffer
|
||||
|
||||
fclose(fp);
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user