本文整理汇总了C++中R_ASSERT3函数的典型用法代码示例。如果您正苦于以下问题:C++ R_ASSERT3函数的具体用法?C++ R_ASSERT3怎么用?C++ R_ASSERT3使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了R_ASSERT3函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FileDownload
void* FileDownload(LPCSTR file_name, const int& file_handle, u32& file_size)
{
void* buffer = Memory.mem_alloc(
file_size
#ifdef DEBUG_MEMORY_NAME
, "FILE in memory"
#endif // DEBUG_MEMORY_NAME
);
int r_bytes = _read(file_handle, buffer, file_size);
R_ASSERT3(
// !file_size ||
// (r_bytes && (file_size >= (u32)r_bytes)),
file_size == (u32)r_bytes,
"can't read from file : ",
file_name
);
// file_size = r_bytes;
R_ASSERT3(
!_close(file_handle),
"can't close file : ",
file_name
);
return (buffer);
}
示例2: R_ASSERT
//-----------------------------------------------------------------------------
// Environment ambient
//-----------------------------------------------------------------------------
void CEnvAmbient::SSndChannel::load(CInifile& config, LPCSTR sect)
{
m_load_section = sect;
m_sound_dist.x = config.r_float(m_load_section, "min_distance");
m_sound_dist.y = config.r_float(m_load_section, "max_distance");
m_sound_period.x = config.r_s32(m_load_section, "period0");
m_sound_period.y = config.r_s32(m_load_section, "period1");
m_sound_period.z = config.r_s32(m_load_section, "period2");
m_sound_period.w = config.r_s32(m_load_section, "period3");
// m_sound_period = config.r_ivector4(sect,"sound_period");
R_ASSERT(m_sound_period.x <= m_sound_period.y && m_sound_period.z <= m_sound_period.w);
// m_sound_period.mul (1000);// now in ms
// m_sound_dist = config.r_fvector2(sect,"sound_dist");
R_ASSERT2(m_sound_dist.y > m_sound_dist.x, sect);
LPCSTR snds = config.r_string(sect, "sounds");
u32 cnt = _GetItemCount(snds);
string_path tmp;
R_ASSERT3(cnt, "sounds empty", sect);
m_sounds.resize(cnt);
for (u32 k = 0; k < cnt; ++k)
{
_GetItem(snds, k, tmp);
m_sounds[k].create(tmp, st_Effect, sg_SourceType);
}
}
示例3: VERIFY
void
CPhysicsShellHolder::PHLoadState(IReader &P)
{
// Flags8 lflags;
CKinematics* K=smart_cast<CKinematics*>(Visual());
// P.r_u8 (lflags.flags);
if(K)
{
K->LL_SetBonesVisible(P.r_u64());
K->LL_SetBoneRoot(P.r_u16());
}
Fvector min=P.r_vec3();
Fvector max=P.r_vec3();
VERIFY(!min.similar(max));
u16 bones_number=P.r_u16();
R_ASSERT3(bones_number <= 64, "CPhysicsShellHolder::PHLoadState", cNameVisual().c_str());
for(u16 i=0;i<bones_number;i++)
{
SPHNetState state;
state.net_Load(P,min,max);
PHGetSyncItem(i)->set_State(state);
}
}
示例4: CLSID2TEXT
u32 CGameObject::ef_weapon_type () const
{
string16 temp; CLSID2TEXT(CLS_ID,temp);
R_ASSERT3 (false,"Invalid weapon type request, virtual function is not properly overridden!",temp);
return (u32(-1));
// return (u32(0));
}
示例5: Msg
void CEnvironment::SetWeather(shared_str name, bool forced)
{
//. static BOOL bAlready = FALSE;
//. if(bAlready) return;
if (name.size()) {
//. bAlready = TRUE;
EnvsMapIt it = WeatherCycles.find(name);
if (it == WeatherCycles.end())
{
Msg("! Invalid weather name: %s", name.c_str());
return;
}
R_ASSERT3 (it!=WeatherCycles.end(),"Invalid weather name.",*name);
CurrentCycleName = it->first;
if (forced) {Invalidate(); }
if (!bWFX){
CurrentWeather = &it->second;
CurrentWeatherName = it->first;
}
if (forced) {SelectEnvs(fGameTime); }
#ifdef WEATHER_LOGGING
Msg ("Starting Cycle: %s [%s]",*name,forced?"forced":"deferred");
#endif
}else{
#ifndef _EDITOR
FATAL ("! Empty weather name");
#endif
}
}
示例6:
void CUIEventsWnd::Init ()
{
CUIXml uiXml;
bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, "pda_events.xml");
R_ASSERT3 (xml_result, "xml file not found", "pda_events.xml");
CUIXmlInit xml_init;
xml_init.InitWindow (uiXml, "main_wnd", 0, this);
m_UILeftFrame = xr_new<CUIFrameWindow>(); m_UILeftFrame->SetAutoDelete(true);
AttachChild (m_UILeftFrame);
xml_init.InitFrameWindow (uiXml, "main_wnd:left_frame", 0, m_UILeftFrame);
m_UILeftHeader = xr_new<CUIFrameLineWnd>(); m_UILeftHeader->SetAutoDelete(true);
m_UILeftFrame->AttachChild (m_UILeftHeader);
xml_init.InitFrameLine (uiXml, "main_wnd:left_frame:left_frame_header", 0, m_UILeftHeader);
//. xml_init.InitAutoStaticGroup (uiXml, "main_wnd:left_frame",m_UILeftFrame);
m_UIAnimation = xr_new<CUIAnimatedStatic>(); m_UIAnimation->SetAutoDelete(true);
xml_init.InitAnimatedStatic (uiXml, "main_wnd:left_frame:left_frame_header:anim_static", 0, m_UIAnimation);
m_UILeftHeader->AttachChild (m_UIAnimation);
m_UIRightWnd = xr_new<CUIWindow>(); m_UIRightWnd->SetAutoDelete(true);
AttachChild (m_UIRightWnd);
xml_init.InitWindow (uiXml, "main_wnd:right_frame", 0, m_UIRightWnd);
m_UIMapWnd = xr_new<CUIMapWnd>(); m_UIMapWnd->SetAutoDelete(false);
m_UIMapWnd->Init ("pda_events.xml","main_wnd:right_frame:map_wnd");
m_UITaskInfoWnd = xr_new<CUITaskDescrWnd>(); m_UITaskInfoWnd->SetAutoDelete(false);
m_UITaskInfoWnd->Init (&uiXml,"main_wnd:right_frame:task_descr_view");
m_ListWnd = xr_new<CUIScrollView>(); m_ListWnd->SetAutoDelete(true);
m_UILeftFrame->AttachChild (m_ListWnd);
xml_init.InitScrollView (uiXml, "main_wnd:left_frame:list", 0, m_ListWnd);
m_TaskFilter = xr_new<CUITabControl>(); m_TaskFilter->SetAutoDelete(true);
m_UILeftFrame->AttachChild (m_TaskFilter);
xml_init.InitTabControl (uiXml, "main_wnd:left_frame:filter_tab", 0, m_TaskFilter);
m_TaskFilter->SetWindowName ("filter_tab");
Register (m_TaskFilter);
AddCallback ("filter_tab",TAB_CHANGED,CUIWndCallback::void_function(this,&CUIEventsWnd::OnFilterChanged));
/*
m_primary_or_all_filter_btn = xr_new<CUI3tButton>(); m_primary_or_all_filter_btn->SetAutoDelete(true);
m_UILeftFrame->AttachChild (m_primary_or_all_filter_btn);
xml_init.Init3tButton (uiXml, "main_wnd:left_frame:primary_or_all", 0, m_primary_or_all_filter_btn);
Register (m_primary_or_all_filter_btn);
m_primary_or_all_filter_btn-> SetWindowName("btn_primary_or_all");
AddCallback ("btn_primary_or_all",BUTTON_CLICKED,boost::bind(&CUIEventsWnd::OnFilterChanged,this,_1,_2));
*/
m_currFilter = eActiveTask;
SetDescriptionMode (true);
m_ui_task_item_xml.Init (CONFIG_PATH, UI_PATH, "job_item.xml");
}
示例7:
void CALifeSpawnRegistry::load (IReader &file_stream, LPCSTR game_name)
{
R_ASSERT (FS.exist(game_name));
IReader *chunk, *chunk0;
Msg ("* Loading spawn registry...");
R_ASSERT2 (file_stream.find_chunk(SPAWN_CHUNK_DATA),"Cannot find chunk SPAWN_CHUNK_DATA!");
chunk0 = file_stream.open_chunk(SPAWN_CHUNK_DATA);
xrGUID guid;
chunk = chunk0->open_chunk(0);
VERIFY (chunk);
chunk->r_stringZ (m_spawn_name);
chunk->r (&guid,sizeof(guid));
chunk->close ();
string_path file_name;
bool file_exists = !!FS.exist(file_name, "$game_spawn$", *m_spawn_name, ".spawn");
R_ASSERT3 (file_exists,"Can't find spawn file:",*m_spawn_name);
VERIFY (!m_file);
m_file = FS.r_open(file_name);
load (*m_file,&guid);
chunk0->close ();
}
示例8: create_object
void CLevelSpawnConstructor::load_objects ()
{
// loading spawn points
string_path file_name;
FS.update_path (file_name,"$game_levels$",*m_level.name());
strcat_s (file_name,"\\level.spawn");
IReader *level_spawn = FS.r_open(file_name);
u32 id;
IReader *chunk = level_spawn->open_chunk_iterator(id);
for ( ; chunk; chunk = level_spawn->open_chunk_iterator(id,chunk)) {
CSE_Abstract *abstract = create_object(chunk);
if (abstract->m_tClassID == CLSID_AI_GRAPH) {
add_graph_point (abstract);
continue;
}
// if (abstract->m_tClassID == CLSID_AI_SPAWN_GROUP) {
// add_spawn_group (abstract);
// continue;
// }
if (!abstract->m_gameType.MatchType(eGameIDSingle))
{
F_entity_Destroy (abstract);
continue;
}
CSE_ALifeObject *alife_object = smart_cast<CSE_ALifeObject*>(abstract);
if (!alife_object) {
F_entity_Destroy (abstract);
continue;
}
CSE_ALifeCreatureActor *actor = smart_cast<CSE_ALifeCreatureActor*>(alife_object);
if (actor) {
R_ASSERT3 (!m_actor,"Too many actors on the level ",*m_level.name());
m_actor = actor;
}
m_spawns.push_back (alife_object);
CSE_ALifeDynamicObject *dynamic_object = smart_cast<CSE_ALifeDynamicObject*>(alife_object);
if (dynamic_object) {
add_story_object (dynamic_object);
add_space_restrictor(dynamic_object);
}
if (smart_cast<CSE_ALifeLevelChanger*>(abstract))
add_level_changer (abstract);
// if (xr_strlen(alife_object->m_spawn_control))
// add_group_object (alife_object,alife_object->m_spawn_control);
add_free_object (alife_object);
}
FS.r_close (level_spawn);
R_ASSERT2 (!m_spawns.empty(),"There are no spawn-points!");
}
示例9: R_ASSERT3
void CParticlesPlayer::LoadParticles(CKinematics* K)
{
VERIFY (K);
m_Bones.clear();
//считать список косточек и соответствующих
//офсетов куда можно вешать партиклы
CInifile* ini = K->LL_UserData();
if(ini&&ini->section_exist("particle_bones")) {
bone_mask = 0;
CInifile::Sect& data = ini->r_section("particle_bones");
for (CInifile::SectIt I=data.begin(); I!=data.end(); I++) {
CInifile::Item& item = *I;
u16 index = K->LL_BoneID(*item.first);
R_ASSERT3(index != BI_NONE, "Particles bone not found", *item.first);
Fvector offs;
sscanf (*item.second,"%f,%f,%f",&offs.x,&offs.y,&offs.z);
m_Bones.push_back (SBoneInfo(index,offs));
bone_mask |= u64(1)<<u64(index);
}
}
if(m_Bones.empty())
{
bone_mask = u64(1)<<u64(0);
m_Bones.push_back (SBoneInfo(K->LL_GetBoneRoot(),Fvector().set(0,0,0)));
}
}
示例10: u16
void CSE_Abstract::Spawn_Write (NET_Packet &tNetPacket, BOOL bLocal)
{
// generic
tNetPacket.w_begin (M_SPAWN);
tNetPacket.w_stringZ (s_name );
tNetPacket.w_stringZ (s_name_replace ? s_name_replace : "");
tNetPacket.w_u8 (0);
tNetPacket.w_u8 (s_RP );
tNetPacket.w_vec3 (o_Position );
tNetPacket.w_vec3 (o_Angle );
tNetPacket.w_u16 (RespawnTime );
tNetPacket.w_u16 (ID );
tNetPacket.w_u16 (ID_Parent );
tNetPacket.w_u16 (ID_Phantom );
s_flags.set (M_SPAWN_VERSION,TRUE);
if (bLocal)
tNetPacket.w_u16 (u16(s_flags.flags|M_SPAWN_OBJECT_LOCAL) );
else
tNetPacket.w_u16 (u16(s_flags.flags&~(M_SPAWN_OBJECT_LOCAL|M_SPAWN_OBJECT_ASPLAYER)));
tNetPacket.w_u16 (SPAWN_VERSION);
tNetPacket.w_u16 (m_gameType.m_GameType.get());
tNetPacket.w_u16 (script_server_object_version());
//client object custom data serialization SAVE
u16 client_data_size = (u16)client_data.size(); //не может быть больше 256 байт
tNetPacket.w_u16 (client_data_size);
// Msg ("SERVER:saving:save:%d bytes:%d:%s",client_data_size,ID,s_name_replace ? s_name_replace : "");
if (client_data_size > 0) {
tNetPacket.w (&*client_data.begin(),client_data_size);
}
tNetPacket.w_u16 (m_tSpawnID);
// tNetPacket.w_float (m_spawn_probability);
// tNetPacket.w_u32 (m_spawn_flags.get());
// tNetPacket.w_stringZ (m_spawn_control);
// tNetPacket.w_u32 (m_max_spawn_count);
// tNetPacket.w_u64 (m_min_spawn_interval);
// tNetPacket.w_u64 (m_max_spawn_interval);
#ifdef XRSE_FACTORY_EXPORTS
CScriptValueContainer::assign();
#endif
// write specific data
u32 position = tNetPacket.w_tell();
tNetPacket.w_u16 (0);
STATE_Write (tNetPacket);
u16 size = u16(tNetPacket.w_tell() - position);
//#ifdef XRSE_FACTORY_EXPORTS
R_ASSERT3 ((m_tClassID == CLSID_SPECTATOR) || (size > sizeof(size)),
"object isn't successfully saved, get your backup :(",name_replace());
//#endif
tNetPacket.w_seek (position,&size,sizeof(u16));
}
示例11: R_ASSERT3
void CUITextureMaster::GetTextureShader(LPCSTR texture_name, ref_shader& sh){
xr_map<shared_str, TEX_INFO>::iterator it;
it = m_textures.find(texture_name);
R_ASSERT3(it != m_textures.end(), "can't find texture", texture_name);
sh.create("hud\\default", *((*it).second.file));
}
示例12: CreateFile
CVirtualFileReader::CVirtualFileReader(const char* cFileName)
{
// Open the file
hSrcFile = CreateFile(cFileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
R_ASSERT3(hSrcFile != INVALID_HANDLE_VALUE, cFileName, Debug.error2string(GetLastError()));
Size = (int)GetFileSize(hSrcFile, NULL);
R_ASSERT3(Size, cFileName, Debug.error2string(GetLastError()));
hSrcMap = CreateFileMapping(hSrcFile, 0, PAGE_READONLY, 0, 0, 0);
R_ASSERT3(hSrcMap != INVALID_HANDLE_VALUE, cFileName, Debug.error2string(GetLastError()));
data = (char*)MapViewOfFile(hSrcMap, FILE_MAP_READ, 0, 0, 0);
R_ASSERT3(data, cFileName, Debug.error2string(GetLastError()));
#ifdef FS_DEBUG
register_file_mapping(data, Size, cFileName);
#endif // DEBUG
}
示例13: return
float CUITextureMaster::GetTextureWidth(const char* texture_name){
xr_map<shared_str, TEX_INFO>::iterator it;
it = m_textures.find(texture_name);
if (it != m_textures.end())
return (*it).second.rect.width();
R_ASSERT3(false,"CUITextureMaster::GetTextureHeight Can't find texture", texture_name);
return 0;
}
示例14: CreateFile
CVirtualFileRW::CVirtualFileRW(const char *cFileName)
{
// Open the file
hSrcFile = CreateFile(cFileName, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
R_ASSERT3 (hSrcFile!=INVALID_HANDLE_VALUE,cFileName,xrDebug::ErrorToString(GetLastError()));
Size = (int)GetFileSize(hSrcFile, NULL);
R_ASSERT3 (Size,cFileName,xrDebug::ErrorToString(GetLastError()));
hSrcMap = CreateFileMapping (hSrcFile, 0, PAGE_READWRITE, 0, 0, 0);
R_ASSERT3 (hSrcMap!=INVALID_HANDLE_VALUE,cFileName,xrDebug::ErrorToString(GetLastError()));
data = (char*)MapViewOfFile (hSrcMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);
R_ASSERT3 (data,cFileName,xrDebug::ErrorToString(GetLastError()));
#ifdef DEBUG
register_file_mapping (data,Size,cFileName);
#endif // DEBUG
}
示例15: InitWpnSectStorage
void CUIBagWnd::InitWpnSectStorage()
{
WPN_SECT_NAMES wpnOneType;
string64 wpnSection;
string1024 wpnNames, wpnSingleName;
// Поле strSectionName должно содержать имя секции
R_ASSERT (m_sectionName != "");
R_ASSERT3 (pSettings->section_exist(m_sectionName), "Section doesn't exist", m_sectionName.c_str());
for (int i = 1; i < 20; ++i)
{
// Очищаем буфер
wpnOneType.clear();
// Имя поля
sprintf_s (wpnSection, "slot%i", i);
if (!pSettings->line_exist(m_sectionName, wpnSection))
{
m_wpnSectStorage.push_back(wpnOneType);
continue;
}
strcpy (wpnNames, pSettings->r_string(m_sectionName, wpnSection));
u32 count = _GetItemCount(wpnNames);
for (u32 j = 0; j < count; ++j)
{
_GetItem (wpnNames, j, wpnSingleName);
wpnOneType.push_back (wpnSingleName);
}
if (!wpnOneType.empty()){
m_wpnSectStorage.push_back(wpnOneType);
}
}
wpnOneType.clear();
CInifile::Sect § = pSettings->r_section(m_sectionPrice.c_str());
for (CInifile::SectCIt it = sect.Data.begin(); it != sect.Data.end(); it++)
{
u8 group_id, index;
GetWeaponIndexByName((*it).first.c_str(), group_id, index);
if ((u8)(-1) == group_id || (u8)(-1) == index) // item not found
{
wpnOneType.push_back((*it).first.c_str()); //
}
}
if (!wpnOneType.empty()){
m_wpnSectStorage.push_back(wpnOneType);
}
}