本文整理汇总了C++中VASSERT_MSG函数的典型用法代码示例。如果您正苦于以下问题:C++ VASSERT_MSG函数的具体用法?C++ VASSERT_MSG怎么用?C++ VASSERT_MSG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VASSERT_MSG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VASSERT_MSG
bool RPG_Projectile::ShouldHit(RPG_DamageableEntity* target)
{
VASSERT_MSG(m_characterOwner, "Please set your projectile's character owner.");
if(!target || !m_characterOwner)
{
return true;
}
if(target->IsFrom(RPG_Character))
{
RPG_Character* targetCharacter = static_cast<RPG_Character*>(target);
if(targetCharacter->GetTeam() != m_characterOwner->GetTeam())
{
return true;
}
}
else if(target->Components().GetComponentOfType(V_RUNTIME_CLASS(RPG_AttackableComponent)))
{
return true;
}
return false;
}
示例2: VASSERT_MSG
bool RPG_VisionEffectHelper::LoadMesh(char const* fileName)
{
VResourceManager *resourceManager = Vision::ResourceSystem.GetResourceManagerByName(VIS_RESOURCEMANAGER_MESHES);
VASSERT_MSG (resourceManager, "RPG: No resource manager found.");
if (!resourceManager)
return NULL;
VManagedResource *resource = resourceManager->GetResourceByName(fileName);
if (!resource)
{
VMeshManager *meshManager = static_cast<VMeshManager*>(resourceManager);
resource = meshManager->LoadDynamicMeshFile(fileName);
if (!resource)
{
Vision::Error.Warning("[RPG] Resource is missing: %s", fileName);
return NULL;
}
Vision::Error.SystemMessage("[RPG] Resource is not cached: %s", fileName);
}
return resource;
}
示例3: hkpSphereShape
void RPG_Projectile::CreateShapePhantom()
{
hkReal const radius = RPG_VisionHavokConversion::VisionToHavokScalar(RPG_PROJECTILE_DEFAULT_RADIUS);
hkpSphereShape* sphere = new hkpSphereShape(radius);
hkVector4 havokPosition;
RPG_VisionHavokConversion::VisionToHavokPoint(GetPosition(), havokPosition);
hkQuaternion havokRotation;
RPG_VisionHavokConversion::VisionToHavokRotationQuaternion(GetRotationMatrix(), havokRotation);
hkTransform transform;
{
transform.setRotation(havokRotation);
transform.setTranslation(havokPosition);
}
vHavokConversionUtils::VisMatVecToPhysTransform(GetRotationMatrix(), GetPosition(), transform);
m_shapePhantom = new hkpSimpleShapePhantom(sphere, transform,
hkpGroupFilter::calcFilterInfo(vHavokPhysicsModule::HK_LAYER_COLLIDABLE_DYNAMIC, 0, 0, 0));
sphere->removeReference();
hkpWorld* world = vHavokPhysicsModule::GetInstance()->GetPhysicsWorld();
VASSERT_MSG(world, "Please create a physics world before creating any projectiles.");
if(world)
{
vHavokPhysicsModule::GetInstance()->MarkForWrite();
world->addPhantom(m_shapePhantom);
vHavokPhysicsModule::GetInstance()->UnmarkForWrite();
}
else
{
V_SAFE_DELETE(m_shapePhantom);
m_shapePhantom = NULL;
}
}
示例4: switch
hkResult hkvTextureTransformationRule::determineOutputsIos(Context& context) const
{
hkvTextureCompression compression = (hkvTextureCompression)m_compressionInstance.getDefinitionId();
hkvImageDataFormat dataFormat;
hkvImageFileFormat fileFormat;
switch (compression)
{
case HKV_TEXTURE_COMPRESSION_NONE:
{
dataFormat = (context.m_sourceHasAlpha && !m_removeAlphaChannel) ? HKV_IMAGE_DATA_FORMAT_A8R8G8B8 : HKV_IMAGE_DATA_FORMAT_X8R8G8B8;
fileFormat = HKV_IMAGE_FILE_FORMAT_RGBA;
break;
}
case HKV_TEXTURE_COMPRESSION_QUALITY:
{
dataFormat = HKV_IMAGE_DATA_FORMAT_PVRTC4;
fileFormat = HKV_IMAGE_FILE_FORMAT_PVR;
break;
}
//case HKV_TEXTURE_COMPRESSION_SIZE:
// {
// dataFormat = HKV_IMAGE_DATA_FORMAT_PVRTC2;
// fileFormat = HKV_IMAGE_FILE_FORMAT_PVR;
// break;
// }
default:
{
VASSERT_MSG(FALSE, "Missing compression case!");
return HK_FAILURE;
}
}
context.m_outputVariants.pushBack(hkvTextureVariant("", dataFormat, fileFormat, "", false));
return HK_SUCCESS;
}
示例5: VASSERT_MSG
void VDialog::Serialize( VArchive &ar )
{
VWindowBase::Serialize(ar);
char iLocalVersion = 0;
if (ar.IsLoading())
{
ar >> iLocalVersion; VASSERT_MSG(iLocalVersion==0,"Invalid version");
ar >> m_uiDialogFlags >> (int &)m_eStartPos;
ar >> m_fFadeInPos >> m_fFadeInSpeed >> m_iBackColor >> m_bFadeBack;
ar >> m_iBackFadeColor >> m_fBackFadePos >> m_fBackFadeSpeed;
V_SAFE_DELETE(m_pImage);
bool bHasImg = false;
ar >> bHasImg;
if (bHasImg)
{
m_pImage = new VImageStates();
ar >> *m_pImage;
}
ar >> m_Frame;
// item list:
m_Items.SerializeX(ar);
} else
示例6: VASSERT_MSG
inline virtual ~vHavokAiElementManager()
{
VASSERT_MSG(m_iListIndex==VIS_INVALID, "Object may not be deleted. Use DisposeObject instead");
}
示例7: SetDefaultTechnique
void SetDefaultTechnique(VCompiledTechnique *pTechnique)
{
VASSERT_MSG(false, "The terrain sector mesh's default technique shouldn't be used - did you mean use to the technique of one of the sector's pages instead?");
}
示例8: SetVertex
/// \brief
/// Sets a portal vertex with the specified index to the given position.
///
/// May only be called inside a BeginUpdate/EndUpdate block.
///
/// Vertices have to be provided in counter-clockwise order. In order for a portal to be valid,
/// it has to contain at least three non-colinear vertices.
///
/// \param iIndex
/// Vertex index. Has to be inside the range from 0 to the number of vertices reserved with
/// CreateVertices.
///
/// \param vVertex
/// Position of the portal vertex.
inline void SetVertex(int iIndex, const hkvVec3& vVertex)
{
VASSERT_MSG(m_iUpdateCtr>0, "only allowed inside BeginUpdate/EndUpdate block");
VASSERT(iIndex>=0 && iIndex<(int)m_iVertexCount);
m_pVertices[iIndex] = vVertex;
}
示例9: Pop
/// \brief
/// Pops an object from the stack
///
/// \return
/// The object on the top of the stack
T Pop()
{
VASSERT_MSG(m_uiSize > 0,"stack out of bounds");
return m_pData[--m_uiSize];
}
示例10: VASSERT_MSG
VCompiledTechnique *GetDefaultTechnique() const
{
VASSERT_MSG(false, "The terrain sector mesh's default technique shouldn't be used - did you mean use to the technique of one of the sector's pages instead?");
return NULL;
}
示例11: VASSERT
VReadResult_e VisDataHistory_cl<dataType, iHistoryLength, Mix>::Interpolate (dataType* out_pData, __int64 iInterpolationPoint)
{
if (m_iHistoryEntries == 0)
return VRR_None;
__int64 iOldestTime = m_history[m_iHistoryStart].m_iTime;
__int64 iNewestTime = m_history[(m_iHistoryStart + m_iHistoryEntries - 1) % iHistoryLength].m_iTime;
VASSERT (iOldestTime <= iNewestTime);
// 'iInterpolationPoint' is too old, taking earliest known value (extrapolate in the past?)
if (iInterpolationPoint <= iOldestTime)
{
//hkvLog::Info(" oldest = %d, newest = %d, iInterpolationPoint: %d", (int)iOldestTime, (int)iNewestTime, (int)iInterpolationPoint);
*out_pData = m_history[m_iHistoryStart].m_data;
return VRR_Oldest;
}
// 'iInterpolationPoint' is newer than the history, so we have to extrapolate the value
else if (iInterpolationPoint >= iNewestTime)
{
// Taking the last value for the time being
if (m_iHistoryEntries == 1)
{
*out_pData = m_history[(m_iHistoryStart + m_iHistoryEntries - 1) % iHistoryLength].m_data;
return VRR_Extrapolated;
}
//extrapolate to the future
else
{
const VisDataHistoryCell<dataType> ¤t = m_history[(m_iHistoryStart + m_iHistoryEntries - 1) % iHistoryLength];
const VisDataHistoryCell<dataType> &prev = m_history[(m_iHistoryStart + m_iHistoryEntries - 2) % iHistoryLength];
float fDivisor = float(current.m_iTime - prev.m_iTime);
float fStep = float(iInterpolationPoint - current.m_iTime);
//*out_pData = current.m_data + diff * (fStep / fDivisor);
*out_pData = Mix() (prev.m_data, current.m_data, 1.0f + (fStep / fDivisor) );
return VRR_Extrapolated;
}
}
else
{
for (int i = m_iHistoryEntries-1; i > 0; --i)
{
const VisDataHistoryCell<dataType> ¤t = m_history[(m_iHistoryStart + i) % iHistoryLength];
const VisDataHistoryCell<dataType> &prev = m_history[(m_iHistoryStart + i - 1) % iHistoryLength];
VASSERT (prev.m_iTime < current.m_iTime);
if (iInterpolationPoint > prev.m_iTime)
{
float fDivisor = float(current.m_iTime - prev.m_iTime);
float fLerp = float(iInterpolationPoint - prev.m_iTime);
float fLerpFactor = fLerp / fDivisor;
*out_pData = Mix()(current.m_data, prev.m_data, 1.0f - fLerpFactor);
return VRR_Interpolated;
}
else
continue;
}
}
VASSERT_MSG (false, "Unreachable code reached!");
return VRR_None; //impossible to reach
}
示例12: VASSERT_MSG
inline void VGroupInstanceFile::ReadInstance(VGroupInstance &instance)
{
VASSERT_MSG(m_iInstanceCount>0, "read too many instances");
m_iInstanceCount--;
instance.Read(m_pIn,m_eFlags);
}
示例13: CheckFileModified
/// \brief
/// Checks if the resource has been modified.
///
/// The stream manager is used to retrieve the new time stamp.
///
/// For further details on the passed parameters, see VResourceManager::ReloadModifiedResourceFiles.
///
/// \param bUnload
/// If TRUE, the resource will be unloaded in case it has been modified (calls EnsureUnloaded
/// on the resource).
///
/// \param bReload
/// If TRUE, the resource will be reloaded in case it has been modified (calls EnsureLoaded on
/// the resource).
///
/// \return
/// TRUE if the resource has been detected to be modified
inline HKV_DEPRECATED_2013_2 BOOL CheckFileModified(BOOL bUnload, BOOL bReload)
{
VASSERT_MSG(bUnload || bReload, "at least one option has to be set");
return CheckFileModified(bReload ? VURO_COLD_RELOAD : VURO_ONLY_UNLOAD);
}
示例14: SetPriority
/// \brief
/// Sets the priority of the message.
///
/// \param messagePriority
/// Priority of the corresponding message, \sa VMessagePriority_e
///
/// \sa VMessagePriority_e
inline void SetPriority (VMessagePriority_e messagePriority)
{
VASSERT_MSG (messagePriority >= 0 && messagePriority <= VMP_LowPriority, "VMessageSettings::SetPriority: parameter messagePriority out of range!");
m_iPriority = (BYTE)messagePriority;
}
示例15: VASSERT_MSG
bool hkvTextureTransformationSettings::ensureDimensionIntegrity(hkArray<hkvAssetLogMessage>& out_messages)
{
if (m_sourceWidth == 0 || m_sourceHeight == 0)
{
out_messages.pushBack(hkvAssetLogMessage(HKV_MESSAGE_CATEGORY_ASSET_TRANSFORMATION, HKV_MESSAGE_SEVERITY_ERROR, "Size of source texture is invalid; cannot continue!"));
return false;
}
// Perform sanity checks
if (m_validationNeedsPowerOfTwo && m_validationNeedsMultipleOf > 1)
{
if (hkvMath::isPowerOf2(m_validationNeedsMultipleOf))
{
// Both Power-of-Two and Multiple-of restrictions are given. However, multiple-of is a power of two,
// so we can drop the multiple-of constraint as long as we limit the minimum size.
m_validationMinSize = hkvMath::Max(m_validationMinSize, m_validationNeedsMultipleOf);
}
else
{
VASSERT_MSG(false, "Both Power-of-Two and Multiple-of restrictions are specified, but Multiple-of is not a power of two. Ignoring Multiple-of.");
}
m_validationNeedsMultipleOf = 1;
}
if (m_validationNeedsPowerOfTwo)
{
if (m_validationMinSize > 0 && !hkvMath::isPowerOf2(m_validationMinSize))
{
VASSERT_MSG(false, "According to set restrictions, system minimum size needs to be Power-of-Two. Adjusting.");
m_validationMinSize = hkvMath::powerOf2_ceil(m_validationMinSize);
}
if (m_userMinSize > 0)
{
m_userMinSize = adjustToNearestPowerOfTwo(m_userMinSize);
}
if (m_validationMaxSize > 0 && !hkvMath::isPowerOf2(m_validationMaxSize))
{
VASSERT_MSG(false, "According to set restrictions, system maximum size needs to be Power-of-Two. Adjusting.");
m_validationMaxSize = hkvMath::powerOf2_floor(m_validationMaxSize);
}
if (m_userMaxSize > 0)
{
m_userMaxSize = adjustToNearestPowerOfTwo(m_userMaxSize);
}
}
if (m_validationNeedsMultipleOf > 1)
{
if ((m_validationMinSize % m_validationNeedsMultipleOf) != 0)
{
VASSERT_MSG(false, "According to set restrictions, system minimum size needs to be Multiple-of. Adjusting.");
m_validationMinSize = ((m_validationMinSize + m_validationNeedsMultipleOf - 1) / m_validationNeedsMultipleOf) * m_validationNeedsMultipleOf;
}
m_userMinSize = ((m_userMinSize + m_validationNeedsMultipleOf - 1) / m_validationNeedsMultipleOf) * m_validationNeedsMultipleOf;
if (m_validationMaxSize % m_validationNeedsMultipleOf != 0)
{
VASSERT_MSG(false, "According to set restrictions, system maximum size needs to be Multiple-of. Adjusting.");
m_validationMaxSize = (m_validationMaxSize / m_validationNeedsMultipleOf) * m_validationNeedsMultipleOf;
}
m_userMaxSize = (m_userMaxSize / m_validationNeedsMultipleOf) * m_validationNeedsMultipleOf;
}
if ((m_validationMinSize > 0) && (m_validationMaxSize > 0) && (m_validationMaxSize < m_validationMinSize))
{
VASSERT_MSG(false, "System maximum size less than system minimum size; adjusting.");
m_validationMinSize = m_validationMaxSize;
}
if ((m_userMinSize > 0) && (m_userMaxSize > 0) && (m_userMaxSize < m_userMinSize))
{
m_userMinSize = m_userMaxSize;
}
if ((m_validationMinSize > 0) && (m_userMinSize > 0) && (m_userMinSize < m_validationMinSize))
{
m_userMinSize = m_validationMinSize;
}
if ((m_validationMaxSize > 0) && (m_userMaxSize > 0) && (m_userMaxSize > m_validationMaxSize))
{
m_userMaxSize = m_validationMaxSize;
}
return true;
}