Example #1
0
static unsigned __stdcall
winmm_buffer_thread(void * user_ptr)
{
  cubeb * ctx = (cubeb *) user_ptr;
  XASSERT(ctx);

  for (;;) {
    DWORD r;
    PSLIST_ENTRY item;

    r = WaitForSingleObject(ctx->event, INFINITE);
    XASSERT(r == WAIT_OBJECT_0);

    /* Process work items in batches so that a single stream can't
       starve the others by continuously adding new work to the top of
       the work item stack. */
    item = InterlockedFlushSList(ctx->work);
    while (item != NULL) {
      PSLIST_ENTRY tmp = item;
      winmm_refill_stream(((struct cubeb_stream_item *) tmp)->stream);
      item = item->Next;
      _aligned_free(tmp);
    }

    if (ctx->shutdown) {
      break;
    }
  }

  return 0;
}
Example #2
0
static void
winmm_destroy(cubeb * ctx)
{
  DWORD r;

  XASSERT(ctx->active_streams == 0);
  XASSERT(!InterlockedPopEntrySList(ctx->work));

  DeleteCriticalSection(&ctx->lock);

  if (ctx->thread) {
    ctx->shutdown = 1;
    SetEvent(ctx->event);
    r = WaitForSingleObject(ctx->thread, INFINITE);
    XASSERT(r == WAIT_OBJECT_0);
    CloseHandle(ctx->thread);
  }

  if (ctx->event) {
    CloseHandle(ctx->event);
  }

  _aligned_free(ctx->work);

  free(ctx);
}
Example #3
0
//--------------------------------------------------------------------------------
//      SendRequest
//--------------------------------------------------------------------------------
IrDAErr TIASClient::SendRequest()
{
    Size classNameLen;
    Size attrNameLen;
    TIrLookupRequest* lookupRequest = (TIrLookupRequest*)GetCurrentEvent();

    XTRACE(kSendRequestEvent, 0, 0);

    // Save the request so it can be replied to
    XASSERT(fLookupRequest == nil);
    fLookupRequest = lookupRequest;

    // Get lengths of class and attr strings
    classNameLen = strlen((const char*)(lookupRequest->fClassName));
    attrNameLen = strlen((const char*)(lookupRequest->fAttrName));

    // Validate that className and attrName strings fit in buffer provided
    XASSERT((classNameLen + attrNameLen + 3) <= kIASClientBufferSize);
    if ((classNameLen + attrNameLen + 3) > kIASClientBufferSize) {
	return kIrDAErrBadParameter;
    }

    // Fill out the request
    fGetPutBuffer->Seek(0, kPosBeg);
    fGetPutBuffer->Put(kIASOpGetValueByClass | kIASFrameLstBit);
    fGetPutBuffer->Put((UByte)classNameLen);
    fGetPutBuffer->Putn((const UByte *)lookupRequest->fClassName, classNameLen);
    fGetPutBuffer->Put((UByte)attrNameLen);
    fGetPutBuffer->Putn((const UByte *)lookupRequest->fAttrName, attrNameLen);

    PutStart();

    return noErr;

} // TIASClient::SendRequest
Example #4
0
    bool handle_entity(const Entity &hero) {
        if(hero.clazz->name.find("CDOTA_Unit_Hero_") != 0)
            return false;

        // Most likely an illusion.
        std::string player = _hph.player_name_for_hero_id(hero.id);
        if(player.empty())
            return false;

        try {
            int cell_x = hero.properties.at("DT_DOTA_BaseNPC.m_cellX")->value_as<IntProperty>();
            int cell_y = hero.properties.at("DT_DOTA_BaseNPC.m_cellY")->value_as<IntProperty>();
            int cell_z = hero.properties.at("DT_DOTA_BaseNPC.m_cellZ")->value_as<IntProperty>();
            auto origin_prop = std::dynamic_pointer_cast<VectorXYProperty>(hero.properties.at("DT_DOTA_BaseNPC.m_vecOrigin"));
            int x = cell_x*128 + origin_prop->values[0];
            int y = cell_y*128 + origin_prop->values[1];

            // Write the coords to the "coords of all heroes" file.
            if(_json) {
                if(_files.empty()) {
                    _all << "[ ";
                } else {
                    _all << ", ";
                }
            }

            // Write to the hero-specific files.
            // TODO: A "hero created" callback would be nice, wouldn't it?
            std::string heroname(hero.clazz->name, 16);
            auto iFile = _files.find(heroname);
            if(iFile == _files.end()) {
                _files[heroname] = new std::ofstream((_basepath + heroname + (_json ? ".json" : ".csv")).c_str());
                iFile = _files.find(heroname);

                if(_json) {
                    *(iFile->second) << "[ ";
                }
            } else if(_json) {
                *(iFile->second) << ", ";
            }

            if(_json) {
                *(iFile->second) << '[' << x << ',' << y << ']';
                _all             << '[' << x << ',' << y << ']';
            } else {
                *(iFile->second) << x << ',' << y << '\n';
                _all             << x << ',' << y << '\n';
            }

        } catch(const std::out_of_range& e) {
            XASSERT(false, "%s", e.what());
        } catch(const std::bad_cast& e) {
            XASSERT(false, "%s", e.what());
        }
        return true;
    }
