当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectBase::getObjectID方法代码示例

本文整理汇总了C++中ObjectBase::getObjectID方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectBase::getObjectID方法的具体用法?C++ ObjectBase::getObjectID怎么用?C++ ObjectBase::getObjectID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjectBase的用法示例。


在下文中一共展示了ObjectBase::getObjectID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setType

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();
            }
        }
    }
}
开发者ID:binarycrusader,项目名称:dunelegacy,代码行数:59,代码来源:Tile.cpp

示例2: handleAttackClick

void UnitBase::handleAttackClick(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();

				currentGame->getCommandManager().addCommand(Command(pLocalPlayer->getPlayerID(), CMD_UNIT_ATTACKOBJECT,objectID,tempTarget->getObjectID()));
			} else {
				// attack pos
				currentGame->getCommandManager().addCommand(Command(pLocalPlayer->getPlayerID(), CMD_UNIT_ATTACKPOS,objectID,(Uint32) xPos, (Uint32) yPos, (Uint32) true));
			}
		}
	}

}
开发者ID:katlogic,项目名称:dunelegacy,代码行数:16,代码来源:UnitBase.cpp


注:本文中的ObjectBase::getObjectID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。