/// \brief /// Creates a string representation of the information in this exception. /// \param lpszError /// output buffer for storing the error message /// \param nMaxError /// the size of the output buffer /// \return /// \c TRUE if the error message could be successfully generated; \c FALSE if not VBASE_IMPEXP virtual VBool GetErrorMessage(char* lpszError, UINT nMaxError) { char szBuffer[1024]; const char* szFileName = m_strFileName.GetSafeStr(); const char* szClassName = m_strClassName.GetSafeStr(); switch (m_reason) { case general: sprintf(szBuffer,"General Error in archive '%s'",szFileName);break; case readOnly: sprintf(szBuffer,"Archive '%s' is read-only",szFileName);break; case endOfFile: sprintf(szBuffer,"End of file reached in Archive '%s'",szFileName);break; case writeOnly: sprintf(szBuffer,"Archive '%s' is write-only",szFileName);break; case badIndex: sprintf(szBuffer,"Archive '%s': Bad class index. (Class '%s'). Please check Serialization code for consistency.",szFileName,szClassName);break; case badClass: sprintf(szBuffer,"Archive '%s': Bad class. (Class '%s'). Please check Serialization code for consistency.",szFileName,szClassName);break; case badSchema: sprintf(szBuffer,"Archive '%s': Bad class scheme. (Class '%s')",szFileName,szClassName);break; case unknownClass: sprintf(szBuffer,"Archive '%s': Unknown class '%s'. Please check plugin dependencies.",szFileName,szClassName);break; default:return FALSE; } if (nMaxError<sizeof(szBuffer)) szBuffer[nMaxError-1] = 0; strcpy(lpszError,szBuffer); return TRUE; };
void vHavokBehaviorComponent::Serialize(VArchive &ar) { IVObjectComponent::Serialize(ar); if (ar.IsLoading()) { // Handle project unsigned int iVersion = 0; ar >> iVersion; VASSERT((iVersion > 0) && (iVersion <= s_iSerialVersion)); if ( iVersion <= 1 ) { VString projectPath; ar >> projectPath; ar >> m_projectName; AppendRelativePath( projectPath, m_projectName ); hkStringBuf fullPath = projectPath.GetSafeStr(); fullPath.pathNormalize(); m_projectName = fullPath; }
bool vHavokBehaviorComponent::SetVariable(const char * name, const char * value) { if (!strcmp(name,"m_projectName") && !m_projectPath.IsEmpty() ) { VString fullPath = m_projectPath; AppendRelativePath(fullPath, value); hkStringBuf projectPath = fullPath.GetSafeStr(); projectPath.pathNormalize(); m_projectName = projectPath; m_projectPath = ""; #if defined (_VISION_WIN32) Vision::Editor.SetVariableInEditor( this, "m_projectPath", "", false, false ); Vision::Editor.SetVariableInEditor( this, "Project", m_projectName, false, false ); #endif return true; } else { return IVObjectComponent::SetVariable(name, value); } }