Example #5
0
static void
winmm_stream_destroy(cubeb_stream * stm)
{
  DWORD r;
  int i;
  int enqueued;

  if (stm->waveout) {
    EnterCriticalSection(&stm->lock);
    stm->shutdown = 1;

    waveOutReset(stm->waveout);

    enqueued = NBUFS - stm->free_buffers;
    LeaveCriticalSection(&stm->lock);

    /* Wait for all blocks to complete. */
    while (enqueued > 0) {
      r = WaitForSingleObject(stm->event, INFINITE);
      XASSERT(r == WAIT_OBJECT_0);

      EnterCriticalSection(&stm->lock);
      enqueued = NBUFS - stm->free_buffers;
      LeaveCriticalSection(&stm->lock);
    }

    EnterCriticalSection(&stm->lock);

    for (i = 0; i < NBUFS; ++i) {
      if (stm->buffers[i].dwFlags & WHDR_PREPARED) {
        waveOutUnprepareHeader(stm->waveout, &stm->buffers[i], sizeof(stm->buffers[i]));
      }
    }

    waveOutClose(stm->waveout);

    LeaveCriticalSection(&stm->lock);
  }

  if (stm->event) {
    CloseHandle(stm->event);
  }

  DeleteCriticalSection(&stm->lock);

  for (i = 0; i < NBUFS; ++i) {
    free(stm->buffers[i].lpData);
  }

  EnterCriticalSection(&stm->context->lock);
  XASSERT(stm->context->active_streams >= 1);
  stm->context->active_streams -= 1;
  LeaveCriticalSection(&stm->context->lock);

  free(stm);
}
Example #6
0
bool CxStdString::operator > (const CxStdString & compare) const
{
	if ( allocated && compare.allocated )
	{
		XASSERT( cstring );
		XASSERT( compare.cstring );
		return ( strcmp( cstring, compare.cstring ) < 0 );
 	}
	return false;
}
Example #7
0
bool CGlow::init()
{
	// get the glow manager from this sig ( which is 2 bytes into the sig )
	DWORD dwGlowLoc = gSignatures.GetClientSignature("8B 0D ? ? ? ? A1 ? ? ? ? 56 8B 37") + 0x2;
	XASSERT(dwGlowLoc);
	pGlowObjectManger = *(CGlowManager **)dwGlowLoc;
	XASSERT(pGlowObjectManger);

	return true;
}
Example #8
0
int64_t read_locations(const char *filename, const int64_t ntrees, struct locations *l, int *num_files, int *box_div)
{
    char buffer[MAXBUFSIZE];
    int max_fileid = 0;
    const char comment = '#';
    /* By passing the comment character, getnumlines
       will return the actual number of lines, ignoring
       the first header line. 
     */

    struct locations *locations = l;

    int64_t ntrees_found = 0;
    FILE *fp = my_fopen(filename, "r");
    while(fgets(buffer, MAXBUFSIZE, fp) != NULL) {
        if(buffer[0] == comment) {
            continue;
        } else {
            const int nitems_expected = 4;
            char linebuf[MAXLEN];
            XASSERT(ntrees_found < ntrees,
                    "ntrees=%"PRId64" should be less than ntrees_found=%"PRId64"\n",
                    ntrees, ntrees_found);            
            int nitems = sscanf(buffer, "%"SCNd64" %"SCNd64 " %"SCNd64 "%s", &(locations[ntrees_found].tree_root),
                                &(locations[ntrees_found].fileid), &(locations[ntrees_found].offset), linebuf);

            /* The filename is separated out to save memory but I want to ensure that the actual filename does
               not get truncated. The filename field might actually be removed later. */
            my_snprintf(locations[ntrees_found].filename, LOCATIONS_FILENAME_SIZE, "%s", linebuf);
            XASSERT(nitems == nitems_expected,
                    "Expected to parse two long integers but found `%s' in the buffer\n",
                    buffer);
            ntrees_found++;
        }
    }
    XASSERT(ntrees == ntrees_found, "ntrees=%"PRId64" should be equal to ntrees_found=%"PRId64"\n", ntrees, ntrees_found);
    fclose(fp);

    for(int i=0;i<ntrees_found;i++){
        if (locations[i].fileid > max_fileid) {
            max_fileid = locations[i].fileid;
        }
    }

    /* number of files is one greater from 0 based indexing of C files */
    *num_files = max_fileid + 1;
    const int box_divisions = (int) round(cbrt(*num_files));
    const int box_cube = box_divisions * box_divisions * box_divisions;
    XASSERT( (box_cube) == (*num_files),
             "box_divisions^3=%d should be equal to nfiles=%d\n",
             box_cube, *num_files);
    *box_div = box_divisions;
    return ntrees_found;
}    
Example #9
0
	// -------------------------------------------------------
	// add transition
	// -------------------------------------------------------
	void StateManager::addTransition(int from, int outcome, int to, float ttl) {
		// FIXME: assert that from and to are valid
		XASSERT(from != to, "You cannot add a transition pointing to itself");
		XASSERT(_states.find(from) != _states.end(), "The from %d paramter is an unknown state",from);
		XASSERT(_states.find(to) != _states.end(), "The to %d paramter is an unknown state",to);
		StateTransition t;
		t.from = from;
		t.to = to;
		t.outcome = outcome;
		t.ttl = ttl;
		_transitions.push_back(t);
	}
