remove SOE deprecated code and files - leaving in the #if 0 blocks with TODO and other possible uses for later

This commit is contained in:
DarthArgus
2016-03-24 21:07:31 +00:00
parent f275628817
commit 3b430656ba
58 changed files with 7 additions and 2481 deletions
@@ -632,13 +632,6 @@ yyerrlab1: /* here on error raised explicitly by an action */
yyerrdefault: /* current state does not do anything special for the error token. */
#if 0
/* This is wrong; only states that explicitly want error tokens
should shift them. */
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
if (yyn) goto yydefault;
#endif
yyerrpop: /* pop the current state because it cannot handle the error token */
if (yyssp == yyss) YYABORT;
@@ -380,201 +380,6 @@ static errorType evaluateArgs(void)
return retVal;
return retVal;
#if 0
errorType retVal = ERR_NONE; // assume no error has been found
bool outPathUsed = false; // flag to monitor if -o flag was used, if so, we can ignore -d, -p, -e, -f
bool inFileEntered = false;
int argc = CommandLine::getPlainCount();
// get default values from DOS
char currentDir[maxStringSize];
if (nullptr == getcwd(currentDir, maxStringSize)) // get current working directory
{
retVal = ERR_UNKNOWNDIR;
return(retVal);
}
drive[0] = currentDir[0]; // drive letter
drive[1] = 0; // and nullptr terminate it
strcpy(extension, "IFF"); // default to uppercase .IFF
strcpy(directory, &currentDir[2]); // get everything after the Drive: including the first backslash
filename[0] = 0;
// see specs.txt for requests
// scan for any argv's that has '-' in the argv[n][0]'s character
for (int index = 0; index < argc; index++) // note: if using argv[] rather then CommandLine::getPlainString() then start with 1 rather then 0
{
if ('-' == CommandLine::getPlainString(index)[0])
{
// we've found a parameter switch
switch (tolower(CommandLine::getPlainString(index)[1])) // assume non case sensitive switches
{
case 'i': // install via #pragma
{
usePragma = true;
break;
}
case 'c': // use CCCP instead of CPP
useCCCP = true;
break;
case 'v': // don't show any debug message
verboseMode = true;
break;
case '$':
debugMode = true;
break;
case 'o': // target output file name and path (complete path)
{
index++; // next param
outPathUsed = true;
strcpy(outFileName, CommandLine::getPlainString(index));
break;
}
case 'd': // target drive letter (-p must be present)
{
if (!outPathUsed)
{
index++; // next param
strcpy(drive, CommandLine::getPlainString(index));
}
else
index++; // skip the drive letter arg that SHOULD follow the -d option
break;
}
case 'p': // target pathname
{
if (!outPathUsed)
{
index++; // next param
strcpy(directory, CommandLine::getPlainString(index));
}
else
index++; // skip the pathname arg that follows the -p option
break;
}
case 'f': // target filename
{
if (!outPathUsed)
{
index++; // next param
strcpy(filename, CommandLine::getPlainString(index));
}
else
index++; // skip the filename arg that follows the -f
break;
}
case 'e': // target extension
{
if (!outPathUsed)
{
index++; // next param
strcpy(extension, CommandLine::getPlainString(index));
}
else
index++; // skip the extension arg that follows the -e
break;
}
case 'h': // help!
case '?':
{
help();
index = argc; // force to exit
retVal = ERR_HELPREQUEST;
return(retVal); // special case, ONLY time I call return() in the middle of the function (because I check for argc < 2 at the end of the code)
break;
}
default:
{
sprintf(err_msg, "\nUnknown parameter %s, use -h to seek help...\n", CommandLine::getPlainString(index));
MIFFMessage(err_msg, 1);
index = argc; // force to exit
break;
}
}
}
else
{
// we found an arg that doesn't start with '-' so let's assume it's a filename
if (!inFileEntered)
{
strcpy(inFileName, CommandLine::getPlainString(index));
inFileEntered = true;
}
else
{
retVal = ERR_MULTIPLEINFILE;
index = argc;
}
// now construct the DEFAULT filename for this file by scanning backwards to front and only extracting the filename (no extension, no path)
if (ERR_NONE == retVal)
{
char sourceName[maxStringSize];
strcpy(sourceName, inFileName); // make a duplicate for us to play with
for (int strIndex = strlen(sourceName); strIndex > 0; strIndex--)
{
if ('.' == sourceName[strIndex])
sourceName[strIndex] = 0; // put a stopper here... we are assuming that '.' indicates extension! I'm going to assume that the person is just testing me if s/he decides to use filename like "foo.bar.psych" which will truncate to "foo"
if ('\\' == sourceName[strIndex])
break; // get out, for we've reached the path name...
}
// ok, by here, strIndex should point to either beginning of the string, or where the first '\' was found scanning backwards
strcpy(filename, &sourceName[strIndex]); // ta-da-!
}
}
}
if (inFileEntered)
{
if (0 == preprocessSource(inFileName))
{
if (verboseMode)
{
// using err_msg as my temp buffer...
sprintf(err_msg,"Now compiling %s\n", inFileName);
MIFFMessage(err_msg, 0);
}
if (ERR_NONE == retVal)
retVal = loadInputToBuffer(sourceBuffer, bufferSize);
}
else // preprocessSource returned an error...
{
retVal = ERR_PREPROCESS;
}
}
else // inFileEntered == false
{
MIFFMessage("Missing input filename in command line!", 1);
}
// construct a outFileName[] based on drive[], directory[], filename[], and extension[]
if (!outPathUsed && (ERR_NONE == retVal))
{
if (inFileName[0]) // make sure the user has entered a input filename
sprintf(outFileName,"%s:%s\\%s.%s", drive, directory, filename, extension);
}
if (argc < 1)
retVal = ERR_ARGSTOOFEW; // we can do this because we know -h was not entered...
return(retVal);
#endif
}
@@ -72,10 +72,6 @@ void TaskConnection::onConnectionOpened()
void TaskConnection::onReceive(const Archive::ByteStream & message)
{
UNREF(message);
#if 0
Archive::ReadIterator r(message);
GameNetworkMessage m(r);
#endif
}
//-----------------------------------------------------------------------
@@ -46,32 +46,8 @@ TaskManagerSysInfo & TaskManagerSysInfo::operator = (const TaskManagerSysInfo &
const float TaskManagerSysInfo::getScore() const
{
#if 0
//Temporariy remove this since it's not giving us good results
FILE * avg = popen("uptime", "r");
float a = 0.0f;
if(avg)
{
std::string output;
while(!feof(avg))
{
char buf[1024] = {"\0"};
fread(buf, sizeof(buf), 1, avg);
output += buf;
}
char formatted[1024] = {"\0"};
std::string load = output.substr(output.find("load average:"));
sscanf(load.c_str(), "load average: %f", &a);
pclose(avg);
}
return a;
#else
float ret = static_cast<float>(TaskManager::getNumGameConnections());
return ret;
#endif
}
//-----------------------------------------------------------------------
@@ -77,10 +77,6 @@ void MetricsServerConnection::onProcessKilled(const ProcessKilled & k)
void MetricsServerConnection::receive(const Archive::ByteStream & )
{
#if 0
Archive::ReadIterator r(message);
GameNetworkMessage m(r);
#endif
}
//-----------------------------------------------------------------------
@@ -831,15 +831,6 @@ void TaskManager::update()
lastTime = currentTime;
}
#if 0
instance().m_sysInfoSource->update();
if (ms_doUpdate)
{
Locator::updateAllLoads();
ms_doUpdate = false;
}
#endif//0
// get process status
std::set<std::pair<std::string, unsigned long> >::iterator i;
for(i = instance().m_localServers.begin(); i != instance().m_localServers.end();)
@@ -498,23 +498,6 @@ void DatabaseProcess::receiveMessage(const MessageDispatch::Emitter & source, co
Loader::getInstance().checkVersionNumber(ConfigServerDatabase::getExpectedDBVersion(), ConfigServerDatabase::isCorrectDBVersionRequired());
Loader::getInstance().loadClock();
}
else if(message.isType("LoadObjectMessage"))
{
#if 0
Archive::ReadIterator ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
LoadObjectMessage lom(ri);
connectToGameServer(lom.getAddress().c_str(),lom.getPort(),lom.getProcess());
#endif
}
else if (message.isType("LoadUniverseMessage"))
{
#if 0
Archive::ReadIterator ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
LoadUniverseMessage lom(ri);
connectToGameServer(lom.getAddress().c_str(),lom.getPort(),lom.getProcess());
#endif
}
else if(message.isType("GameSetProcessId") || message.isType("GameGameServerConnect"))
{
GameServerConnection * g = const_cast<GameServerConnection *>(static_cast<const GameServerConnection *>(&source));
@@ -246,15 +246,6 @@ namespace CommoditiesMarketNamespace
errorCode = ar_ITEM_EQUIPPED;
}
#if 0
const VolumeContainer *vol = ContainerInterface::getVolumeContainer(item);
if (vol && vol->getCurrentVolume() > 0)
{
errorCode = ar_NOT_EMPTY;
}
#endif
if ((errorCode == ar_OK) && auctionContainer.isVendor() && !auctionContainer.isBazaarTerminal())
{
// check to make sure the vendor isn't restricted from accepting this item
@@ -1772,67 +1763,9 @@ void CommoditiesMarket::auctionCreateImmediate(CreatureObject &owner, ServerObje
void CommoditiesMarket::auctionCreatePermanent(const std::string &, const ServerObject &, const ServerObject &, BidAmount , const Unicode::String &, bool )
{
if (!ConfigServerGame::getCommoditiesMarketEnabled())
return;
DEBUG_WARNING(true, ("auctionCreatePermanent has been depricated and shouldn't be used. If you see this WARNING, add a line to catch cheaters in the command in CommandCppFuncs.cpp"));
return;
#if 0 //what the hell is this?
const NetworkId & itemId = item.getNetworkId();
int flags = AUCTION_ALWAYS_PRESENT;
if (premium)
{
flags |= AUCTION_PREMIUM_AUCTION;
}
const TangibleObject *tangibleObject = item.asTangibleObject();
if (tangibleObject && tangibleObject->hasCondition(ServerTangibleObjectTemplate::C_magicItem))
{
flags |= AUCTION_MAGIC_ITEM;
}
const Unicode::String objectName = Auction::getItemAuctionName(&item);
const AuctionToken & token = AuctionTokenServer::createTokenFor(item);
Unicode::String oobData;
OutOfBandPackager::pack(token, 0, oobData);
ServerObject::AttributeVector attributes;
//-- I don't know why this cast is necessary, but MSDEV is apparently confused otherwise
static_cast<const ServerObject &>(item).getAttributes(NetworkId::cms_invalid, attributes);
OutOfBandPackager::pack(attributes, 1, oobData);
OutOfBandPackager::pack(item.getTemplateName(), 2, oobData);
if (s_market)
{
s_market->AddImmediateAuction(
-1,
ownerName,
price,
1,
itemId,
objectName.size(), objectName.data(),
item.getGameObjectType(),
ConfigServerGame::getUnclaimedAuctionItemDestroyTimeSec(),
auctionContainer.getNetworkId(),
getLocationString(auctionContainer),
flags,
userDescription.size(), userDescription.data(),
oobData.size(),
oobData);
}
else
{
DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddImmediateAuction."));
getCommoditiesServerConnection(); //attempt to reconnect to commodities server
}
#endif
}
// ----------------------------------------------------------------------
@@ -91,13 +91,6 @@ namespace PreloadManagerNameSpace
if (tmp)
line = tmp;
DataTable* dt = DataTableManager::getTable(line, true);
#if 0
if (dt)
ms_dataTableList.push_back(dt);
#else
UNREF(dt);
#endif
DEBUG_REPORT_LOG(true, ("."));
line = fgets(buf, 256, fp);
}
@@ -549,16 +549,6 @@ void ServerBuildoutManagerNamespace::buildObjectsToSave(std::vector<ServerObject
bool ServerBuildoutManagerNamespace::isNotObjectForBuildout(ServerObject const *obj)
{
#if 0
DEBUG_REPORT_LOG_PRINT( true, ( "isNotObjectForBuildout: %s [%d] ver=%d isPersisted=%d isPlayerController=%d includeInBuildout=%d\n" ,
Unicode::wideToNarrow( obj->getObjectName() ).c_str(),
(int)obj->getNetworkId().getValue(),
obj->getCacheVersion(),
obj->isPersisted(),
obj->isPlayerControlled(),
obj->getIncludeInBuildout() ) );
#endif
const ServerObject * const containingObject = safe_cast<const ServerObject *>(ContainerInterface::getContainedByObject(*obj));
// make sure that cells that should be included in the buildout have all their
@@ -750,12 +740,6 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo)
FATAL( isPob && ( cellIndex != 0 || containerId != 0 ), ( "tried to add a pob to a cell or other container. %s (objId=%d cellIndex=%d containerId=%d)",
serverTemplateBase->getName(), objId, cellIndex,containerId ) );
#if 0
DEBUG_REPORT_LOG_PRINT( true, ( "SERVER --------- objId=%016I64x container=%016I64x\n",
objId,
containerId));
#endif
Quaternion const q(
areaBuildoutTable.getFloatValue(qwColumn, buildoutRow),
@@ -2524,18 +2524,6 @@ void ServerWorld::remove()
delete m_sceneId;
m_sceneId = 0;
#if 0 //removed pending objects
ObjectMap::iterator objIter;
while (m_pendingObjects->size() > 0)
{
objIter = m_pendingObjects->begin();
object = (*objIter).second;
m_pendingObjects->erase(objIter);
delete object;
}
delete m_pendingObjects;
m_pendingObjects = 0;
#endif
delete g_objectSphereTree;
g_objectSphereTree = 0;
delete g_triggerSphereTree;
@@ -2821,12 +2821,6 @@ float CreatureObject::alter(float time)
}
//check timer and migrate stats if necessary
//disable self stat migration
#if 0
migrateStats(time);
#endif
if (isPlayerControlled())
{
PROFILER_AUTO_BLOCK_DEFINE("CreatureObject::alter auth player stuff");
@@ -112,36 +112,12 @@ void GroupWaypointBuilderNamespace::updateGroupWaypoints(PlayerObject &playerObj
void GroupWaypointBuilder::updateGroupWaypoints(GroupObject const &groupObject)
{
#if 0
PlayerObject::WaypointMap groupWaypoints;
buildGroupWaypoints(groupObject, groupWaypoints);
GroupWaypointBuilderNamespace::updateGroupWaypoints(groupObject, groupWaypoints);
#endif
}
// ----------------------------------------------------------------------
void GroupWaypointBuilder::updateGroupWaypoints(PlayerObject &playerObject, bool const updateGroup)
{
#if 0
CreatureObject const * const creatureObject = playerObject.getCreatureObject();
if (creatureObject)
{
GroupObject const * const groupObject = creatureObject->getGroup();
if (groupObject && updateGroup)
{
PlayerObject::WaypointMap groupWaypoints;
buildGroupWaypoints(*groupObject, groupWaypoints);
GroupWaypointBuilderNamespace::updateGroupWaypoints(*groupObject, groupWaypoints);
}
else
{
PlayerObject::WaypointMap groupWaypoints;
buildGroupWaypoints(playerObject, groupWaypoints);
GroupWaypointBuilderNamespace::updateGroupWaypoints(playerObject, groupWaypoints);
}
}
#endif
}
// ======================================================================
@@ -2411,13 +2411,6 @@ int ServerObject::getVolume(void) const
{
const VolumeContainmentProperty* volumeProperty = ContainerInterface::getVolumeContainmentProperty(*this);
return volumeProperty ? volumeProperty->getVolume() : 1;
#if 0
const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this);
if (container)
return m_volume.get()+container->getCurrentVolume();
else
return m_volume.get();
#endif
}
//-----------------------------------------------------------------------
@@ -268,20 +268,6 @@ void ShipClientUpdateTracker::update(float elapsedTime) // static
static Archive::ByteStream bs;
#if 0
GameClientMessage gcm(
(*k).second,
false,
ShipUpdateTransformMessage(
ship->getNetworkId(),
controller->getTransform(),
controller->getVelocity(),
controller->getYawRate(),
controller->getPitchRate(),
controller->getRollRate(),
(*j).first->getSyncStampLong()));
gcm.pack(bs);
#else
static ConstCharCrcString const s_gcmname("GameClientMessage");
static ConstCharCrcString const s_sutmname("ShipUpdateTransformMessage");
static unsigned int const s_sutmByteStreamLength =
@@ -313,7 +299,6 @@ void ShipClientUpdateTracker::update(float elapsedTime) // static
PackedRotationRate const packedRollRate(controller->getRollRate());
Archive::put(bs, packedRollRate);
Archive::put(bs, (*j).first->getSyncStampLong());
#endif
(*j).first->Connection::send(bs, false);
bs.clear();
@@ -733,63 +733,6 @@ void ServerSecureTrade::removeItem(const CreatureObject & trader, const ServerOb
//-- CS requested that removing an item cancels the trade to prevent scamming
UNREF (item);
cancelTrade (trader);
#if 0
if (m_tradeState != TS_Trading)
{
DEBUG_REPORT_LOG(true, ("Secure Trade: received an remove item in non-trade state\n"));
beginTrading();
}
if (&trader == m_initiator)
{
std::vector<ServerObject *>::iterator i = std::find(m_initiatorContents->begin(), m_initiatorContents->end(), &item);
if (i != m_initiatorContents->end())
{
m_initiatorContents->erase(i);
Client * const recipientClient = m_recipient->getClient();
if (recipientClient)
{
RemoveItemMessage const m(item.getNetworkId());
recipientClient->send(m, true);
}
}
else
{
//@todo need an error message
}
}
else if (& trader == m_recipient)
{
std::vector<ServerObject *>::iterator i = std::find(m_recipientContents->begin(), m_recipientContents->end(), &item);
if (i != m_recipientContents->end())
{
m_recipientContents->erase(i);
Client * const initiatorClient = m_initiator->getClient();
if (initiatorClient)
{
RemoveItemMessage const m(item.getNetworkId());
initiatorClient->send(m, true);
}
}
else
{
//@todo need an error message for not found.
}
}
else
{
WARNING_STRICT_FATAL(true, ("Secure Trade: received a remove Item from non participant\n"));
return;
}
unacceptOffer(*m_initiator);
unacceptOffer(*m_recipient);
#endif
}
// ----------------------------------------------------------------------
@@ -42,23 +42,7 @@ KeyServer::~KeyServer()
bool KeyServer::update(void)
{
bool result = false;
#if 0 // disable key rotation
lastUpdateTime += Clock::frameTime();
if(lastUpdateTime > updateRate)
{
lastUpdateTime = CONST_REAL(0.0);
KeyShare::Key k;
for(unsigned int j = 0; j < KeyShareConstants::keyLength; j ++)
{
k.value[j] = static_cast<unsigned char>(randomNumberGenerator->random(255));
}
pushKey(k);
result = true;
}
#endif // disable key rotation
return result;
return false;
}
//-----------------------------------------------------------------------
@@ -4705,20 +4705,6 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script,
}
}
break;
#if 0
case 'S':
{
arg = globals.getNextStringId();
if (arg == 0)
{
return SCRIPT_OVERRIDE;
}
// @todo: fix this when we get real string ids
// int param = atoi(stringArg);
// ms_env->SetIntField(arg, ms_fidStringIdData, static_cast<jint>(param));
}
break;
#endif
default:
DEBUG_REPORT_LOG(true, ("unknown parameter type %c(%#x)\n", argList[i],
static_cast<unsigned>(argList[i]))); //lint !e571 suspicious cast
@@ -181,29 +181,6 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandToken(JNIEnv * env,
JavaString result("JavaLibrary::chatPackOutOfBandToken - FAILED Token archive not implemented");
return result.getReturnValue();
#if 0
JavaStringParam jt(target);
Unicode::String t;
if(! JavaLibrary::convert(jt, t))
return 0;
if(! source)
return 0;
Token * token = 0;
if(!JavaLibrary::getObject(source, token))
return 0;
Archive::ByteStream bs;
Archive::put(bs, std::string(token->getObjectTemplateName()));
Archive::put(bs, *token);
OutOfBandPackager::pack(bs, gs_Object, position, t);
JavaString result(t);
return result.getReturnValue();
#endif
}
//----------------------------------------------------------------------
@@ -43,9 +43,6 @@ voidpf ZlibCompressorNamespace::allocateWrapper(voidpf opaque, uInt items, uInt
UNREF(opaque);
void *result = 0;
#if 0
result = operator new(items * size);
#else
int totalSize = items * size;
if (totalSize > cms_poolElementThreshold)
{
@@ -67,7 +64,6 @@ voidpf ZlibCompressorNamespace::allocateWrapper(voidpf opaque, uInt items, uInt
ms_mutex.leave();
}
#endif
return result;
}
@@ -78,9 +74,6 @@ void ZlibCompressorNamespace::freeWrapper(voidpf opaque, voidpf address)
{
UNREF(opaque);
#if 0
operator delete(address);
#else
if (address < ms_memoryBottom || address >= ms_memoryTop)
operator delete(address);
else
@@ -89,7 +82,6 @@ void ZlibCompressorNamespace::freeWrapper(voidpf opaque, voidpf address)
ms_memoryPool.push_back(address);
ms_mutex.leave();
}
#endif
}
// ======================================================================
@@ -417,10 +417,6 @@ void DebugMonitor::flushOutput()
const int input = wgetch(s_outputWindow);
if (input != ERR)
{
#if 0
DEBUG_REPORT_LOG(true, ("DebugMonitor: received key [index=%d].\n", input));
#endif
//-- Handle input.
switch (input)
{
@@ -248,10 +248,6 @@ public:
void read_string(Unicode::String &str);
Unicode::String read_unicodeString();
#if 0
real *read_float (int count, real *array=nullptr);
#endif
};
// ----------------------------------------------------------------------
@@ -115,26 +115,14 @@ void FloatingPointUnit::update(void)
WORD FloatingPointUnit::getControlWord(void)
{
//TODO wtf is this asm statement?
#if 0
WORD controlWord = 0;
__asm fnstcw controlWord;
return controlWord;
#else
return status;
#endif
}
// ----------------------------------------------------------------------
void FloatingPointUnit::setControlWord(WORD controlWord)
{
//TODO see above?
UNREF(controlWord);
#if 0
__asm fldcw controlWord;
#endif
}
// ----------------------------------------------------------------------
@@ -88,11 +88,6 @@ void Os::installCommon(void)
ExitChain::add(Os::remove, "Os::remove", 0, true);
#if 0 //TODO For now we won't screw with the priority of the process
HANDLE threadHandle = GetCurrentThread();
DEBUG_FATAL(!SetThreadPriority(threadHandle, THREAD_PRIORITY_ABOVE_NORMAL), ("Failed to set game thread priority"));
#endif
numberOfUpdates = 0;
mainThreadId = pthread_self();
@@ -299,19 +294,6 @@ bool Os::update(void)
++numberOfUpdates;
#if 0
#ifdef _DEBUG
if (DEBUG_FLAG_PLATFORM(validateHeap))
{
PROFILER_START("validate heap");
MemoryManager::validate();
PROFILER_STOP("validate heap");
}
#endif
#endif
Clock::update();
wasPaused = false;
@@ -179,13 +179,6 @@ DWORD GetFileSize(FILE* hFile, DWORD* lpHighSize)
endPos = ftell(hFile);
fseek(hFile, curPos, SEEK_SET);
return endPos;
#if 0
//This is what I want to do, but I have no file des number
struct stat buf;
fstat(hFile, &buf);
return buf->st_size;
#endif
}
BOOL FileExists(const char* filename)
@@ -44,12 +44,6 @@ void SetupSharedFoundation::install(const Data &data)
if (data.argc)
CommandLine::absorbStrings(const_cast<const char**>(data.argv+1), data.argc-1);
#if 0
//currently there's a problem that we cannot override the defaults here.
if (data.configFile)
IGNORE_RETURN(ConfigFile::loadFile(data.configFile));
#endif
// get the post command-line text for the ConfigFile (key-value pairs)
const char *configString = CommandLine::getPostCommandLineString();
if (configString)
@@ -254,24 +254,6 @@ void Clock::update(void)
ms_lastFrameRate = RECIP(ms_lastFrameTime);
}
#if 0
// -qq- debugging W2K QueryPerformanceCounter
static DWORD lastTick;
DWORD newTick = GetTickCount();
DEBUG_REPORT_LOG_PRINT(true, ("Clock::update %I64d %I64d %6I64d %10d %10d %3d %6.2f=fps %6.4f=time\n", ms_lastPoll, newPoll, newPoll - ms_lastPoll, lastTick, newTick, newTick - lastTick, ms_lastFrameRate, ms_lastFrameTime));
static int bad = 0;
if (bad && ++bad > 64)
__asm int 3;
if (ms_lastFrameTime > 3.0)
bad = 1;
lastTick = newTick;
#endif
ms_lastPoll = newPoll;
@@ -78,25 +78,6 @@ uint32 Crc::calculate(const char *string)
// ----------------------------------------------------------------------
#if 0
uint32 Crc::calculateWithToLower(const char *string)
{
uint32 crc;
if (!string)
return 0;
for (crc = CRC_INIT; *string; ++string)
crc = crctable[((crc>>24) ^ static_cast<uint32>(tolower(*string))) & 0xFF] ^ (crc << 8);
return (crc ^ CRC_INIT);
}
#endif
// ----------------------------------------------------------------------
uint32 Crc::calculate(const void *data, int length, uint32 initCrc)
{
DEBUG_FATAL(!data, ("nullptr data arg"));
@@ -321,16 +321,6 @@ WearableAppearanceMap::MapResult::MapResult(MapResult const &rhs) :
// ----------------------------------------------------------------------
#if 0
WearableAppearanceMap::MapResult &WearableAppearanceMap::MapResult::operator =(MapResult const &rhs)
{
}
#endif
// ----------------------------------------------------------------------
bool WearableAppearanceMap::MapResult::hasMapping() const
{
return m_hasMapping;
@@ -485,15 +485,6 @@ int Quest::getMoneyRewardCredits() const
// ----------------------------------------------------------------------
#if 0
std::vector<QuestTask *> const & Quest::getTasks() const
{
return *m_tasks;
}
#endif
// ----------------------------------------------------------------------
/**
* Conversts a comma-delimited list of strings into a vector or the CRCs
* of those strings.
@@ -367,13 +367,6 @@ void ImageManipulation::install(const InstallData &installData)
//-- make sure we've got valid function pointers for all
NOT_NULL(ms_nextMipmapFunction);
#if 0
NOT_NULL(ms_convertFormatFunction);
NOT_NULL(ms_copyIgnoreAlphaFunction);
NOT_NULL(ms_copyRespectAlphaFunction);
NOT_NULL(ms_blendFunction);
NOT_NULL(ms_blendTwoFunction);
#endif
}
// ----------------------------------------------------------------------
@@ -55,20 +55,7 @@ public:
static void install(const InstallData &installData);
static void generateNextSmallerMipmap(const Image &sourceImage, Image &destImage);
#if 0
static void convertFormatSameSize(const Image &sourceImage, Image &destImage);
// these functions require same pixel format. they do not stretch or compress pixels.
static void copyIgnoreAlpha(const Image &sourceImage, int sourceX, int sourceY, int width, int height, Image &destImage, int destX, int destY);
static void copyRespectAlpha(const Image &sourceImage, int sourceX, int sourceY, int width, int height, Image &destImage, int destX, int destY);
// these two always respect alpha
static void blend(float sourceBlendFactor, const Image &sourceImage, int sourceX, int sourceY, int width, int height, Image &destImage, int destX, int destY);
static void blendTwo(float firstSourceBlendFactor, float resultToDestBlendFactor, const Image &sourceImage1, const Image &sourceImage2, int sourceX, int sourceY, int width, int height, Image &destImage, int destX, int destY);
#endif
static void generateNextSmallerMipmap(const Image &sourceImage, Image &destImage);
private:
static void remove();
@@ -146,7 +146,7 @@ void PaletteArgb::release() const
--m_referenceCount;
//-- We are going to let the PaletteArgbList keep references to the palettes and clean them up at the end.
#if 0
#if 0 //TODO: should we use the below or nuke it?
if (m_referenceCount == 0)
{
PaletteArgbList::stopTracking(*this);
@@ -41,11 +41,6 @@ public:
virtual void deleteLinksTo(const CustomizationData &customizationData) = 0;
virtual bool isLocalDirectory() const = 0;
#if 0
virtual std::string writeLocalDirectoryToString() const = 0;
virtual void loadLocalDirectoryFromString(int version, const std::string &string, int startIndex) = 0;
#endif
CustomizationData &getOwner();
const CustomizationData &getOwner() const;
@@ -395,231 +395,4 @@ bool CustomizationData::LocalDirectory::isLocalDirectory() const
return true;
}
// ----------------------------------------------------------------------
#if 0
std::string CustomizationData::LocalDirectory::writeLocalDirectoryToString() const
{
char scratchBuffer[1024];
std::string data;
//-- count # persistable variables
int variableCount = 0;
{
const CustomizationVariableMap::const_iterator endIt = m_variables.end();
for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it)
{
//-- verify it's a non-nullptr variable
const CustomizationVariable *const variable = it->second;
if (variable && variable->doesVariablePersist())
{
// we will write this variable
++variableCount;
}
}
}
//-- write # variables
sprintf(scratchBuffer, "%x%c", variableCount, cms_stringFieldSeparator);
data += scratchBuffer;
//-- write each variable
{
const CustomizationVariableMap::const_iterator endIt = m_variables.end();
for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it)
{
//-- verify it's a non-nullptr variable
const CustomizationVariable *const variable = it->second;
if (!variable)
{
WARNING(true, ("writeLocalDirectoryToString: nullptr variable for [%s], skipping variable writing."));
continue;
}
//-- skip variables that should not be written. typically this will be constant data
// that doesn't need to be customized or transmitted/persisted.
if (!variable->doesVariablePersist())
continue;
//-- write variable name
data += it->first.getString();
data += cms_stringFieldSeparator;
//-- write variable data
// get variable content data
const std::string variableContents = variable->writeToString();
// write content length (we do this so we can skip a variable if its not supported at load time)
sprintf(scratchBuffer, "%x%c", variableContents.size(), cms_stringFieldSeparator);
data += scratchBuffer;
// write variable content
data += variableContents;
}
}
//-- get # local directories to write
int directoryCount = 0;
{
const DirectoryMap::const_iterator endIt = m_directories.end();
for (DirectoryMap::const_iterator it = m_directories.begin(); it != endIt; ++it)
{
if (it->second && it->second->isLocalDirectory())
++directoryCount;
}
}
//-- write # directories
sprintf(scratchBuffer, "%x%c", directoryCount, cms_stringFieldSeparator);
data += scratchBuffer;
//-- write directory contents
{
const DirectoryMap::const_iterator endIt = m_directories.end();
for (DirectoryMap::const_iterator it = m_directories.begin(); it != endIt; ++it)
{
if (it->second && it->second->isLocalDirectory())
{
// write directory name
data += it->first.getString();
data += cms_stringFieldSeparator;
// get directory data contents
const std::string subdirData = it->second->writeLocalDirectoryToString();
// write directory data size (we do this so we can skip a directory if its not supported at load time)
sprintf(scratchBuffer, "%x%c", subdirData.size(), cms_stringFieldSeparator);
data += scratchBuffer;
// write directory contents
data += subdirData;
}
}
}
return data;
}
#endif
// ----------------------------------------------------------------------
#if 0
void CustomizationData::LocalDirectory::loadLocalDirectoryFromString(int version, const std::string &string, int startIndex)
{
if (version == 2)
loadLocalDirectoryFromString_0002(string, startIndex);
else
WARNING(true, ("loadLocalDirectoryFromString(): unsupported version [%d]", version));
}
#endif
// ======================================================================
#if 0
void CustomizationData::LocalDirectory::loadLocalDirectoryFromString_0002(const std::string &data, int startIndex)
{
int currentPosition = startIndex;
//-- get # variables
const int variableCount = parseSeparatedHexInt(data, currentPosition, currentPosition);
if (currentPosition == static_cast<int>(std::string::npos))
{
WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load variable count, aborting load."));
return;
}
//-- load each variable
{
for (int i = 0; i < variableCount; ++i)
{
//-- load the variable name
const std::string variableName = parseSeparatedString(data, currentPosition, currentPosition);
if (currentPosition == static_cast<int>(std::string::npos))
{
WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load variable name, aborting load."));
return;
}
//-- load the # characters in the value data
const int valueCharacterCount = parseSeparatedHexInt(data, currentPosition, currentPosition);
if (currentPosition == static_cast<int>(std::string::npos))
{
WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load variable data size, aborting load."));
return;
}
//-- find the customization variable
CustomizationVariable *const variable = findVariable(variableName, 0);
if (!variable)
{
WARNING(true, ("loadLocalDirectoryFromString_0002(): variable [%s] does not exist to be restored.", variableName.c_str()));
return;
}
else
{
//-- load the data
if (!variable->loadFromString(2, std::string(data, static_cast<std::string::size_type>(currentPosition), static_cast<std::string::size_type>(valueCharacterCount))))
WARNING(true, ("loadLocalDirectoryFromString_0002(): variable [%s] failed to load.", variableName.c_str()));
}
//-- pass the variable data
currentPosition += valueCharacterCount;
}
}
//-- get # subdirectories
const int directoryCount = parseSeparatedHexInt(data, currentPosition, currentPosition);
if (currentPosition == static_cast<int>(std::string::npos))
{
WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load directory count, aborting load."));
return;
}
//-- load each subdirectory
{
for (int i = 0; i < directoryCount; ++i)
{
//-- load the directory name
const std::string directoryName = parseSeparatedString(data, currentPosition, currentPosition);
if (currentPosition == static_cast<int>(std::string::npos))
{
WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load directory name, aborting load."));
return;
}
//-- load the # characters in the value data
const int directoryCharacterCount = parseSeparatedHexInt(data, currentPosition, currentPosition);
if (currentPosition == static_cast<int>(std::string::npos))
{
WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load directory data size, aborting load."));
return;
}
//-- find the customization variable
Directory *const directory = findDirectory(directoryName, 0);
if (!directory)
{
WARNING(true, ("loadLocalDirectoryFromString_0002(): object id=[%s], directory [%s] does not exist to be restored.", getOwner().getOwnerObject().getNetworkId().getValueString().c_str(), directoryName.c_str()));
return;
}
else
{
//-- load the data
directory->loadLocalDirectoryFromString(2, data, currentPosition);
}
//-- pass the variable data
currentPosition += directoryCharacterCount;
}
}
}
#endif
// ======================================================================
@@ -49,11 +49,6 @@ public:
virtual void deleteLinksTo(const CustomizationData &customizationData);
virtual bool isLocalDirectory() const;
#if 0
virtual std::string writeLocalDirectoryToString() const;
virtual void loadLocalDirectoryFromString(int version, const std::string &string, int startIndex);
#endif
private:
@@ -61,11 +56,6 @@ private:
typedef stdmap<const CrcLowerString, CustomizationVariable*>::fwd CustomizationVariableMap;
private:
#if 0
void loadLocalDirectoryFromString_0002(const std::string &string, int startIndex);
#endif
// Disabled.
LocalDirectory();
LocalDirectory(const LocalDirectory&);
@@ -164,31 +164,4 @@ bool CustomizationData::RemoteDirectory::isLocalDirectory() const
return false;
}
// ----------------------------------------------------------------------
#if 0
std::string CustomizationData::RemoteDirectory::writeLocalDirectoryToString() const
{
WARNING(true, ("writeLocalDirectoryToString(): operation makes no sense on RemoteDirectory instances.\n"));
return "";
}
#endif
// ----------------------------------------------------------------------
#if 0
void CustomizationData::RemoteDirectory::loadLocalDirectoryFromString(int version, const std::string &string, int startIndex)
{
UNREF(version);
UNREF(string);
UNREF(startIndex);
WARNING(true, ("loadLocalDirectoryFromString(): operation makes no sense on RemoteDirectory instances."));
}
#endif
// ======================================================================
@@ -47,11 +47,6 @@ public:
virtual void deleteLinksTo(const CustomizationData &customizationData);
virtual bool isLocalDirectory() const;
#if 0
virtual std::string writeLocalDirectoryToString() const;
virtual void loadLocalDirectoryFromString(int version, const std::string &string, int startIndex);
#endif
private:
@@ -52,36 +52,6 @@ int RangedIntCustomizationVariable::getPersistedDataByteCount() const
// ----------------------------------------------------------------------
#if 0
std::string RangedIntCustomizationVariable::writeToString() const
{
char buffer[64];
sprintf(buffer, "%x", getValue());
return std::string(buffer);
}
#endif
// ----------------------------------------------------------------------
#if 0
bool RangedIntCustomizationVariable::loadFromString(int version, const std::string &data)
{
if (version == 2)
return loadFromString_0002(data);
else
{
WARNING(true, ("loadFromString(): version %d unsupported.\n", version));
return false;
}
}
#endif
// ----------------------------------------------------------------------
void RangedIntCustomizationVariable::saveToByteVector(ByteVector &data) const
{
int const byteCount = getPersistedDataByteCount();
@@ -179,29 +149,6 @@ RangedIntCustomizationVariable::RangedIntCustomizationVariable()
// ======================================================================
#if 0
bool RangedIntCustomizationVariable::loadFromString_0002(const std::string &data)
{
int newValue;
const int scanfResult = sscanf(data.c_str(), "%x", &newValue);
if (scanfResult != 1)
{
// failed
return false;
}
else
{
setValue(newValue);
return true;
}
}
#endif
//----------------------------------------------------------------------
/**
* This function computes the normalized value.
* @return a number in [0.0,1.0]
@@ -46,10 +46,6 @@ protected:
private:
#if 0
bool loadFromString_0002(const std::string &data);
#endif
// disabled
RangedIntCustomizationVariable(const RangedIntCustomizationVariable&);
RangedIntCustomizationVariable &operator =(const RangedIntCustomizationVariable&);
@@ -1390,10 +1390,6 @@ void Object::setParentCell(CellProperty *cellProperty)
if (getParentCell() == cellProperty)
return;
#if 0
DEBUG_FATAL(isChildObject(), ("Object::setParentCell called on child object [id=%s template=%s] with parent object [id=%s template=%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName(), m_attachedToObject->getNetworkId().getValueString().c_str(), m_attachedToObject->getObjectTemplateName()));
#endif
// if we were in another cell, detach us. This will leave out object in world space.
if (!isInWorldCell())
detachFromObject(DF_world);
@@ -722,14 +722,6 @@ CellProperty *CellProperty::getDestinationCell(const Vector &startPosition, cons
CellProperty *cellProperty = 0;
closestPortalT = FLT_MAX;
#if 0
if ((startPosition - endPosition).magnitude() > 2.0f)
{
static volatile int debug = 0;
++debug;
}
#endif
const PortalObjectList::const_iterator iEnd = m_portalObjectList->end();
for (PortalObjectList::const_iterator i = m_portalObjectList->begin(); i != iEnd; ++i)
{
@@ -229,7 +229,7 @@ bool PortalProperty::serverEndBaselines(int serverObjectCrc, std::vector<Object*
//-- fixupObject() causes the fixedup object to get added to the world before its parent has been
//-- for now, we won't queue anything for fixup
#if 0
#if 0 //TODO: see above
// go through the cells and remove objects
for (size_t cell=1 ; cell< numberOfCells; ++cell)
{
@@ -374,130 +374,6 @@ bool SamplerProceduralTerrainAppearance::SamplerChunk::getHeightAt (const Vector
return false;
}
//-------------------------------------------------------------------
#if 0
bool SamplerProceduralTerrainAppearance::SamplerChunk::getHeightAt2(const Vector& pos, float* const height, Vector* const normal) const
{
// ------------------------------------------------
// make sure we're in the chunk
const Vector vmin = m_boxExtent.getMin ();
const Vector vmax = m_boxExtent.getMax ();
if (pos.x < vmin.x || pos.x > vmax.x || pos.z < vmin.z || pos.z > vmax.z)
{
DEBUG_WARNING (true, ("called getHeightAt for position not within chunk"));
return false;
}
// ------------------------------------------------
// ------------------------------------------------
// get height pole and tile coordinate.
const Vector localPos = pos - vmin;
const ProceduralTerrainAppearanceTemplate *proceduralTerrainAppearanceTemplate = getAppearanceTemplate();
const float distanceBetweenPoles = proceduralTerrainAppearanceTemplate->getTileWidthInMeters() / 2.0f;
const int numberOfPolesPerChunk = proceduralTerrainAppearanceTemplate->getNumberOfTilesPerChunk() * 2;
int poleX = int(floor(localPos.x / distanceBetweenPoles));
if (poleX>=numberOfPolesPerChunk)
{
poleX=numberOfPolesPerChunk-1;
}
int poleZ = int(floor(localPos.z / distanceBetweenPoles));
if (poleZ>=numberOfPolesPerChunk)
{
poleZ=numberOfPolesPerChunk-1;
}
const int tileX = poleX>>1;
const int tileZ = poleZ>>1;
// ------------------------------------------------
// ------------------------------------------------
// if the tile at x,z is excluded, return failure.
// DEBUG
{
int dbgTileX, dbgTileZ;
_findTileXz(pos, dbgTileX, dbgTileZ);
DEBUG_FATAL(dbgTileX!=tileX, (""));
DEBUG_FATAL(dbgTileZ!=tileZ, (""));
}
if (isExcluded(tileX, tileZ))
{
return false;
}
// ------------------------------------------------
// ------------------------------------------------
// construct vertical vector at x,z that goes
// from the highest point in the chunk to the
// lowest point in the chunk.
const Vector start(pos.x, vmax.y + 0.1f, pos.z);
const Vector end(pos.x, vmin.y - 0.1f, pos.z);
const Vector dir = end - start;
// ------------------------------------------------
//-- collide with the 8 polygons in the tile
bool found = false;
CollisionInfo result;
result.setPoint (end);
Vector intersection;
const int numberOfTilesPerChunk = m_proceduralTerrainAppearance.getNumberOfTilesPerChunk();
const int tileIndex = tileZ * numberOfTilesPerChunk + tileX;
const int triangleOffset = tileIndex * 8;
for (int tri = triangleOffset; tri < triangleOffset + 8; ++tri)
{
const Plane& plane = (*m_planeList) [tri];
const Vector& normal = plane.getNormal ();
if ( dir.dot(normal)<0.f // if triangle is facing upward
&& plane.findIntersection(start, end, intersection)
)
{
const int i0 = (*ms_indexList)[tri*3 + 0];
const int i1 = (*ms_indexList)[tri*3 + 1];
const int i2 = (*ms_indexList)[tri*3 + 2];
const Vector& v0 = (*m_vertexList)[i0];
const Vector& v1 = (*m_vertexList)[i1];
const Vector& v2 = (*m_vertexList)[i2];
DenormalizedLine2d const line01 (Vector2d (v0.x, v0.z), Vector2d (v1.x, v1.z));
DenormalizedLine2d const line12 (Vector2d (v1.x, v1.z), Vector2d (v2.x, v2.z));
DenormalizedLine2d const line20 (Vector2d (v2.x, v2.z), Vector2d (v0.x, v0.z));
if (line01.computeDistanceTo (Vector2d (start.x, start.z)) <= 0 &&
line12.computeDistanceTo (Vector2d (start.x, start.z)) <= 0 &&
line20.computeDistanceTo (Vector2d (start.x, start.z)) <= 0)
{
found = true;
result.setPoint (intersection);
result.setNormal (normal);
}
}
}
if (found)
{
if (height)
*height = result.getPoint ().y;
if (normal)
*normal = result.getNormal ();
return true;
}
return false;
}
#endif
//-------------------------------------------------------------------
#define ALLOW_BACKFACING_COLLISION 0
@@ -209,25 +209,4 @@ float CoordinateHash::makeFloat(unsigned long hash)
return returnValue;
}
#if 0
long CoordinateHash::hashTuple(float x, float z)
{
const unsigned long ix = (*(unsigned long *)&x)^0x5a5a5a5a;
const unsigned long iz = (*(unsigned long *)&z)^0xa5a5a5a5;
const unsigned long hx = _hash1((ix>>8) | (ix<<24));
const unsigned long hz = _hash1((iz>>16) | (iz<<16));
const unsigned long hmix1 = hx^hz;
const unsigned long h = hmix1;
/*
FastRandomGenerator rngx(hx);
FastRandomGenerator rngz(hz);
const long rnx = rngx.random();
const long rnz = rngz.random();
return rnx^rnz;
*/
return h;
}
#endif
//===================================================================
@@ -142,18 +142,3 @@ void Thread::setPriority(ePriority priority)
pthread_setschedparam(thread, policies[priority], &p);
}
// Make sure the header-only files compile :)
#if 0
#include "sharedSynchronization/CountingSemaphore.h"
#include "sharedSynchronization/BlockingPointer.h"
#include "sharedSynchronization/BlockingQueue.h"
#include "sharedSynchronization/WriteOnce.h"
Mutex t;
BlockingQueue<int> bqint(t, 0, 0);
BlockingPointer<int> bpint(t, 0, 0);
WriteOnce<int> woint;
#endif
@@ -19,26 +19,3 @@ FuncPtrThreadZero::Handle runNamedThread(const std::string &name, void (* func)(
{
return TypedThreadHandle<FuncPtrThreadZero> (new FuncPtrThreadZero(name, func));
}
#if 0
// Testing stuff
class testclass
{
public:
void zeroArg() {}
void oneArg(testclass *) {}
void twoArg(testclass *, int) {}
};
testclass m;
typedef MemberFunctionThreadZero<testclass>::Handle AsyncTestMemberFunctionZero;
AsyncTestMemberFunctionZero temp = runThread(m, testclass::zeroArg);
typedef MemberFunctionThreadOne<testclass, testclass *>::Handle AsyncTestMemberFunctionOne;
AsyncTestMemberFunctionOne temp2 = runThread(m, testclass::oneArg, &m);
typedef MemberFunctionThreadTwo<testclass, testclass *, int>::Handle AsyncTestMemberFunctionTwo;
AsyncTestMemberFunctionTwo temp3 = runThread(m, testclass::twoArg, &m, 4);
#endif
@@ -278,12 +278,3 @@ void FileName::stripSpecificPathAndExt (Path path, char* nameBuffer, int nameBuf
}
//-------------------------------------------------------------------
#if 0
DEBUG_REPORT_LOG_PRINT (true, ("%s\n", FileName (FileName::P_none, "test")));
DEBUG_REPORT_LOG_PRINT (true, ("%s\n", FileName (FileName::P_none, "test", "iff")));
DEBUG_REPORT_LOG_PRINT (true, ("%s\n", FileName (FileName::P_sound, "test")));
DEBUG_REPORT_LOG_PRINT (true, ("%s\n", FileName (FileName::P_sound, "test", "iff")));
#endif