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;
	}
}
Esempio n. 2
0
const dReal* dJointGetPositionContact(dJointID joint)
{
	VERIFY2(dJointGetType(joint)==dJointTypeContact,"not a contact!");
	dxJointContact* c_joint=(dxJointContact*)joint;
	return c_joint->contact.geom.pos;

}
Esempio n. 3
0
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		();
}
Esempio n. 4
0
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();
    }
}
Esempio n. 5
0
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 );
	}

}
Esempio n. 6
0
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();
}
Esempio n. 7
0
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();
}
Esempio n. 8
0
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()
		)
	);
}
Esempio n. 9
0
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;
}
Esempio n. 10
0
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);

	}
}
Esempio n. 11
0
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);
}
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));
	}
}
BOOL is_combat_cover			(shared_str const &table_id)
{
	if (table_id.size() == 0)
		return					(FALSE);

	string256					temp;
	xr_strcpy					(temp, "smart_covers.descriptions.");
	xr_strcat					(temp, *table_id);

	luabind::object				table, value;
	bool						result = 
		ai().script_engine().function_object(
		temp,
		table,
		LUA_TTABLE
		);

	VERIFY2						(result, make_string("bad or missing description in smart_cover [%s]", table_id.c_str()));
	if (table.type() != LUA_TTABLE) {
		VERIFY					(table.type() != LUA_TNIL);
		return					(TRUE);
	}

	value						= table["is_combat_cover"];
	if (value.type() == LUA_TNIL) {
		Msg						("! is_combat_cover flag not found for smart_cover [%s], forcing to \"true\"", table_id.c_str());
		return					(TRUE);
	}

	return						(parse_bool(table, "is_combat_cover") ? TRUE : FALSE);
}
Esempio n. 14
0
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);
}
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);
}
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;
}
Esempio n. 17
0
bool UITeamState::UpdatePlayer(ClientID const & clientId)
{
	bool retVal = false;
	MapClientIdToUIPlayer::iterator tempIter = myPlayers.find(clientId);
	if (tempIter != myPlayers.end())
	{
		retVal = true;
		game_cl_GameState::PLAYERS_MAP & playersMap = Game().players;
		game_cl_GameState::PLAYERS_MAP::iterator pi = playersMap.find(clientId);
		VERIFY2(pi != playersMap.end(), "player not found in Game().player list, but in UI list it exist");
		game_PlayerState *ps = pi->second;
		// it can be NULL... and player will be removed by player item window
		VERIFY(ps);
		/*if (!ps)
		{
			Msg("--- Player state of ClientID = 0x%08x is NULL", clientId.value());
			return true;
		}*/
		if (Game().IsPlayerInTeam(ps, myTeam) == false)
		{
			RemovePlayer(clientId);
			retVal = false;	//tricky step :) player will be added by UITeamPanels::UpdatePlayer method :)
		}
		// warning ! after this Update tempIter will be not valid !!!
		Update();
		// --^
	}
	return retVal;
}
Esempio n. 18
0
void CPHCollisionDamageReceiver::CollisionCallback(bool& do_colide,bool bo1,dContact& c,SGameMtl* material_1,SGameMtl* material_2)
{
	if(material_1->Flags.test(SGameMtl::flPassable)||material_2->Flags.test(SGameMtl::flPassable))return;
	dBodyID						b1					=	dGeomGetBody(c.geom.g1)	;
	dBodyID						b2					=	dGeomGetBody(c.geom.g2) ;
	dxGeomUserData				*ud_self			=	bo1 ? retrieveGeomUserData(c.geom.g1):retrieveGeomUserData(c.geom.g2);
	dxGeomUserData				*ud_damager			=	bo1 ? retrieveGeomUserData(c.geom.g2):retrieveGeomUserData(c.geom.g1);
	
	SGameMtl					*material_self		=	bo1 ? material_1:material_2;
	SGameMtl					*material_damager	=	bo1 ? material_2:material_1;
	VERIFY						(ud_self);
	CPhysicsShellHolder			*o_self			=	ud_self->ph_ref_object;
	CPhysicsShellHolder			*o_damager		=	NULL;if(ud_damager)o_damager=ud_damager->ph_ref_object;
	u16							source_id		=	o_damager ? o_damager->ID():u16(-1);
	CPHCollisionDamageReceiver	*dr	=o_self->PHCollisionDamageReceiver();
	VERIFY2(dr,"wrong callback");
	
	float damager_material_factor=material_damager->fBounceDamageFactor;

	if(ud_damager&&ud_damager->ph_object&&ud_damager->ph_object->CastType()==CPHObject::tpCharacter)
	{
		CCharacterPhysicsSupport* phs=o_damager->character_physics_support();
		if(phs->IsSpecificDamager())damager_material_factor=phs->BonceDamageFactor();
	}

	float dfs=(material_self->fBounceDamageFactor+damager_material_factor);
	if(fis_zero(dfs)) return;
	Fvector dir;dir.set(*(Fvector*)c.geom.normal);
	Fvector pos;
	pos.sub(*(Fvector*)c.geom.pos,*(Fvector*)dGeomGetPosition(bo1 ? c.geom.g1:c.geom.g2));//it is not true pos in bone space
	dr->Hit(source_id,ud_self->bone_id,E_NL(b1,b2,c.geom.normal)*damager_material_factor/dfs,dir,pos);
	
}
bool CSE_ALifeMonsterAbstract::redundant				() const
{
	if (g_Alive())
		return					(false);

	if (m_bOnline)
		return					(false);

	if (m_story_id != INVALID_STORY_ID)
		return					(false);

	if (!m_game_death_time)
		return					(false);

	ALife::_TIME_ID				current_time = alife().time_manager().game_time();
	VERIFY2						(
		m_game_death_time <= current_time,
		make_string(
			"incorrect death time for monster %s[death time = %I64d][current time = %I64d]",
			name_replace(),
			m_game_death_time,
			current_time
		)
	);
	if ((m_game_death_time + m_stay_after_death_time_interval) > current_time)
		return					(false);

	return						(true);
}
void game_cl_CaptureTheArtefact::OnBuyMenu_Ok()
{
#ifdef DEBUG
	Msg("* CTA: Buy menu OK...");
#endif // #ifdef DEBUG
	typedef CUIGameCTA::BuyMenuItemsCollection TBuyCol;

	VERIFY2(m_game_ui, "game ui not initialized");
	CUIGameCTA::BuyMenuItemsCollection toBuyItemsCollection;
	s32 moneyDif = 0;
	m_game_ui->GetPurchaseItems(toBuyItemsCollection, moneyDif);
	R_ASSERT(local_player);
	if (local_player->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD))
	{
		if (InWarmUp())
		{
			buy_amount =  0;
		} else 
		{
			buy_amount = moneyDif;
		}
		UpdateMoneyIndicator();
	}
	
	
	CGameObject* pPlayer = smart_cast<CGameObject*>(Level().CurrentEntity());
	VERIFY(pPlayer);
	
	NET_Packet P;
	pPlayer->u_EventGen(P, GE_GAME_EVENT, pPlayer->ID());
	P.w_u16(GAME_EVENT_PLAYER_BUY_FINISHED);
	if (InWarmUp())
	{
		P.w_s32(0);
	} else
	{
		P.w_s32(moneyDif);
	}
	P.w_u16(static_cast<u16>(toBuyItemsCollection.size()));

	TBuyCol::const_iterator bie = toBuyItemsCollection.end();
	
	for (TBuyCol::const_iterator toBuyIter = toBuyItemsCollection.begin();
		toBuyIter != bie; ++toBuyIter)
	{
		P.w_u8(toBuyIter->first);
		P.w_u8(toBuyIter->second);
	}

	pPlayer->u_EventSend(P);
	
	if (local_player->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD))
	{
		u_EventGen(P, GE_GAME_EVENT, local_player->GameID);
		P.w_u16(GAME_EVENT_PLAYER_BUYMENU_CLOSE);
		u_EventSend(P);
	}
	set_buy_menu_not_ready();
}
Esempio n. 21
0
void CZoneEffector::Load(LPCSTR section)
{
	VERIFY2(pSettings->line_exist(section,"ppe_file"), section);
	m_pp_fname				= pSettings->r_string(section,"ppe_file");
	r_min_perc				= pSettings->r_float(section,"radius_min");
	r_max_perc				= pSettings->r_float(section,"radius_max");
	VERIFY					(r_min_perc <= r_max_perc);
}
Esempio n. 22
0
void CTeleWhirlwind::draw_out_impact(Fvector& dir,float& val)
{
	VERIFY2(m_saved_impacts.size(),"NO IMPACTS ADDED!");
	dir.set(m_saved_impacts[0].force);
	val=dir.magnitude();
	if(!fis_zero(val))dir.mul(1.f/val);
	m_saved_impacts.erase(m_saved_impacts.begin());
}
void CSpaceRestrictionComposition::check_restrictor_type()
{
	if (_GetItemCount(*m_space_restrictors) == 1)
		return;

	if (!ai().get_alife())
		return;

	CObject							*object = Level().Objects.FindObjectByName(m_space_restrictors);
	if (!object)
		return;

	CSpaceRestrictor				*restrictor = smart_cast<CSpaceRestrictor*>(object);
	VERIFY3							(restrictor,"you are trying to use object as a restrictor",*m_space_restrictors);
	VERIFY2							(restrictor->restrictor_type() == RestrictionSpace::eRestrictorTypeNone,"you are trying to restrict yourself with restrictor with type eRestrictorTypeNone");
	VERIFY2							(restrictor->restrictor_type() != RestrictionSpace::eRestrictorTypeNone,"impossible situation: wrong net_Spawn branch used");
}
Esempio n. 24
0
int __fastcall TfrmChoseItem::SelectItem(u32 choose_ID, LPCSTR& dest, int sel_cnt, LPCSTR init_name, TOnChooseFillItems item_fill, void* fill_param, TOnChooseSelectItem item_select, ChooseItemVec* items, u32 mask)
{
	VERIFY(!form);
	form 							= xr_new<TfrmChoseItem>((TComponent*)0);
    form->m_Flags.assign			(mask);
    form->m_Flags.set				(cfMultiSelect,sel_cnt>1);
    form->iMultiSelLimit 			= sel_cnt;

	// init
//.	if (init_name&&init_name[0]) 
    	m_LastSelection 			= init_name;
    form->tvItems->Selected 		= 0;

    // fill items
    if (items){
    	VERIFY2(item_fill.empty(),"ChooseForm: Duplicate source.");
    	form->m_Items				= *items;
        form->E.Set					("Select Item",0,item_select,0,0,0);
    }else if (!item_fill.empty()){
    	// custom
        form->E.Set					("Select Item",item_fill,item_select,0,0,0);
    }else{
    	SChooseEvents* e			= GetEvents(choose_ID); VERIFY2(e,"Can't find choose event.");
    	form->E						= *e;
    }
	// set & fill
    form->Caption					= form->E.caption.c_str();

    if (!form->E.on_fill.empty())	
    	form->E.on_fill(form->m_Items,fill_param);
    
    form->FillItems					(choose_ID);
    
//.	form->paItemsCount->Caption		= AnsiString(" Items in list: ")+AnsiString(form->tvItems->Items->Count);

	// show
    bool bRes 						= (form->ShowModal()==mrOk);
    dest							= 0;
    if (bRes){
		int item_cnt				= _GetItemCount(select_item.c_str(),',');
    	dest 						= (select_item==NONE_CAPTION)?0:select_item.c_str();
	    m_LastSelection				= select_item;
        return 						item_cnt?item_cnt:1;
    }
    return 0;
}
Esempio n. 25
0
void CPHObject::deactivate()
{
	if(!m_flags.test(st_activated))return;
	VERIFY2(m_island.IsActive(),"can not do it during processing");
	ph_world->RemoveObject(PH_OBJECT_I(this));
	vis_update_deactivate();
	m_flags.set(st_activated,FALSE);
}
CSE_ALifeDynamicObject *CSE_ALifeAnomalousZone::tpfGetBestDetector()
{
	VERIFY2						(false,"This function shouldn't be called");
	NODEFAULT;
#ifdef DEBUG
	return						(0);
#endif
}
EPState	CControlAnimationBase::GetState (EMotionAnim a)
{
	// найти анимацию 
	SAnimItem *item_it = m_anim_storage[a];
	VERIFY2(item_it, make_string("animation not found in m_anim_storage!"));

	return item_it->pos_state;
}
Esempio n. 28
0
void CWeaponMagazined::switch2_Fire	()
{
	CInventoryOwner* io		= smart_cast<CInventoryOwner*>(H_Parent());
	CInventoryItem* ii		= smart_cast<CInventoryItem*>(this);
#ifdef DEBUG
	VERIFY2					(io,make_string("no inventory owner, item %s",*cName()));

	if (ii != io->inventory().ActiveItem())
		Msg					("! not an active item, item %s, owner %s, active item %s",*cName(),*H_Parent()->cName(),io->inventory().ActiveItem() ? *io->inventory().ActiveItem()->object().cName() : "no_active_item");

	if ( !(io && (ii == io->inventory().ActiveItem())) ) 
	{
		CAI_Stalker			*stalker = smart_cast<CAI_Stalker*>(H_Parent());
		if (stalker) {
			stalker->planner().show						();
			stalker->planner().show_current_world_state	();
			stalker->planner().show_target_world_state	();
		}
	}
#else
	if (!io)
		return;
#endif // DEBUG

	VERIFY2(
		io && (ii == io->inventory().ActiveItem()),
		make_string(
			"item[%s], parent[%s]",
			*cName(),
			H_Parent() ? *H_Parent()->cName() : "no_parent"
		)
	);

	m_bStopedAfterQueueFired = false;
	m_bFireSingleShot = true;
	m_iShotNum = 0;

    if((OnClient() || Level().IsDemoPlay())&& !IsWorking())
		FireStart();

/*	if(SingleShotMode())
	{
		m_bFireSingleShot = true;
		bWorking = false;
	}*/
}
bool CControlAnimationBase::IsStandCurAnim()
{
	SAnimItem *item_it = m_anim_storage[cur_anim_info().get_motion()];
	VERIFY2(item_it, make_string("animation not found in m_anim_storage!"));;

	if (fis_zero(item_it->velocity.velocity.linear)) return true;
	return false;
}
void xrServer::PerformSecretKeysSyncAck(xrClientData* xrCL, NET_Packet & P)
{
	VERIFY(xrCL);
	s32 new_seed;
	P.r_s32(new_seed);//only for DEBUG
	VERIFY2(new_seed == xrCL->m_last_key_sync_request_seed, "cracker detected !");
	secure_messaging::generate_key(xrCL->m_last_key_sync_request_seed, xrCL->m_secret_key);
}