Example #10
0
XOrderCamera::XOrderCamera( XSeq *pSeq, int idxOrder )
	: XOrder( pSeq, idxOrder )
{
	Init();
	m_spProp = std::static_pointer_cast<XPropCamera>( pSeq->GetspProp()->m_aryOrder[ idxOrder ] );
	if( SCENE_WORLD ) {
		if( m_spProp->m_bPopPos ) {
			// 좌표 pop mode
			if( XASSERT(!s_stackPos.empty()) ) {
				// 좌표 복구.
				const XE::VEC2 vwCamera = s_stackPos.top();
				s_stackPos.pop();
				SCENE_WORLD->DoMovePosInWorld( vwCamera );
			}
		} else {
			if( m_spProp->m_bPushPos ) {
				// 좌표 백업
				s_stackPos.push( SCENE_WORLD->GetvwCamera() );
			}
			// 지정된 좌표로 이동
			if( m_spProp->m_aryIdsTarget.size() ) {
				// 카메라에서는 idsTarget을 하나만 쓴다.
 				auto idsTarget = m_spProp->m_aryIdsTarget[0];
				auto pWnd = GAME->Find( idsTarget );
				if( pWnd ) {
					auto vPos = pWnd->GetPosLocal();
					SCENE_WORLD->DoMovePosInWorld( vPos, 0.5f );
				} else {
					XBREAKF( 1, "%s not found", C2SZ(idsTarget) );
				}
			} else {
				SCENE_WORLD->DoMovePosInWorld( m_spProp->m_vwDst, 0.5f );
			}
		}
	} else
	if( SCENE_BATTLE ) {
		if( m_spProp->m_bPopPos ) {
			if( XASSERT( !s_stackPos.empty() ) ) {
				SCENE_BATTLE->DoMoveCamera( s_stackPos.top() );
				s_stackPos.pop();
			}
		} else {
			if( m_spProp->m_bPushPos ) {
				s_stackPos.push( SCENE_BATTLE->GetvwCamera() );
			}
			// 지정된 좌표로 이동
			XBREAK( m_spProp->m_vwDst.IsZero() );
			SCENE_BATTLE->DoMoveCamera( m_spProp->m_vwDst );
		}
	}
}
Example #11
0
static WAVEHDR *
winmm_get_next_buffer(cubeb_stream * stm)
{
  WAVEHDR * hdr = NULL;

  XASSERT(stm->free_buffers > 0 && stm->free_buffers <= NBUFS);
  hdr = &stm->buffers[stm->next_buffer];
  XASSERT(hdr->dwFlags & WHDR_PREPARED ||
          (hdr->dwFlags & WHDR_DONE && !(hdr->dwFlags & WHDR_INQUEUE)));
  stm->next_buffer = (stm->next_buffer + 1) % NBUFS;
  stm->free_buffers -= 1;

  return hdr;
}
Example #12
0
//--------------------------------------------------------------------------------
//      CItemComparer::TestItem
//--------------------------------------------------------------------------------
CompareResult CItemComparer::TestItem(const void* criteria) const
{
    XASSERT(fItem);
    XASSERT(criteria);

    if (fItem < criteria)
	return kItemLessThanCriteria;

    else if (fItem > criteria)
	return kItemGreaterThanCriteria;

    else
	return kItemEqualCriteria;
}
void CGBLStorageManagerTestBBBase::ElementToXstring(int i, int c, CKDataArray *array, XString *elem)
{
    XASSERT(array);

    int elemSize = array->GetElementStringValue(i, c, NULL);
    CKSTRING elemHolder = new CKCHAR[elemSize];

    XASSERT(elemHolder);

    array->GetElementStringValue(i, c, elemHolder);        

    *elem = elemHolder;

    delete [] elemHolder;
    elemHolder = NULL;
}
Example #14
0
	char* StrReadLine( const char* str, char* outLine )
	{
		XASSERT(str && outLine);

LOOP:
		if(*str)
		{
			if(*str != '\n')
			{
				*outLine = *str;
				str++;
				outLine++;
				goto LOOP;
			}
			else
			{
				*(outLine - 1) = '\0';
				str++;
				return (char*)str;
			}
		}
		else
		{
			*outLine = '\0';
			return nullptr;
		}
	}
