// SMsgDirG2ModifyService::Pack // Virtual method from SmallMessage. Packs data into message buffer. void* SMsgDirG2ModifyService::Pack(void) { WTRACE("SMsgDirG2ModifyService::Pack"); SetKeyType(KT_SERVICE); SetServiceType(WONMsg::SmallDirServerG2); if (IsExtended()) { SetMessageType(WONMsg::DirG2ModifyServiceEx); SetExtended(true, true); } else SetMessageType(WONMsg::DirG2ModifyService); SMsgDirG2UpdateExtendBase::Pack(); AppendByte(mEntityFlags); PackKey(*this); Append_PW_STRING(mNewName); unsigned char aLen = mNewNetAddress.size(); AppendByte(aLen); if (aLen > 0) AppendBytes(aLen, mNewNetAddress.data()); Append_PW_STRING(mNewDisplayName); AppendLong(mNewLifespan); PackExtended(); PackPeerData(); return GetDataPtr(); }
// SMsgDirG2ExplicitSetDataObjects::Pack // Virtual method from SmallMessage. Packs data into message buffer. void* SMsgDirG2ExplicitSetDataObjects::Pack(void) { WTRACE("SMsgDirG2ExplicitSetDataObjects::Pack"); SetServiceType(WONMsg::SmallDirServerG2); SetMessageType(mKeyType == KT_SERVICE ? WONMsg::DirG2ServiceExplicitSetDataObjects : WONMsg::DirG2DirectoryExplicitSetDataObjects); SMsgDirG2UpdateBase::Pack(); PackKey(*this); AppendShort(mObjects.size()); ExplicitDOInfoList::iterator anItr(mObjects.begin()); for (; anItr != mObjects.end(); anItr++) { AppendByte(static_cast<unsigned char>(anItr->mSetMode)); unsigned char aTypeLen = anItr->mData.GetDataType().size(); AppendByte(aTypeLen); if (aTypeLen > 0) AppendBytes(aTypeLen, anItr->mData.GetDataType().data()); unsigned short aDataLen = anItr->mData.GetData().size(); AppendShort(aDataLen); if (aDataLen > 0) AppendBytes(aDataLen, anItr->mData.GetData().data()); } PackPeerData(); return GetDataPtr(); }
void CLODLightManager::LoadDatFile() { CIniReader iniReader(""); char* DataFilePath = (char*)iniReader.GetIniPath().c_str(); char* tempPointer; tempPointer = strrchr(DataFilePath, '.'); *tempPointer = '\0'; strcat(DataFilePath, ".dat"); if (FILE* hFile = CFileMgr::OpenFile(DataFilePath, "r")) { unsigned short nModel = 0xFFFF, nCurIndexForModel = 0; while (const char* pLine = CFileMgr::LoadLine(hFile)) { if (pLine[0] && pLine[0] != '#') { if (pLine[0] == '%') { nCurIndexForModel = 0; if (strcmp(pLine, "%additional_coronas") != 0) { if (bIsIVEFLC) nModel = CLODLightManager::IV::GetHashKey((char *)(pLine + 1), 0); else nModel = GetModelInfoUInt16(pLine + 1); } else nModel = 65534; } else { float fOffsetX, fOffsetY, fOffsetZ; unsigned int nRed, nGreen, nBlue, nAlpha; float fCustomSize = 1.0f; int nNoDistance = 0; int nDrawSearchlight = 0; int nCoronaShowMode = 0; sscanf(pLine, "%d %d %d %d %f %f %f %f %d %d %d", &nRed, &nGreen, &nBlue, &nAlpha, &fOffsetX, &fOffsetY, &fOffsetZ, &fCustomSize, &nCoronaShowMode, &nNoDistance, &nDrawSearchlight); pFileContent->insert(std::make_pair(PackKey(nModel, nCurIndexForModel++), CLamppostInfo(CVector(fOffsetX, fOffsetY, fOffsetZ), CRGBA(static_cast<unsigned char>(nRed), static_cast<unsigned char>(nGreen), static_cast<unsigned char>(nBlue), static_cast<unsigned char>(nAlpha)), fCustomSize, nCoronaShowMode, nNoDistance, nDrawSearchlight, 0.0f))); } } } m_bCatchLamppostsNow = true; CFileMgr::CloseFile(hFile); } else { bRenderLodLights = 0; bRenderSearchlightEffects = 0; } }
// SMsgDirG2SetDataObjects::Pack // Virtual method from SmallMessage. Packs data into message buffer. void* SMsgDirG2SetDataObjects::Pack(void) { WTRACE("SMsgDirG2SetDataObjects::Pack"); SetExtended(true, false); SetServiceType(WONMsg::SmallDirServerG2); SetMessageType(mKeyType == KT_SERVICE ? WONMsg::DirG2ServiceSetDataObjects : WONMsg::DirG2DirectorySetDataObjects); SMsgDirG2UpdateExtendBase::Pack(); AppendByte(static_cast<unsigned char>(mSetMode)); PackKey(*this); PackExtended(); PackPeerData(); return GetDataPtr(); }
// SMsgDirG2ClearDataObjects::Pack // Virtual method from SmallMessage. Packs data into message buffer. void* SMsgDirG2ClearDataObjects::Pack(void) { WTRACE("SMsgDirG2ClearDataObjects::Pack"); SetServiceType(WONMsg::SmallDirServerG2); SetMessageType(mKeyType == KT_SERVICE ? WONMsg::DirG2ServiceClearDataObjects : WONMsg::DirG2DirectoryClearDataObjects); SMsgDirG2UpdateBase::Pack(); PackKey(*this); AppendShort(mClearTypes.size()); DataObjectTypeSet::iterator anItr(mClearTypes.begin()); for (; anItr != mClearTypes.end(); anItr++) { unsigned char aLen = anItr->GetDataType().size(); AppendByte(aLen); if (aLen > 0) AppendBytes(aLen, anItr->GetDataType().data()); } PackPeerData(); return GetDataPtr(); }
bool CLODLightManager::IsModelALamppost(unsigned short nModel) { auto it = pFileContent->lower_bound(PackKey(nModel, 0)); return it != pFileContent->end() && it->first >> 16 == nModel; }