本文整理汇总了C++中VERIFY2函数的典型用法代码示例。如果您正苦于以下问题:C++ VERIFY2函数的具体用法?C++ VERIFY2怎么用?C++ VERIFY2使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VERIFY2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _GetItemCount
void CRestrictions::AddRestriction4rank(u32 rank, const shared_str& lst)
{// private
VERIFY (m_bInited);
rank_rest_vec& rest = m_restrictions[rank];
if(rank!=_RANK_COUNT)
{
u32 src_idx = (rank==0)?_RANK_COUNT:(rank-1);
rest = m_restrictions[ src_idx ];
}
string256 singleItem;
u32 count = _GetItemCount(lst.c_str());
for (u32 j = 0; j < count; ++j)
{
_GetItem (lst.c_str(), j, singleItem);
RESTR r = GetRestr(singleItem);
restr_item* ritem = find_restr_item_internal(rank, r.name);
VERIFY2 ((ritem || rank==_RANK_COUNT), singleItem);
if(!ritem)
rest.push_back (mk_pair(r.name, r.n));
else
ritem->second = r.n;
}
}
示例2: dJointGetPositionContact
const dReal* dJointGetPositionContact(dJointID joint)
{
VERIFY2(dJointGetType(joint)==dJointTypeContact,"not a contact!");
dxJointContact* c_joint=(dxJointContact*)joint;
return c_joint->contact.geom.pos;
}
示例3: VERIFY2
void CUITalkWnd::AskQuestion()
{
if(m_bNeedToUpdateQuestions) return;//quick dblclick:(
shared_str phrase_id;
//игрок выбрал тему разговора
if(TopicMode())
{
if ( (UITalkDialogWnd->m_ClickedQuestionID =="") ||
(!m_pOurDialogManager->HaveAvailableDialog(UITalkDialogWnd->m_ClickedQuestionID)) )
{
string128 s;
sprintf_s (s,"ID = [%s] of selected question is out of range of available dialogs ",UITalkDialogWnd->m_ClickedQuestionID);
VERIFY2(FALSE, s);
}
m_pCurrentDialog = m_pOurDialogManager->GetDialogByID( UITalkDialogWnd->m_ClickedQuestionID);
m_pOurDialogManager->InitDialog(m_pOthersDialogManager, m_pCurrentDialog);
phrase_id = "0";
}
else
{
phrase_id = UITalkDialogWnd->m_ClickedQuestionID;
}
SayPhrase (phrase_id);
NeedUpdateQuestions ();
}
示例4: VERIFY
void CUIGameCTA::SetPlayerItemsToBuyMenu()
{
VERIFY(m_pCurBuyMenu);
game_PlayerState* ps = Game().local_player;
VERIFY2(ps, "local player not initialized");
CActor* actor = smart_cast<CActor*> (Level().Objects.net_Find(ps->GameID));
R_ASSERT2(actor || ps->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD),
make_string("bad actor: not found in game (GameID = %d)", ps->GameID).c_str());
if (actor && !ps->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD))
{
auto& inventory = actor->inventory();
u32 max_addammo_count = actor->inventory().m_all.size();
aditional_ammo_t add_ammo(
_alloca(
sizeof(aditional_ammo_t::value_type) * (max_addammo_count * 2)
),
max_addammo_count * 2
);
TryToDefuseAllWeapons(add_ammo);
for (u16 i = inventory.FirstSlot(); i <= inventory.LastSlot(); i++)
BuyMenuItemInserter(inventory.ItemFromSlot(i));
for (auto& item : actor->inventory().m_belt)
BuyMenuItemInserter(item);
for (auto& item : actor->inventory().m_ruck)
BuyMenuItemInserter(item);
for (auto& ammo_item : add_ammo)
AdditionalAmmoInserter(ammo_item);
}
else
{
SetPlayerDefItemsToBuyMenu();
}
}
示例5: VERIFY2
void Property::construct( shared_str const& property_id, Manager& manager_r )
{
m_id._set( property_id );
VERIFY2( pSettings->section_exist( m_id ), make_string( "Section of upgrade property [%s] does not exist!", m_id.c_str() ) );
m_name = CStringTable().translate( pSettings->r_string( id(), "name" ) );
m_icon._set( pSettings->r_string(id(), "icon") );
// functor
LPCSTR functor_str = pSettings->r_string( id(), "functor" );
m_desc.parameter = "";
m_desc.parameter2 = id_str();
R_ASSERT2(
ai().script_engine().functor( functor_str, m_desc.functr ),
make_string( "Failed to get upgrade property functor in section[%s], functor[%s]",
id_str(), functor_str
)
);
m_desc(); // test
LPCSTR funct_params_str = pSettings->r_string( id(), "params" );
PSTR temp = (PSTR)_alloca( (xr_strlen(funct_params_str) + 1) * sizeof(char) );
for ( int n = _GetItemCount( funct_params_str ), i = 0; i < n; ++i )
{
LPCSTR i_param = ( _GetItem( funct_params_str, i, temp ) );
m_functor_params.push_back( i_param );
}
}
示例6: VERIFY2
void UITeamState::Update()
{
if (toDeletePlayers.size())
{
xr_vector<ClientID>::iterator ie = toDeletePlayers.end();
for (xr_vector<ClientID>::iterator i = toDeletePlayers.begin();
i != ie; ++i)
{
MapClientIdToUIPlayer::iterator tempIter = myPlayers.find(*i);
VERIFY2(tempIter != myPlayers.end(), "player not found while deleting");
#ifdef DEBUG
Msg("--- UITeamState: deleting player (ClientID = 0x%08x) from %d team (0x%08x)", i->value(), myTeam, this);
#endif // #ifdef DEBUG
VERIFY(m_scroll_panels.size() > tempIter->second.m_panel_number);
m_scroll_panels[tempIter->second.m_panel_number].first->RemoveWindow(tempIter->second.m_player_wnd);
xr_delete(tempIter->second.m_player_wnd);
myPlayers.erase(tempIter);
}
ReStoreAllPlayers(); //warning ! uses myPlayers
toDeletePlayers.clear();
}
TScrollPanels::iterator ite = m_scroll_panels.end();
for (TScrollPanels::iterator it = m_scroll_panels.begin(); it != ite; ++it)
{
it->first->ForceUpdate();
}
inherited::Update();
}
示例7: VERIFY2
void CUITalkWnd::AskQuestion()
{
if(m_bNeedToUpdateQuestions) return;//quick dblclick:(
int phrase_id;
//игрок выбрал тему разговора
if(TopicMode())
{
if ( (UITalkDialogWnd->m_iClickedQuestion < 0) ||
(UITalkDialogWnd->m_iClickedQuestion >= (int)m_pOurDialogManager->AvailableDialogs().size()) ) {
string128 s;
sprintf (s,"ID = [%i] of selected question is out of range of available dialogs ",UITalkDialogWnd->m_iClickedQuestion);
VERIFY2(FALSE, s);
}
m_pCurrentDialog = m_pOurDialogManager->AvailableDialogs()[UITalkDialogWnd->m_iClickedQuestion];
m_pOurDialogManager->InitDialog(m_pOthersDialogManager, m_pCurrentDialog);
phrase_id = 0;
}
else
{
phrase_id = (int)UITalkDialogWnd->m_iClickedQuestion;
}
SayPhrase(phrase_id);
NeedUpdateQuestions();
}
示例8:
void check_path (const CBaseMonster *monster, const CPatrolPath *path)
{
VERIFY2 (
ai().game_graph().vertex(
path->vertices().begin()->second->data().game_vertex_id()
)->level_id()
==
ai().level_graph().level_id(),
make_string(
"invalid patrol path [%s] as home specified for monster [%s]\nmonster is on level %s\npatrol path is on level %s",
*path->m_name,
*monster->cName(),
*ai().game_graph().header().level(
ai().game_graph().vertex(
monster->ai_location().game_vertex_id()
)->level_id()
).name(),
*ai().game_graph().header().level(
ai().game_graph().vertex(
path->vertices().begin()->second->data().game_vertex_id()
)->level_id()
).name()
)
);
}
示例9: TryToDefuseWeapon
void TryToDefuseWeapon(CWeapon const * weapon,
TIItemContainer const & all_items,
buffer_vector<shared_str> & dest_ammo)
{
if (!weapon)
return;
CWeaponMagazinedWGrenade const * tmp_gl_weapon = smart_cast<CWeaponMagazinedWGrenade const *>(weapon);
if (weapon->IsGrenadeLauncherAttached())
TryToDefuseGrenadeLauncher(tmp_gl_weapon, all_items, dest_ammo);
xr_vector<shared_str> const * tmp_ammo_types = NULL;
u8 const * tmp_ammo_type = NULL;
u16 ammo_elapsed = 0;
if (tmp_gl_weapon && tmp_gl_weapon->m_bGrenadeMode)
{
tmp_ammo_types = &tmp_gl_weapon->m_ammoTypes2;
tmp_ammo_type = &tmp_gl_weapon->m_ammoType2;
ammo_elapsed = (u16)tmp_gl_weapon->m_magazine2.size();
} else
{
tmp_ammo_types = &weapon->m_ammoTypes;
tmp_ammo_type = &weapon->m_ammoType;
ammo_elapsed = (u16)weapon->GetAmmoElapsed();
}
if (tmp_ammo_types->size() <= u32(*tmp_ammo_type))
return;
shared_str ammo_section = (*tmp_ammo_types)[*tmp_ammo_type];
VERIFY2(ammo_section.size(), make_string(
"ammo type of [%s] hasn't section name", weapon->cName().c_str()).c_str());
if (!ammo_section.size())
return;
VERIFY(pSettings->line_exist(ammo_section.c_str(), "box_size"));
u16 ammo_box_size = pSettings->r_u16(ammo_section.c_str(), "box_size");
while (ammo_elapsed >= ammo_box_size)
{
dest_ammo.push_back(ammo_section);
ammo_elapsed = ammo_elapsed - ammo_box_size;
}
if (!ammo_elapsed)
return;
AmmoSearcherPredicate ammo_completitor(ammo_elapsed, ammo_section);
TIItemContainer::const_iterator temp_iter = std::find_if(
all_items.begin(), all_items.end(), ammo_completitor);
if (temp_iter == all_items.end())
return;
CWeaponAmmo* temp_ammo = smart_cast<CWeaponAmmo*>(*temp_iter);
R_ASSERT2(temp_ammo, "failed to create ammo after defusing weapon");
temp_ammo->m_boxCurr = temp_ammo->m_boxSize;
}
示例10: VERIFY
void CHelicopter::startRocket(u16 idx)
{
if((getRocketCount()>=1)&&m_use_rocket_on_attack) {
CExplosiveRocket* pGrenade = smart_cast<CExplosiveRocket*>(getCurrentRocket());
VERIFY(pGrenade);
pGrenade->SetInitiator(this->ID());
Fmatrix rocketXFORM;
(idx==1)?rocketXFORM=m_left_rocket_bone_xform:rocketXFORM=m_right_rocket_bone_xform;
Fvector vel;
Fvector dir;
dir.sub(m_enemy.destEnemyPos, rocketXFORM.c ).normalize_safe();
vel.mul(dir,CRocketLauncher::m_fLaunchSpeed);
Fmatrix xform;
xform.identity();
xform.k.set(dir);
Fvector::generate_orthonormal_basis(xform.k,xform.j,xform.i);
xform.c = rocketXFORM.c;
VERIFY2(_valid(xform),"CHelicopter::startRocket. Invalid xform");
LaunchRocket(xform, vel, zero_vel);
NET_Packet P;
u_EventGen(P,GE_LAUNCH_ROCKET,ID());
P.w_u16(u16( getCurrentRocket()->ID()));
u_EventSend(P);
dropCurrentRocket();
m_last_launched_rocket = idx;
HUD_SOUND_ITEM::PlaySound(m_sndShotRocket, xform.c, this, false);
}
}
示例11:
void CLightShadows::add_element (NODE& N)
{
if (0==current) return;
VERIFY2 (casters.back()->nodes.size()<24,"Object exceeds limit of 24 renderable parts/materials");
if (0==N.pVisual->shader_ref->E[SE_R1_LMODELS]._get()) return;
casters.back()->nodes.push_back (N);
}
示例12: ai
void CSE_SmartCover::check_enterable_loopholes(shared_str const &description)
{
string256 temp;
xr_strcpy (temp, "smart_covers.descriptions.");
xr_strcat (temp, m_description.c_str());
xr_strcat (temp, ".transitions");
luabind::object transitions;
bool result =
ai().script_engine().function_object(
temp,
transitions,
LUA_TTABLE
);
VERIFY2 (result, make_string("bad or missing transitions table in smart_cover [%s]", temp));
luabind::object::iterator I = transitions.begin();
luabind::object::iterator E = transitions.end();
for ( ; I != E; ++I) {
luabind::object table = *I;
if (table.type() != LUA_TTABLE) {
VERIFY (table.type() != LUA_TNIL);
continue;
}
shared_str vertex_0 = smart_cover::parse_vertex(table, "vertex0", true);
if (vertex_0 != smart_cover::transform_vertex("", true))
continue;
set_enterable (smart_cover::parse_vertex(table, "vertex1", false));
}
}
示例13: lua_tostring
bool CScriptStorage::print_output(lua_State *L, LPCSTR caScriptFileName, int iErorCode)
{
if (iErorCode)
print_error (L,iErorCode);
if (!lua_isstring(L,-1))
return (false);
LPCSTR S = lua_tostring(L,-1);
if (!xr_strcmp(S,"cannot resume dead coroutine")) {
VERIFY2 ("Please do not return any values from main!!!",caScriptFileName);
#ifdef USE_DEBUGGER
# ifndef USE_LUA_STUDIO
if(ai().script_engine().debugger() && ai().script_engine().debugger()->Active() ){
ai().script_engine().debugger()->Write(S);
ai().script_engine().debugger()->ErrorBreak();
}
# endif // #ifndef USE_LUA_STUDIO
#endif // #ifdef USE_DEBUGGER
}
else {
if (!iErorCode)
script_log (ScriptStorage::eLuaMessageTypeInfo,"Output from %s",caScriptFileName);
script_log (iErorCode ? ScriptStorage::eLuaMessageTypeError : ScriptStorage::eLuaMessageTypeMessage,"%s",S);
#ifdef USE_DEBUGGER
# ifndef USE_LUA_STUDIO
if (ai().script_engine().debugger() && ai().script_engine().debugger()->Active()) {
ai().script_engine().debugger()->Write (S);
ai().script_engine().debugger()->ErrorBreak ();
}
# endif // #ifndef USE_LUA_STUDIO
#endif // #ifdef USE_DEBUGGER
}
return (true);
}
示例14: make_string
float parse_float (
luabind::object const &table,
LPCSTR identifier,
float const &min_threshold = flt_min,
float const &max_threshold = flt_max
)
{
VERIFY2 (table.type() == LUA_TTABLE, "invalid loophole description passed");
luabind::object lua_result = table[identifier];
VERIFY2 (lua_result.type() != LUA_TNIL, make_string("cannot read number value %s", identifier));
VERIFY2 (lua_result.type() == LUA_TNUMBER, make_string("cannot read number value %s", identifier));
float result = luabind::object_cast<float>(lua_result);
VERIFY2 (result >= min_threshold, make_string("invalid read number value %s", identifier));
VERIFY2 (result <= max_threshold, make_string("invalid number value %s", identifier));
return (result);
}
示例15: VERIFY2
LPCSTR CControlAnimationBase::GetAnimationName(EMotionAnim anim)
{
SAnimItem *item_it = m_anim_storage[anim];
VERIFY2(item_it, make_string("animation not found in m_anim_storage!"));;
return *item_it->target_name;
}