Example #15
0
	void StrTrimRight( const char* str, char* dst )
	{
		XASSERT(str && dst);

		const char* _str = str;

		if(*str)
		{
			str++;
			while(*str)
				str++;
			str--;
		}
		else
			goto END;

		XSTRING_PREFETCH_TBL(TblSpaceTab);
		while(ChrIsSpaceTab(*str))
			str--;
		str++;
		while(_str != str)
		{
			*dst = *_str;
			_str++;
			dst++;
		}

END:
		*dst = '\0';
	}
Example #16
0
/**
 @brief pEff의 발동스킬을 발동대상(혹은 발동좌표)에 사용한다.
 this는 발동자.
 @param pIvkTarget 발동대상. 발동대상이 좌표형이면 null이다
 @param vIvkPos 발동대상이 좌표형태일때 IzNotZero가 된다. 
*/
bool XSkillReceiver::DoInvokeSkill( XSkillReceiver* pIvkTarget,
																		const XE::VEC2& vIvkPos, 
																		const XSkillDat* pDat, 
																		const EFFECT* pEffect, 
																		int level, 
																		XSkillUser* pCaster,
																		ID idCallerBuff )
{
	// 좌표에 값이 있으면 타겟은 널이어야 한다.,
	XBREAK( vIvkPos.IsNotZero() && pIvkTarget != nullptr );
	bool bApplied = false;
	auto pInvoker = this;		// this는 발동자
	// 발동스킬이 있는가?
	_tstring strInvokeSkillMut = pEffect->strInvokeSkill;
	XBREAK( strInvokeSkillMut.empty() );
	// strInvokeSkill이 바뀔수 있음.
	bool bInvoke = (pIvkTarget)? pInvoker->OnInvokeSkill( pDat, pEffect, pIvkTarget, level, &strInvokeSkillMut ) : true;
	if( bInvoke ) {
#ifdef _XSINGLE
//	XTRACE( "스킬발동: %s", pEffect->strInvokeSkill.c_str() );
#endif // _XSINGLE
		// 발동스킬을 실행시킨다. 기준타겟은 pIvkTarget로 된다.
		// 발동스킬이 m_listUseSkill에 들어가는 문제가 있어 안들어가도록 수정함.
		auto infoUseSkill = pCaster->UseSkillByIds( strInvokeSkillMut,
																								level, 
																								pIvkTarget, vIvkPos );
		XASSERT( infoUseSkill.errCode == xOK );
		if( infoUseSkill.errCode == xOK ) {
			// 발동스킬은 지속형일수도 있고 즉시발동형일수도 있다.
			pCaster->OnShootSkill( infoUseSkill, idCallerBuff );
			bApplied = true;
		}
	}
	return bApplied;
}
Example #17
0
int
main(int argc, char** argv)
{
	XASSERT(argc == 5,
		"usage: $0 THREADS CONNECTIONS IP PORT");

	int thread_count = atoi(argv[1]);
	connections = atoi(argv[2]);
	ip = argv[3];
	port = (uint16_t)atoi(argv[4]);

	pthread_t* threads = cx_alloc((size_t)thread_count * sizeof(pthread_t*));

	PROFILE_BEGIN_FMT("threads:%d requests/thread:%d\n", thread_count, connections);

	int i;
	for (i = 0; i < thread_count; i++)
		pthread_create(&threads[i], NULL, thread_send_data, NULL);


	for (i = 0; i < thread_count; i++)
		pthread_join(threads[i], NULL);


	PROFILE_END

	cx_free(threads);
	return 0;
}
Example #18
0
void XEWinSocketSvr::OnDestroy()
{
	BTRACE( "save user" );
	if( XASSERT(m_pUserMng) ) {
		m_pUserMng->Save();
	}
}
Example #19
0
void XESkillMng::LoadCond( TiXmlElement *pElemCond, EFFECT *pEffect )
{
	// "발동조건"안의 attribute들을 읽는다.
	xCOND cond;
	TiXmlAttribute *pCondAttr = pElemCond->FirstAttribute();
	while( pCondAttr )
	{
		// "발동조건"블럭안의 attribute들을 모두 읽는다.
		const char *cAttrName = pCondAttr->Name();
		const char *cVal = pCondAttr->Value();
		XU8LOG( cAttrName );
		XU8LOG( cVal );
		// 조건파라메터를 하나씩 분석해서 어레이에 쌓는다.
		xCOND_PARAM param;
		param.cond = (XSKILL::xtCondition)ParsingParam( cAttrName );
		param.val = ParsingParam( cVal );
		if( param.cond )
			cond.aryParam.Add( param );
		pCondAttr = pCondAttr->Next();
	}
	if( cond.aryParam.size() > 0 )
	{
		if( XASSERT(pEffect) )
			pEffect->aryInvokeCondition.Add( cond );
	}
}
Example #20
0
void XOrderIndicate::Process( float dt )
{
	if( m_timerSec.IsOver() ) {
		if( CreateIndicator() == false ) {
			if( ++m_numFailed >= 3 )
				SetbEnd( true );	// 타겟을 3초간 못찾으면 그냥 끝냄.
		}
		m_timerSec.Reset();
	}
	// 시간되면 자동 종료
	if( m_timerFinish.IsOver() ) {
		// 이 인디케이터가 다른 order의 end가 종료시점일때
		if( GetspProp()->m_typeEnd == xFIN_END_ORDER ) {
			auto spOrderProp = m_spPropSeq->GetspOrderProp( GetspProp()->m_idsEnd );
			if( XASSERT(spOrderProp) ) {
				// 그 다른 order가 touch방식이 아닐때만 자동 사라짐.
				if( spOrderProp->m_typeEnd != xFIN_TOUCH ) {
					CONSOLE("XOrderIndicate::Process:시간초과로 자동 종료됨.");
					SetbEnd( true );
					m_timerFinish.Off();
				} else {
					m_timerFinish.Off();		// 더이상 검사하지 않도록.
				}
			}
		} else
		if( GetspProp()->m_typeEnd == xFIN_DELAY ) {
			m_timerFinish.Off();
			SetbEnd( true );
		}
	}
}
Example #21
0
void DeathBalls::handleEvents(const ds::ActionEventBuffer& buffer) {
	for (int i = 0; i < buffer.events.size(); ++i) {
		const ds::ActionEvent& event = buffer.events[i];
		if (_world->contains(event.sid) && event.spriteType == OT_DEATHBALL) {
			if (event.type == ds::AT_ROTATE_BY ) {
				float angle = _world->getRotation(event.sid);
				v2 v = ds::vector::getRadialVelocity(angle, 500.0f);
				_world->moveBy(event.sid, v);
				DeathBall* data = (DeathBall*)_world->get_data(event.sid);
				XASSERT(data != 0, "No Deathball data found for %d",event.sid);
				_world->moveBy(data->innerID, v);
				_context->trails->add(event.sid, 4.0f, DEATHBALL_TRAIL, 20.0f);
				_world->stopAction(event.sid, ds::AT_COLOR_FLASH);
				_world->stopAction(data->innerID, ds::AT_COLOR_FLASH);
				_world->setColor(event.sid, ds::Color(255, 128, 0, 255));
				_world->setColor(data->innerID, ds::Color(255, 128, 0, 255));
			}
			else if (event.type == ds::AT_MOVE_BY) {
				// let it explode
				v2 p = _world->getPosition(event.sid);
				_context->particles->start(DEATHBALL_EXPLOSION, p);
				DeathBall* data = (DeathBall*)_world->get_data(event.sid);
				_world->remove(data->innerID);
				_world->remove(event.sid);				
			}
		}
	}
}
Example #22
0
bool XEUser::IsDestroy() const
{
	auto spConn = m_spConnect.lock();
	if( XASSERT(spConn) )
		return spConn->IsbDestroy();
	return true;		// 커넥션이 없는경우는 파괴된걸로 판단.
}
Example #23
0
uint32_t read_var_int(const char *data, size_t length, size_t *offset) {
  uint32_t b;
  int count = 0;
  uint32_t result = 0;

  do {
    XASSERT(count != 5, "Corrupt data.");
    XASSERT(*offset <= length, "Premature end of stream.");

    b = data[(*offset)++];
    result |= (b & 0x7F) << (7 * count);
    ++count;
  } while (b & 0x80);

  return result;
}
Example #24
0
/**
 * _cairo_cache_freeze:
 * @cache: a cache with some precious entries in it (or about to be
 * added)
 *
 * Disable the automatic ejection of entries from the cache. For as
 * long as the cache is "frozen", calls to _cairo_cache_insert() will
 * add new entries to the cache regardless of how large the cache
 * grows. See _cairo_cache_thaw().
 *
 * Note: Multiple calls to _cairo_cache_freeze() will stack, in that
 * the cache will remain "frozen" until a corresponding number of
 * calls are made to _cairo_cache_thaw().
 **/
