Example #1
0
LRESULT CVariablePage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	ATLASSERT(m_piCurrentClass);
	START_PROFILE(VarInit);
	CreateControls();
	
	m_DDXManager.SetGlobalParams(m_hWnd, m_pModifications, m_pResManager);

	CRect r;
	m_Variables.GetClientRect(r);
	m_Variables.InsertColumn(0, _T("ID"), LVCFMT_LEFT, m_WindowSettings.m_VariableWidth, 0);
	m_Variables.InsertColumn(1, _T("Variable"), LVCFMT_LEFT, r.Width() - m_WindowSettings.m_VariableWidth - 5, 1);
	m_Variables.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
	START_PROFILE(VarDlg);
	for (size_t i = 0; i < m_pClassVector->GetCount(); i++)
	{
		VSClass* pCurClass = (*m_pClassVector)[i];
		if (!m_bOnlyDlgs ||
			(pCurClass->IsDialog() && !(pCurClass->m_DialogID.IsEmpty())))
		{
			int iItem = m_Classes.AddString(pCurClass->Name);
			m_Classes.SetItemData(iItem, i);
		}

	}
	END_PROFILE(VarDlg, _T("CVariablePage::OnInitDialog check dialog classes"));
	m_Classes.SetCurSel(0);
	m_ToolbarImgList.CreateFromImage(IDB_BITMAP_DDX, 18, 1, RGB(197, 200,201), IMAGE_BITMAP, LR_CREATEDIBSECTION);
	InitToolTip();
	END_PROFILE(VarInit, _T("CVariablePage::OnInitDialog"));

	return 0;
}
static void
ReOneStep(double deltaTimeIncrement)
{
	int i;
	tRobotItf *robot;
	tSituation *s = ReInfo->s;

	if (floor(s->currentTime) == -2.0) {
		ReRaceBigMsgSet("Ready", 1.0);
	} else if (floor(s->currentTime) == -1.0) {
		ReRaceBigMsgSet("Set", 1.0);
	} else if (floor(s->currentTime) == 0.0) {
		ReRaceBigMsgSet("Go", 1.0);
	}

	ReInfo->_reCurTime += deltaTimeIncrement * ReInfo->_reTimeMult; /* "Real" time */
	s->currentTime += deltaTimeIncrement; /* Simulated time */

	if (s->currentTime < 0) {
		/* no simu yet */
		ReInfo->s->_raceState = RM_RACE_PRESTART;
	} else if (ReInfo->s->_raceState == RM_RACE_PRESTART) {
		ReInfo->s->_raceState = RM_RACE_RUNNING;
		s->currentTime = 0.0; /* resynchronize */
		ReInfo->_reLastTime = 0.0;
	}

	START_PROFILE("rbDrive*");
	if ((s->currentTime - ReInfo->_reLastTime) >= RCM_MAX_DT_ROBOTS) {
		s->deltaTime = s->currentTime - ReInfo->_reLastTime;
		for (i = 0; i < s->_ncars; i++) {
			if ((s->cars[i]->_state & RM_CAR_STATE_NO_SIMU) == 0) {
				robot = s->cars[i]->robot;
				robot->rbDrive(robot->index, s->cars[i], s);
			}
		}
		ReInfo->_reLastTime = s->currentTime;
	}
	STOP_PROFILE("rbDrive*");

	START_PROFILE("_reSimItf.update*");
	ReInfo->_reSimItf.update(s, deltaTimeIncrement, -1);
	for (i = 0; i < s->_ncars; i++) {
		ReManage(s->cars[i]);
	}
	STOP_PROFILE("_reSimItf.update*");

	ReRaceMsgUpdate();
	ReSortCars();
}
int
ReUpdate(void)
{
    double 		t;
    tRmMovieCapture	*capture;
    

    START_PROFILE("ReUpdate");
    ReInfo->_refreshDisplay = 0;
    switch (ReInfo->_displayMode) {
    case RM_DISP_MODE_NORMAL:
	t = GfTimeClock();

	START_PROFILE("ReOneStep*");
	while (ReInfo->_reRunning && ((t - ReInfo->_reCurTime) > RCM_MAX_DT_SIMU)) {
	    ReOneStep(RCM_MAX_DT_SIMU);
	}
	STOP_PROFILE("ReOneStep*");

	GfuiDisplay();
	ReInfo->_reGraphicItf.refresh(ReInfo->s);
	glutPostRedisplay();	/* Callback -> reDisplay */
	break;
	
    case RM_DISP_MODE_NONE:
	ReOneStep(RCM_MAX_DT_SIMU);
	if (ReInfo->_refreshDisplay) {
	    GfuiDisplay();
	}
	glutPostRedisplay();	/* Callback -> reDisplay */
	break;

    case RM_DISP_MODE_CAPTURE:
	capture = &(ReInfo->movieCapture);
	while ((ReInfo->_reCurTime - capture->lastFrame) < capture->deltaFrame) {
	    ReOneStep(capture->deltaSimu);
	}
	capture->lastFrame = ReInfo->_reCurTime;
	
	GfuiDisplay();
	ReInfo->_reGraphicItf.refresh(ReInfo->s);
	reCapture();
	glutPostRedisplay();	/* Callback -> reDisplay */
	break;
	
    }
    STOP_PROFILE("ReUpdate");

    return RM_ASYNC;
}
bool CSpaceRestrictionBridge::on_border					(const Fvector &position) const
{
	START_PROFILE("Restricted Object/Bridge/On Border");
	
	VERIFY					(ai().level_graph().valid_vertex_position(position));

	CLevelGraph::CPosition	pos = ai().level_graph().vertex_position(position);

	xr_vector<u32>::const_iterator E = object().border().end();
	xr_vector<u32>::const_iterator I = std::lower_bound	(
		object().border().begin(),
		object().border().end(),
		pos.xz(),
		CFindByXZ_predicate()
	);

	if ((I == E) || (ai().level_graph().vertex(*I)->position().xz() != pos.xz()))
		return			(false);

	for (I ; I != E; ++I) {
		if (ai().level_graph().vertex(*I)->position().xz() != pos.xz())
			break;

		if (_abs(ai().level_graph().vertex_plane_y(*I) - position.y) < 2.f)
			return	(true);
	}	

	return				(false);

	STOP_PROFILE;
}
bool CRestrictedObject::accessible			(u32 level_vertex_id, float radius) const
{
	START_PROFILE("Restricted Object/Accessible");
	VERIFY						(ai().level_graph().valid_vertex_id(level_vertex_id));
	return						(Level().space_restriction_manager().accessible(object().ID(),level_vertex_id,radius));
	STOP_PROFILE;
}
bool CRestrictedObject::accessible			(u32 level_vertex_id) const
{
	START_PROFILE("Restricted Object/Accessible");
	VERIFY						(ai().level_graph().valid_vertex_id(level_vertex_id));
	return						(accessible(level_vertex_id,EPS_L));
	STOP_PROFILE;
}
Example #7
0
static int vfswrap_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2])
{
	int result;

	START_PROFILE(syscall_ntimes);
#if defined(HAVE_UTIMES)
	{
		struct timeval tv[2];
		tv[0] = convert_timespec_to_timeval(ts[0]);
		tv[1] = convert_timespec_to_timeval(ts[1]);
		result = utimes(path, tv);
	}
#elif defined(HAVE_UTIME)
	{
		struct utimbuf times;
		times.actime = convert_timespec_to_time_t(ts[0]);
		times.modtime = convert_timespec_to_time_t(ts[1]);
		result = utime(path, times);
	}
#else
	errno = ENOSYS;
	result = -1;
#endif
	END_PROFILE(syscall_ntimes);
	return result;
}
Example #8
0
void CSpaceRestriction::merge_free_in_retrictions	()
{
	START_PROFILE("Restricted Object/Merge Free In");
	string256								temp;
	for (u32 i=0, n=_GetItemCount(*m_in_restrictions); i<n ;++i) {
		SpaceRestrictionHolder::CBaseRestrictionPtr bridge = m_space_restriction_manager->restriction(shared_str(_GetItem(*m_in_restrictions,i,temp)));
		m_free_in_restrictions.push_back	(CFreeInRestriction(bridge,false));
	}

	RESTRICTIONS					temp_restrictions;
	for (bool ok = false; !ok; ) {
		ok							= true;
		temp_restrictions.clear		();
		
		FREE_IN_RESTRICTIONS::iterator	I = m_free_in_restrictions.begin(), J;
		FREE_IN_RESTRICTIONS::iterator	E = m_free_in_restrictions.end();
		for ( ; I != E; ++I) {
			for (J = I + 1; J != E; ++J)
				if (intersects((*I).m_restriction,(*J).m_restriction))
					temp_restrictions.push_back	((*J).m_restriction);

			if (!temp_restrictions.empty()) {
				J					= remove_if(m_free_in_restrictions.begin(),m_free_in_restrictions.end(),CRemoveMergedFreeInRestrictions(temp_restrictions));
				m_free_in_restrictions.erase	(J,m_free_in_restrictions.end());
				(*I).m_restriction	= merge((*I).m_restriction,temp_restrictions);
				ok					= false;
				break;
			}
		}
	}
	STOP_PROFILE;
}
Example #9
0
static uint64_t onefs_get_alloc_size(struct vfs_handle_struct *handle,
				     files_struct *fsp,
				     const SMB_STRUCT_STAT *sbuf)
{
	uint64_t result;

	START_PROFILE(syscall_get_alloc_size);

	if(S_ISDIR(sbuf->st_mode)) {
		result = 0;
		goto out;
	}

	/* Just use the file size since st_blocks is unreliable on OneFS. */
	result = get_file_size_stat(sbuf);

	if (fsp && fsp->initial_allocation_size)
		result = MAX(result,fsp->initial_allocation_size);

	result = smb_roundup(handle->conn, result);

 out:
	END_PROFILE(syscall_get_alloc_size);
	return result;
}
Example #10
0
/****************************************************************************
  reply to a sendtxt
****************************************************************************/
int reply_sendtxt(connection_struct *conn,
		  char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
  int len;
  int outsize = 0;
  char *msg;
  START_PROFILE(SMBsendtxt);

  if (! (*lp_msg_command())) {
    END_PROFILE(SMBsendtxt);
    return(ERROR_DOS(ERRSRV,ERRmsgoff));
  }

  outsize = set_message(outbuf,0,0,True);

  msg = smb_buf(inbuf) + 1;

  len = SVAL(msg,0);
  len = MIN(len,sizeof(msgbuf)-msgpos);

  memcpy(&msgbuf[msgpos],msg+2,len);
  msgpos += len;

  DEBUG( 3, ( "SMBsendtxt\n" ) );

  END_PROFILE(SMBsendtxt);
  return(outsize);
}
Example #11
0
/****************************************************************************
  reply to a sendstrt
****************************************************************************/
int reply_sendstrt(connection_struct *conn,
		   char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
  int outsize = 0;
  char *p;

  START_PROFILE(SMBsendstrt);

  if (! (*lp_msg_command())) {
    END_PROFILE(SMBsendstrt);
    return(ERROR_DOS(ERRSRV,ERRmsgoff));
  }

  outsize = set_message(outbuf,1,0,True);

  memset(msgbuf,'\0',sizeof(msgbuf));
  msgpos = 0;

  p = smb_buf(inbuf)+1;
  p += srvstr_pull_buf(inbuf, msgfrom, p, sizeof(msgfrom), STR_TERMINATE) + 1;
  p += srvstr_pull_buf(inbuf, msgto, p, sizeof(msgto), STR_TERMINATE) + 1;

  DEBUG( 3, ( "SMBsendstrt (from %s to %s)\n", msgfrom, msgto ) );

  END_PROFILE(SMBsendstrt);
  return(outsize);
}
Example #12
0
void SoundSystem::TriggerEvent( char *_type, char *_eventName, Vector3<float> const &_pos )
{
    if( !m_channels ) return;

	START_PROFILE("TriggerEvent");
    
    SoundEventBlueprint *seb = m_blueprints.GetBlueprint(_type);
    if( seb )
    {
        for( int i = 0; i < seb->m_events.Size(); ++i )
        {
            SoundInstanceBlueprint *sib = seb->m_events[i];
            if( stricmp( sib->m_eventName, _eventName ) == 0 )
            {
                SoundInstance *instance = new SoundInstance();
                instance->Copy( sib->m_instance );
                instance->m_pos = _pos;
                bool success = InitialiseSound  ( instance );                
                if( !success ) ShutdownSound    ( instance );                
            }
        }
    }

	END_PROFILE("TriggerEvent");
}
void Tripod::AdvancePreAttack()
{
	START_PROFILE(g_app->m_profiler, "AdvancePreAttack");

	// Exit if we haven't come to a stop yet
	if (m_vel.Mag() > 0.05f)
	{
		END_PROFILE(g_app->m_profiler, "AdvancePreAttack");
		return;
	}

	m_targetHoverHeight = ATTACK_HOVER_HEIGHT;

	// See if we have achieved a full crouch yet
	float height = m_pos.y - g_app->m_location->m_landscape.m_heightMap->GetValue(m_pos.x, m_pos.z);
	if (height < ATTACK_HOVER_HEIGHT + 0.5f)
	{
		m_mode = ModeAttacking;
		m_modeStartTime = g_gameTime;
	}

	// Blend into attack orientation
	Vector3 desiredUp = CalcAttackUpVector();
	float factor1 = 0.8f * SERVER_ADVANCE_PERIOD;
	float factor2 = 1.0f - factor1;
	m_up = factor1 * desiredUp + factor2 * m_up;
	Vector3 right = m_up ^ m_front;
	m_front = right ^ m_up;
	m_front.Normalise();

	END_PROFILE(g_app->m_profiler, "AdvancePreAttack");
}
void CMovementManager::move_along_path	(CPHMovementControl *movement_control, Fvector &dest_position, float time_delta)
{
	START_PROFILE("Build Path/Move Along Path")
	VERIFY(movement_control);
	Fvector				motion;
	dest_position		= object().Position();

	float				precision = 0.5f;
	
	
	// Если нет движения по пути
	if (	!enabled() || 
			!actual()  ||
//			path_completed() || 
			detail().path().empty() ||
			detail().completed(dest_position,true) || 
			(detail().curr_travel_point_index() >= detail().path().size() - 1) ||
			fis_zero(old_desirable_speed())
		)
	{
		m_speed			= 0.f;
		

		DBG_PH_MOVE_CONDITIONS( if(ph_dbg_draw_mask.test(phDbgNeverUseAiPhMove)){movement_control->SetPosition(dest_position);movement_control->DisableCharacter();})
		if(movement_control->IsCharacterEnabled()) {
Vector2 Tripod::ChooseDestination()
{
	START_PROFILE(g_app->m_profiler, "ChooseDest");

	int numFound;
	WorldObjectId *enemies = g_app->m_location->m_entityGrid->GetEnemies(m_pos.x, m_pos.z,
																	NAVIGATION_SEARCH_RADIUS, &numFound, m_id.GetTeamId());
	Vector2 pos;

	if (numFound == 0)
	{
		pos = m_pos;
		pos.x += syncsfrand(300.0f);
		pos.y += syncsfrand(300.0f);
	}
	else
	{
		int i = syncrand() % numFound;
		Entity *targetEnemy = g_app->m_location->GetEntity(enemies[i]);
		pos = targetEnemy->m_pos;
		pos.x += syncsfrand(100.0f);
		pos.y += syncsfrand(100.0f);
	}

	END_PROFILE(g_app->m_profiler, "ChooseDest");

	return pos;
}
Example #16
0
void CHitMemoryManager::update()
{
	START_PROFILE("Memory Manager/hits::update")

	clear_delayed_objects		();

	VERIFY						(m_hits);
	m_hits->erase				(
		std::remove_if(	
			m_hits->begin(),
			m_hits->end(),
			CRemoveOfflinePredicate()
		),
		m_hits->end()
	);

#ifdef USE_SELECTED_HIT
	xr_delete					(m_selected_hit);
	u32							level_time = 0;
	HITS::const_iterator		I = m_hits->begin();
	HITS::const_iterator		E = m_hits->end();
	for ( ; I != E; ++I) {
		if ((*I).m_level_time > level_time) {
			xr_delete			(m_selected_hit);
			m_selected_hit		= new CHitObject(*I);
			level_time			= (*I).m_level_time;
		}
	}
#endif
	STOP_PROFILE
}
WorldObjectId Tripod::FindEntityToAttack()
{
	START_PROFILE(g_app->m_profiler, "FindEntityToA");

	WorldObjectId id;

	int numFound;
	WorldObjectId *enemies = g_app->m_location->m_entityGrid->GetEnemies(m_pos.x, m_pos.z,
																	ATTACK_SEARCH_RADIUS, &numFound, m_id.GetTeamId());

	int nearest = -1;
	float nearestDistSqrd = FLT_MAX;
	for (int i = 0; i < numFound; ++i)
	{
		Entity *entity = g_app->m_location->GetEntity(enemies[i]);
		float deltaX = entity->m_pos.x - m_pos.x;
		float deltaY = entity->m_pos.z - m_pos.z;
		float distSqrd = deltaX * deltaX + deltaY * deltaY;
		if (distSqrd < nearestDistSqrd)
		{
			nearestDistSqrd = distSqrd;
			nearest = i;
		}
	}

	if (nearest != -1)
	{
		id = enemies[nearest];
	}

	END_PROFILE(g_app->m_profiler, "FindEntityToA");

	return id;
}
Example #18
0
//BUG #606/#VV4 Neighbors/affinities:  This call returns affinities with identical mapping across PDs.
u8 ocrAffinityGet(ocrAffinityKind kind, u64 * count, ocrGuid_t * affinities) {
    START_PROFILE(api_ocrAffinityGet);
    ocrPolicyDomain_t * pd = NULL;
    getCurrentEnv(&pd, NULL, NULL, NULL);
    ocrPlatformModelAffinity_t * platformModel = ((ocrPlatformModelAffinity_t*)pd->platformModel);
    if(platformModel == NULL) {
        ASSERT(*count > 0);
        *count = 1;
        affinities[0] = NULL_GUID;
        RETURN_PROFILE(0);
    }

    if (kind == AFFINITY_PD) {
        ASSERT(*count <= (pd->neighborCount + 1));
        u64 i = 0;
        while(i < *count) {
            affinities[i] = platformModel->pdLocAffinities[i];
            i++;
        }
    } else if (kind == AFFINITY_PD_MASTER) {
        //BUG #610 Master PD: This should likely come from the INI file
        affinities[0] = platformModel->pdLocAffinities[0];
    } else if (kind == AFFINITY_CURRENT) {
        affinities[0] = platformModel->pdLocAffinities[platformModel->current];
    } else {
        ASSERT(false && "Unknown affinity kind");
    }
    RETURN_PROFILE(0);
}
void CSoundMemoryManager::update()
{
	START_PROFILE("Memory Manager/sounds::update")

	clear_delayed_objects		();

	VERIFY						(m_sounds);
	m_sounds->erase				(
		std::remove_if(	
			m_sounds->begin(),
			m_sounds->end(),
			CRemoveOfflinePredicate()
		),
		m_sounds->end()
	);

#ifdef USE_SELECTED_SOUND
	xr_delete					(m_selected_sound);
	u32							priority = u32(-1);
	xr_vector<CSoundObject>::const_iterator	I = m_sounds->begin();
	xr_vector<CSoundObject>::const_iterator	E = m_sounds->end();
	for ( ; I != E; ++I) {
		u32						cur_priority = this->priority(*I);
		if (cur_priority < priority) {
			m_selected_sound	= xr_new<CSoundObject>(*I);
			priority			= cur_priority;
		}
	}
#endif

	STOP_PROFILE
}
Example #20
0
u8 ocrAffinityGetAt(ocrAffinityKind kind, u64 idx, ocrGuid_t * affinity) {
    START_PROFILE(api_ocrAffinityGetAt);
    ocrPolicyDomain_t * pd = NULL;
    getCurrentEnv(&pd, NULL, NULL, NULL);
    ocrPlatformModelAffinity_t * platformModel = ((ocrPlatformModelAffinity_t*)pd->platformModel);
    if(platformModel == NULL) {
        ASSERT(idx > 0);
        affinity[0] = NULL_GUID;
        RETURN_PROFILE(OCR_EINVAL);
    }
    if (kind == AFFINITY_PD) {
        if (idx > (pd->neighborCount + 1)) {
            ASSERT(false && "error: ocrAffinityGetAt index is out of bounds");
            RETURN_PROFILE(OCR_EINVAL);
        }
        affinity[0] = platformModel->pdLocAffinities[idx];
    } else if (kind == AFFINITY_PD_MASTER) {
        //BUG #610 Master PD: This should likely come from the INI file
        affinity[0] = platformModel->pdLocAffinities[0];
    } else if (kind == AFFINITY_CURRENT) {
        affinity[0] = platformModel->pdLocAffinities[platformModel->current];
    } else {
        ASSERT(false && "Unknown affinity kind");
    }
    RETURN_PROFILE(0);
}
Example #21
0
u8 ocrAffinityQuery(ocrGuid_t guid, u64 * count, ocrGuid_t * affinities) {
    START_PROFILE(api_ocrAffinityQuery);
    ocrPolicyDomain_t * pd = NULL;
    getCurrentEnv(&pd, NULL, NULL, NULL);
    ocrPlatformModelAffinity_t * platformModel = ((ocrPlatformModelAffinity_t*)pd->platformModel);
    if(platformModel == NULL) {
        if (count != NULL) {
            ASSERT(*count > 0);
            *count = 1;
        }
        affinities[0] = NULL_GUID;
        RETURN_PROFILE(0);
    } else {
        if (count != NULL) {
            ASSERT(*count > 0);
            *count = 1;
        }
        if (ocrGuidIsNull(guid)) {
            affinities[0] = platformModel->pdLocAffinities[platformModel->current];
            RETURN_PROFILE(0);
        }
        ocrLocation_t loc = 0;
        ocrFatGuid_t fatGuid = {.guid=guid, .metaDataPtr=NULL};
        guidLocation(pd, fatGuid, &loc);
        //Current implementation doesn't store affinities of GUIDs
        //So we resolve the affinity of the GUID by looking up its
        //location and use that to index into the affinity array.
        //NOTE: Shortcoming is that it assumes location are integers.
        ASSERT(((u32)loc) < platformModel->pdLocAffinitiesSize);
        affinities[0] = platformModel->pdLocAffinities[(u32)loc];
    }
    RETURN_PROFILE(0);
}
Example #22
0
int vfswrap_chmod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode)
{
	int result;

	START_PROFILE(syscall_chmod);

	/*
	 * We need to do this due to the fact that the default POSIX ACL
	 * chmod modifies the ACL *mask* for the group owner, not the
	 * group owner bits directly. JRA.
	 */

	
	{
		int saved_errno = errno; /* We might get ENOSYS */
		if ((result = SMB_VFS_CHMOD_ACL(conn, path, mode)) == 0) {
			END_PROFILE(syscall_chmod);
			return result;
		}
		/* Error - return the old errno. */
		errno = saved_errno;
	}

	result = chmod(path, mode);
	END_PROFILE(syscall_chmod);
	return result;
}
Example #23
0
int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
{
	int result;
	
	START_PROFILE(syscall_fchmod);

	/*
	 * We need to do this due to the fact that the default POSIX ACL
	 * chmod modifies the ACL *mask* for the group owner, not the
	 * group owner bits directly. JRA.
	 */
	
	{
		int saved_errno = errno; /* We might get ENOSYS */
		if ((result = SMB_VFS_FCHMOD_ACL(fsp, fd, mode)) == 0) {
			END_PROFILE(syscall_fchmod);
			return result;
		}
		/* Error - return the old errno. */
		errno = saved_errno;
	}

#if defined(HAVE_FCHMOD)
	result = fchmod(fd, mode);
#else
	result = -1;
	errno = ENOSYS;
#endif

	END_PROFILE(syscall_fchmod);
	return result;
}
Example #24
0
SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence)
{
	SMB_OFF_T result = 0;

	START_PROFILE(syscall_lseek);

	/* Cope with 'stat' file opens. */
	if (filedes != -1)
		result = sys_lseek(filedes, offset, whence);

	/*
	 * We want to maintain the fiction that we can seek
	 * on a fifo for file system purposes. This allows
	 * people to set up UNIX fifo's that feed data to Windows
	 * applications. JRA.
	 */

	if((result == -1) && (errno == ESPIPE)) {
		result = 0;
		errno = 0;
	}

	END_PROFILE(syscall_lseek);
	return result;
}
Example #25
0
int vfswrap_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode)
{
	int result;
	BOOL has_dacl = False;

	START_PROFILE(syscall_mkdir);

	if (lp_inherit_acls(SNUM(conn)) && (has_dacl = directory_has_default_acl(conn, parent_dirname(path))))
		mode = 0777;

	result = mkdir(path, mode);

	if (result == 0 && !has_dacl) {
		/*
		 * We need to do this as the default behavior of POSIX ACLs	
		 * is to set the mask to be the requested group permission
		 * bits, not the group permission bits to be the requested
		 * group permission bits. This is not what we want, as it will
		 * mess up any inherited ACL bits that were set. JRA.
		 */
		int saved_errno = errno; /* We may get ENOSYS */
		if ((SMB_VFS_CHMOD_ACL(conn, path, mode) == -1) && (errno == ENOSYS))
			errno = saved_errno;
	}

	END_PROFILE(syscall_mkdir);
	return result;
}
Example #26
0
void SoundSystem::TriggerEvent( SoundObjectId _objId, char *_eventName )
{
    if( !m_channels ) return;

	START_PROFILE("TriggerEvent");
    
    char *objectType = m_interface->GetObjectType(_objId);
    if( objectType )
    {
        SoundEventBlueprint *seb = m_blueprints.GetBlueprint(objectType);
        if( seb )
        {
            for( int i = 0; i < seb->m_events.Size(); ++i )
            {
                SoundInstanceBlueprint *sib = seb->m_events[i];
                if( stricmp( sib->m_eventName, _eventName ) == 0 )
                {
                    Vector3<float> pos, vel;
                    m_interface->GetObjectPosition( _objId, pos, vel );

                    SoundInstance *instance = new SoundInstance();
                    instance->Copy( sib->m_instance );
                    instance->m_objIds.PutData( _objId );
                    instance->m_pos = pos;
                    instance->m_vel = vel;
                    bool success = InitialiseSound  ( instance );                
                    if( !success ) ShutdownSound    ( instance );                
                }
            }
        }
    }

	END_PROFILE("TriggerEvent");
}
void LandscapeRenderer::Render()
{
	if (m_verts.Size() <= 0)
		return;

    g_app->m_location->SetupFog();
	glEnable		(GL_FOG);

	START_PROFILE( "Render Landscape Main");

	switch (m_renderMode) {
		case RenderModeDisplayList:
			{
				int id = g_app->m_resource->GetDisplayList(MAIN_DISPLAY_LIST_NAME);
				AppDebugAssert(id != -1);
				glCallList(id);
			}
			break;

		default:
			RenderMainSlow();
			break;
	}
	END_PROFILE( "Render Landscape Main");

    int landscapeDetail = 1;//g_prefsManager->GetInt( "RenderLandscapeDetail", 1 );
    if( landscapeDetail < 4 )
    {
	    START_PROFILE( "Render Landscape Overlay");
		switch (m_renderMode) {
			case RenderModeDisplayList:
				{
					int id = g_app->m_resource->GetDisplayList(OVERLAY_DISPLAY_LIST_NAME);
					AppDebugAssert(id != -1);
					glCallList(id);
				}
				break;

			default:
			    RenderOverlaySlow();
				;
	    }
	    END_PROFILE( "Render Landscape Overlay");
    }
    
    glDisable		(GL_FOG);
}
Example #28
0
long vfswrap_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
{
	long result;
	START_PROFILE(syscall_telldir);
	result = sys_telldir(dirp);
	END_PROFILE(syscall_telldir);
	return result;
}
Example #29
0
static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, int fd,
				uint32 share_mode)
{
	START_PROFILE(syscall_kernel_flock);
	kernel_flock(fd, share_mode);
	END_PROFILE(syscall_kernel_flock);
	return 0;
}
void Tripod::AdvanceWalk()
{
	START_PROFILE(g_app->m_profiler, "AdvanceWalk");

	// Consider mode switch
	{
		float timeSinceAttack = g_gameTime - m_modeStartTime;
		if (timeSinceAttack > 10.0f + ATTACK_DURATION)
		{
			WorldObjectId targetId = FindEntityToAttack();
			if (targetId.IsValid())
			{
				Entity *target = g_app->m_location->GetEntity(targetId);
				m_attackTarget = target->m_pos;
				m_mode = ModePreAttack;
				m_modeStartTime = g_gameTime;
				END_PROFILE(g_app->m_profiler, "AdvanceWalk");
				return;
			}
		}
	}


	// Consider choosing a different nav dest
	if (syncrand() % 40 == 1)
	{
		m_navData.m_targetPos = ChooseDestination();
	}


	// Hover
	m_targetHoverHeight = STATIONARY_HOVER_HEIGHT - fabsf(m_speed) * HOVER_LOWER_WITH_SPEED_FACTOR;


	// Navigate
	DoNavigation();


	// Fall
	{
		bool allOnGround = m_legs[0]->m_foot.m_state == EntityFoot::OnGround &&
						   m_legs[1]->m_foot.m_state == EntityFoot::OnGround &&
						   m_legs[2]->m_foot.m_state == EntityFoot::OnGround;
		if (!allOnGround)
		{
			DoFallForTwoLegs();
		}
		else
		{
			m_bodyVel.Zero();
			m_front.HorizontalAndNormalise();
			m_up = g_upVector;
		}
	}

	END_PROFILE(g_app->m_profiler, "AdvanceWalk");
}