本文整理汇总了C++中ObjectBase类的典型用法代码示例。如果您正苦于以下问题:C++ ObjectBase类的具体用法?C++ ObjectBase怎么用?C++ ObjectBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObjectBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hasAStructure
bool Tile::hasAStructure() const {
if(!hasANonInfantryGroundObject()) {
return false;
}
ObjectBase* pObject = currentGame->getObjectManager().getObject(assignedNonInfantryGroundObjectList.front());
return ( (pObject != NULL) && pObject->isAStructure() );
}
示例2: rsi_ObjDestroy
void rsi_ObjDestroy(Context *rsc, void *optr) {
static int cnt = 0;
ALOGD_IF(cnt++ % 3000 == 0,
"%p rsi_ObjDestroy, cnt: %d", rsc, cnt);
ObjectBase *ob = static_cast<ObjectBase *>(optr);
rsc->removeName(ob);
ob->decUserRef();
}
示例3: removeObject
void GameServer::removeObject(ObjectBase &obj)
{
Geometry aoi(Circle(obj.pos, areaOfInfluenceRadius));
std::vector<PlayerBase *> aoiplayers;
om.collidingPlayers(aoi, obj.pos, aoiplayers);
for(unsigned i = 0; i < aoiplayers.size(); i++) {
Player &player = *static_cast<Player *>(aoiplayers[i]);
clientSendPacket(Signal(Signal::remove, obj.getId()), player.getId());
}
om.remove(obj.getId());
}
示例4: UnLink
//=============================================================================
// リンク解除
//=============================================================================
void DrawList::UnLink(ObjectBase* object)
{
// 存在チェック
if(object->drawList(m_shaderPatternId) == nullptr)
return;
ObjectBase* prev = object->drawPrev(m_shaderPatternId);
ObjectBase* next = object->drawNext(m_shaderPatternId);
int priority = object->priority(m_shaderPatternId);
//----------------------------
// 前オブジェクトの再設定
//----------------------------
object->drawPrev(m_shaderPatternId, nullptr);
if(prev != nullptr)
{
// 前オブジェクトに次オブジェクトを連結
prev->drawNext(m_shaderPatternId, next);
}
else
{
// 先頭オブジェクトを変更
m_top[priority] = next;
if(m_top[priority] != nullptr)
// 先頭の前をnullptrに
m_top[priority]->drawPrev(m_shaderPatternId, nullptr);
}
//----------------------------
// 次オブジェクトの再設定
//----------------------------
object->drawNext(m_shaderPatternId, nullptr);
if(next != nullptr)
{
// 次オブジェクトに前オブジェクトを連結
next->drawPrev(m_shaderPatternId, prev);
}
else
{
// 終端オブジェクトを変更
m_end[priority] = prev;
if(m_end[priority] != nullptr)
// 終端をnullptrに
m_end[priority]->drawNext(m_shaderPatternId, nullptr);
}
//----------------------------
// 描画リストを解除
//----------------------------
object->drawList(nullptr, m_shaderPatternId);
}
示例5: blitNonInfantryGroundUnits
void Tile::blitNonInfantryGroundUnits(int xPos, int yPos) {
if(hasANonInfantryGroundObject() && !isFogged(pLocalHouse->getHouseID())) {
std::list<Uint32>::const_iterator iter;
for(iter = assignedNonInfantryGroundObjectList.begin(); iter != assignedNonInfantryGroundObjectList.end() ; ++iter) {
ObjectBase* current = currentGame->getObjectManager().getObject(*iter);
if(current->isAUnit() && current->isVisible(pLocalHouse->getTeam())) {
if(location == current->getLocation()) {
current->blitToScreen();
}
}
}
}
}
示例6: AllDraw
//=============================================================================
// 全オブジェクトの描画
//=============================================================================
void DrawList::AllDraw(LPD3DXCONSTANTTABLE vsc, LPD3DXCONSTANTTABLE psc, D3DXMATRIX vp)
{
ObjectBase* cur = nullptr;
for(int cnt = 0; cnt < m_priorityLevel; ++cnt)
{
cur = m_top[cnt];
while(cur)
{
cur->Draw(vsc, psc, vp);
cur = cur->drawNext(m_shaderPatternId);
}
}
}
示例7: m
void ObjectBase::dumpCreatedObjects()
{
#ifdef OXYGINE_DEBUG_TRACE_LEAKS
MutexAutoLock m(getMutex());
log::messageln("\n\n\nallocated objects:");
int n = 0;
__createdObjects& objs = __getCreatedObjects();
for (__createdObjects::iterator i = objs.begin(); i != objs.end(); ++i)
{
ObjectBase* object = *i;
//log::message("%d)", n);
object->dumpObject();
++n;
}
log::message("total: %d -----------------------------\n\n\n", (int)objs.size());
#endif
}
示例8: LOGV
void ObjectBase::freeAllChildren(Context *rsc) {
if (rsc->props.mLogObjects) {
LOGV("Forcing release of all child objects.");
}
// This operation can be slow, only to be called during context cleanup.
ObjectBase * o = (ObjectBase *)rsc->mObjHead;
while (o) {
if (o->freeChildren()) {
// deleted ref to self and possibly others, restart from head.
o = (ObjectBase *)rsc->mObjHead;
} else {
o = (ObjectBase *)o->mNext;
}
}
if (rsc->props.mLogObjects) {
LOGV("Objects remaining.");
dumpAll(rsc);
}
}
示例9: decRefs
void Element::decRefs(const void *ptr) const {
if (!mFieldCount) {
if (mComponent.isReference()) {
ObjectBase *const*obp = static_cast<ObjectBase *const*>(ptr);
ObjectBase *ob = obp[0];
if (ob) ob->decSysRef();
}
return;
}
const uint8_t *p = static_cast<const uint8_t *>(ptr);
for (uint32_t i=0; i < mFieldCount; i++) {
if (mFields[i].e->mHasReference) {
const uint8_t *p2 = &p[mFields[i].offsetBits >> 3];
for (uint32_t ct=0; ct < mFields[i].arraySize; ct++) {
mFields[i].e->decRefs(p2);
p2 += mFields[i].e->getSizeBytes();
}
}
}
}
示例10: handleActionClick
void UnitBase::handleActionClick(int xPos, int yPos) {
if(respondable) {
if(currentGameMap->tileExists(xPos, yPos)) {
if(currentGameMap->getTile(xPos,yPos)->hasAnObject()) {
// attack unit/structure or move to structure
ObjectBase* tempTarget = currentGameMap->getTile(xPos,yPos)->getObject();
if(tempTarget->getOwner()->getTeam() != getOwner()->getTeam()) {
// attack
currentGame->getCommandManager().addCommand(Command(pLocalPlayer->getPlayerID(), CMD_UNIT_ATTACKOBJECT,objectID,tempTarget->getObjectID()));
} else {
// move to object/structure
currentGame->getCommandManager().addCommand(Command(pLocalPlayer->getPlayerID(), CMD_UNIT_MOVE2OBJECT,objectID,tempTarget->getObjectID()));
}
} else {
// move this unit
currentGame->getCommandManager().addCommand(Command(pLocalPlayer->getPlayerID(), CMD_UNIT_MOVE2POS,objectID,(Uint32) xPos, (Uint32) yPos, (Uint32) true));
}
}
}
}
示例11: if
void Tile::setType(int newType) {
type = newType;
destroyedStructureTile = DestroyedStructure_None;
if (type == Terrain_Spice) {
spice = currentGame->randomGen.rand(RANDOMSPICEMIN, RANDOMSPICEMAX);
} else if (type == Terrain_ThickSpice) {
spice = currentGame->randomGen.rand(RANDOMTHICKSPICEMIN, RANDOMTHICKSPICEMAX);
} else if (type == Terrain_Dunes) {
} else {
spice = 0;
if (isRock()) {
sandRegion = NONE;
if (hasAnUndergroundUnit()) {
ObjectBase* current;
std::list<Uint32>::const_iterator iter;
iter = assignedUndergroundUnitList.begin();
do {
current = currentGame->getObjectManager().getObject(*iter);
++iter;
if(current == NULL)
continue;
unassignUndergroundUnit(current->getObjectID());
current->destroy();
} while(iter != assignedUndergroundUnitList.end());
}
if(type == Terrain_Mountain) {
if(hasANonInfantryGroundObject()) {
ObjectBase* current;
std::list<Uint32>::const_iterator iter;
iter = assignedNonInfantryGroundObjectList.begin();
do {
current = currentGame->getObjectManager().getObject(*iter);
++iter;
if(current == NULL)
continue;
unassignNonInfantryGroundObject(current->getObjectID());
current->destroy();
} while(iter != assignedNonInfantryGroundObjectList.end());
}
}
}
}
for (int i=location.x; i <= location.x+3; i++) {
for (int j=location.y; j <= location.y+3; j++) {
if (currentGameMap->tileExists(i, j)) {
currentGameMap->getTile(i, j)->clearTerrain();
}
}
}
}
示例12: Serialize
void XMLSerialization::Serialize(ObjectBase const & object)
{
const TypeInfo* typeInfo = object.GetTypeInfo();
assert(typeInfo != nullptr);
XMLElement * elem = _xmldoc.NewElement("Object");
if (_rootNode == nullptr)
{
_xmldoc.InsertFirstChild(elem);
}
else
{
_rootNode->InsertEndChild(elem);
}
SetClassAttributes(elem, typeInfo);
SerializeObjectMembers(elem, object, typeInfo);
_retElem = elem;
}
示例13: SerializeObjectMembers
void XMLSerialization::SerializeObjectMembers(XMLElement * elem, ObjectBase const & object, const TypeInfo* typeInfo)
{
const TypeInfo* parent = typeInfo->GetParent();
if (parent != nullptr)
SerializeObjectMembers(elem, object, parent);
for (auto mi : typeInfo->GetMembers())
{
if (mi->GetSerializable())
{
_retElem = nullptr;
object.SerializeMember(*this, mi);
if (_retElem != nullptr)
{
_retElem->SetName("Member");
SetMemberAttributes(_retElem, mi);
elem->InsertEndChild(_retElem);
}
}
}
}
示例14: rsaGetName
// Only to be called at a3d load time, before object is visible to user
// not thread safe
void rsaGetName(RsContext con, void * obj, const char **name) {
ObjectBase *ob = static_cast<ObjectBase *>(obj);
(*name) = ob->getName();
}
示例15: rsi_ObjDestroy
void rsi_ObjDestroy(Context *rsc, void *optr) {
ObjectBase *ob = static_cast<ObjectBase *>(optr);
rsc->removeName(ob);
ob->decUserRef();
}