void
_cairo_cache_freeze (cairo_cache_t *cache)
{
    XASSERT (cache->freeze_count >= 0);

    cache->freeze_count++;
}
Example #25
0
/**
 @brief Invoke대상에게 pEffect효과를 적용시킨다.
 @param pInvoker pEffect효과를 발동시킨측. pCaster와는 다르다.
 @param vIvkPos 발동대상이 좌표인경우 0이아닌값이 들어온다. 이때 pInvokeTarget은 null이된다.
 @return 효과적용에 성공하면 true를 리턴한다.
*/
bool XSkillUser::ApplyInvokeEffToIvkTarget( XSkillReceiver* pIvkTarget, // null일수도 있음.
																						const XE::VEC2& vIvkPos,	// 발동대상이 좌표형태인경우.
																						const XSkillDat *pDat,
																						const EFFECT *pEffect,
																						XSkillReceiver *pInvoker,
																						bool bCreateSfx,
																						int level,
																						XBuffObj *pBuffObj )
{
	// 좌표에 값이 있으면 타겟은 널이어야 한다.,
	XBREAK( vIvkPos.IsNotZero() && pIvkTarget != nullptr );	
	// 발동적용확률이 있다면 확률검사를 통과해야 한다.(XBuffObj에 이것이 있을때는 GetInvokeTarget을 하기전에 수행되었는데 지금은 발동타겟 개별적으로 확률검사를 하도록 바뀜. 이게 맞는거 같아서)
	bool bOk = XSKILL::DoDiceInvokeApplyRatio( pEffect, level );
	if( !bOk )
		return false;
	bool bOrCond = false;
	// 조건블럭이 없으면 무조건 true
	if( pEffect->aryInvokeCondition.size() == 0 ) {
		bOrCond = true;
	} else
	// 발동조건 블럭검사.
	if( pIvkTarget && IsInvokeTargetCondition( pDat, pEffect, pIvkTarget ) ) {
		bOrCond = true;
	}
	if( !bOrCond )
		return false;
	if( pEffect->idInvokeSound ) {
		OnSkillPlaySound( pEffect->idInvokeSound );
	}
	// 발동타겟에게 실제 효과적용
	if( pIvkTarget ) {
		int retApplied = pIvkTarget->ApplyInvokeEffect( const_cast<XSkillDat*>(pDat), this
																										, pInvoker, pBuffObj
																										, pEffect, level );
		// 발동대상이펙트가 있다면 생성해준다.
		if( bCreateSfx && pEffect->m_invokeTargetEff.IsHave() ) {
			const float secPlay = 0.f;		// 1play. 발동이펙트는 반복플레이가 없음.
			const XE::VEC2 vZero;
			CreateSfx( pIvkTarget, pDat, pEffect->m_invokeTargetEff, secPlay, vZero );
		}
		return retApplied != 0;
	} else
	if( vIvkPos.IsNotZero() ) {
		// 발동타겟이 좌표형태
		// 발동타겟이 좌표이면 바닥에 놓는 버프객체를 뜻한다.
		// 발동좌표를 기준타겟좌표로해서 시전한다. 기준타겟좌표로 시전된 스킬은 가상의 리시버객체가 생성되고 거기에 버프가 걸리는 형태.
		if( XASSERT(!pEffect->strInvokeSkill.empty()) ) {		// 발동대상이 좌표형태인경우 그 효과는 반드시 발동스킬로 구현되어야 한다.
			const ID idCallerBuff = ( pBuffObj ) ? pBuffObj->GetidSkill() : 0;
			pInvoker->DoInvokeSkill( nullptr, vIvkPos, pDat, pEffect, level, this, idCallerBuff );
		}

		// 발동대상이펙트가 있다면 생성해준다.
		if( bCreateSfx && pEffect->m_invokeTargetEff.IsHave() ) {
			const float secPlay = 0.f;		// 1play. 발동이펙트는 반복플레이가 없음.
			CreateSfx( pIvkTarget, pDat, pEffect->m_invokeTargetEff, secPlay, vIvkPos );
		}
		return true;
	}
	return false;
} // ApplyInvokeEffectToInvokeTarget
Example #26
0
CxSimpleADO::IRecordSetPtr CxSimpleADO::Execute(LPCWSTR lpszSql)
{
    if (!IsConnect())
        return IRecordSetPtr(m_pCommand, NULL);

    USES_CONVERSION;

    m_pCommand->SetActiveConnection( m_pConnection );
    m_pCommand->SetCommandText( W2T((LPWSTR)lpszSql) );

    int nParamCount = m_pParameterSet->GetCount();
    for ( int i=0 ; i<nParamCount ; i++ )
    {
        CxADOParameterSet::ParameterSet* pParamSet = m_pParameterSet->GetAt(i);
        XASSERT( !pParamSet->pParameter );
        pParamSet->pParameter = m_pCommand->CreateParameter( pParamSet->strName, pParamSet->size, adLongVarBinary );
        m_pCommand->Append(pParamSet->pParameter);
        pParamSet->pParameter->AppendChunk(pParamSet->var);
    }

    CxADORecordSet* pRs = m_pCommand->Execute();

    m_pParameterSet->Clear();

    if (!pRs)
        return IRecordSetPtr(m_pCommand, NULL);

    return IRecordSetPtr(m_pCommand, pRs);
}
Example #27
0
	//////////////////////////////////////////////////////////////////////////TempAllocator
	void TempAllocator::init( size_t buffSize )
	{
		m_tac.init();
		m_bufferBegin = (byte*)::GlobalAlloc(0, buffSize);
		XASSERT(m_bufferBegin);
		m_bufferSeek = m_bufferBegin;
		m_bufferEnd = m_bufferBegin +  buffSize;
	}
Example #28
0
/**
 * _cairo_cache_thaw:
 * @cache: a cache, just after the entries in it have become less
 * precious
 *
 * Cancels the effects of _cairo_cache_freeze().
 *
 * When a number of calls to _cairo_cache_thaw() is made corresponding
 * to the number of calls to _cairo_cache_freeze() the cache will no
 * longer be "frozen". If the cache had grown larger than max_size
 * while frozen, entries will immediately be ejected (by random) from
 * the cache until the cache is smaller than max_size. Also, the
 * automatic ejection of entries on _cairo_cache_insert() will resume.
 **/
void
_cairo_cache_thaw (cairo_cache_t *cache)
{
    XASSERT (cache->freeze_count > 0);

    if (--cache->freeze_count == 0)
	_cairo_cache_shrink_to_accommodate (cache, 0);
}
Example #29
0
void XKeyEmitter::Execute( XSprObj *pSprObj, float fOverSec )
{
	// spLayer를 인수로 받아쓰면 될거 같은데...
	auto pLayer = SafeCast<XLayerParticle*>( pSprObj->GetLayer(GetLayerType(), GetnLayer()) );
	if( XASSERT( pLayer ) ) {
		pLayer->SetEmitter( m_Emit );
	}
}
Example #30
0
void XEWinSocketSvr::ReleaseConnectInMap( ID idKey, XSharedObj<XMap_Connection>& shoMapConnects )
{
	auto pMap = &shoMapConnects.GetSharedObj();
	if( XASSERT(pMap) ) {
		ReleaseConnectInMap( idKey, *pMap );
	}
	shoMapConnects.ReleaseSharedObj();
}