本文整理汇总了C++中Tile::__internalAddThing方法的典型用法代码示例。如果您正苦于以下问题:C++ Tile::__internalAddThing方法的具体用法?C++ Tile::__internalAddThing怎么用?C++ Tile::__internalAddThing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tile
的用法示例。
在下文中一共展示了Tile::__internalAddThing方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTile
Tile* IOMap::createTile(Item*& ground, Item* item, int px, int py, int pz)
{
Tile* tile;
if (ground) {
if ((item && item->isBlocking()) || ground->isBlocking()) {
tile = new StaticTile(px, py, pz);
} else {
tile = new DynamicTile(px, py, pz);
}
tile->__internalAddThing(ground);
ground->__startDecaying();
ground = nullptr;
} else {
tile = new StaticTile(px, py, pz);
}
return tile;
}
示例2: createTile
Tile* IOMapOTBM::createTile(Item*& ground, Item* item, int px, int py, int pz)
{
Tile* tile;
if(ground){
if((item && item->isBlocking(NULL)) || ground->isBlocking(NULL)){
// Tile is blocking with possibly some decoration, should be static
tile = new StaticTile(px, py, pz);
}
else{
// Tile is not blocking with possibly multiple items, use dynamic
tile = new DynamicTile(px, py, pz);
}
tile->__internalAddThing(ground);
ground->__startDecaying();
ground = NULL;
}
else{
// No ground on this tile, so it will always block
tile = new StaticTile(px, py, pz);
}
return tile;
}
示例3: createTile
Tile* IOMap::createTile(Item*& ground, Item* item, uint16_t px, uint16_t py, uint16_t pz)
{
Tile* tile = NULL;
if(ground)
{
if((item && item->isBlocking()) || ground->isBlocking()) //tile is blocking with possibly some decoration, should be static
tile = new StaticTile(px, py, pz);
else //tile is not blocking with possibly multiple items, use dynamic
tile = new DynamicTile(px, py, pz);
tile->__internalAddThing(ground);
if(ground->getDecaying() != DECAYING_TRUE)
{
ground->__startDecaying();
ground->setLoadedFromMap(true);
}
ground = NULL;
}
else //no ground on this tile, so it will always block
tile = new StaticTile(px, py, pz);
return tile;
}
示例4: loadMap
//.........这里部分代码省略.........
{
if(house)
std::cout << "[x:" << px << ", y:" << py << ", z:" << pz << "] House tile flagged as refreshing!";
tileflags |= TILESTATE_REFRESH;
}
break;
}
case OTBM_ATTR_ITEM:
{
Item* item = Item::CreateItem(propStream);
if(!item)
{
std::stringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] Failed to create item.";
setLastErrorString(ss.str());
return false;
}
if(house && item->isMoveable())
{
std::cout << "[Warning - IOMap::loadMap] Movable item in house: " << house->getHouseId();
std::cout << ", item type: " << item->getID() << ", at position " << px << "/" << py << "/";
std::cout << pz << std::endl;
delete item;
item = NULL;
}
else if(tile)
{
tile->__internalAddThing(item);
item->__startDecaying();
item->setLoadedFromMap(true);
}
else if(item->isGroundTile())
{
if(groundItem)
delete groundItem;
groundItem = item;
}
else
{
tile = createTile(groundItem, item, px, py, pz);
tile->__internalAddThing(item);
item->__startDecaying();
item->setLoadedFromMap(true);
}
break;
}
default:
{
std::stringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] Unknown tile attribute.";
setLastErrorString(ss.str());
return false;
}
}
}
示例5: loadMap
//.........这里部分代码省略.........
} else if ((flags & TILESTATE_NOPVPZONE) == TILESTATE_NOPVPZONE) {
tileflags |= TILESTATE_NOPVPZONE;
} else if ((flags & TILESTATE_PVPZONE) == TILESTATE_PVPZONE) {
tileflags |= TILESTATE_PVPZONE;
}
if ((flags & TILESTATE_NOLOGOUT) == TILESTATE_NOLOGOUT) {
tileflags |= TILESTATE_NOLOGOUT;
}
break;
}
case OTBM_ATTR_ITEM: {
Item* item = Item::CreateItem(propStream);
if (!item) {
std::ostringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] Failed to create item.";
setLastErrorString(ss.str());
return false;
}
if (isHouseTile && !item->isNotMoveable()) {
std::cout << "[Warning - IOMap::loadMap] Moveable item with ID: " << item->getID() << ", in house: " << house->getId() << ", at position [x: " << px << ", y: " << py << ", z: " << pz << "]." << std::endl;
delete item;
item = nullptr;
} else {
if (item->getItemCount() <= 0) {
item->setItemCount(1);
}
if (tile) {
tile->__internalAddThing(item);
item->__startDecaying();
item->setLoadedFromMap(true);
} else if (item->isGroundTile()) {
delete ground_item;
ground_item = item;
} else {
tile = createTile(ground_item, item, px, py, pz);
tile->__internalAddThing(item);
item->__startDecaying();
item->setLoadedFromMap(true);
}
}
break;
}
default:
std::ostringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] Unknown tile attribute.";
setLastErrorString(ss.str());
return false;
}
}
NODE nodeItem = f.getChildNode(nodeTile, type);
while (nodeItem) {
if (type == OTBM_ITEM) {
PropStream stream;
f.getProps(nodeItem, stream);
Item* item = Item::CreateItem(stream);
示例6: loadMap
//.........这里部分代码省略.........
}
if((flags & TILESTATE_NOLOGOUT) == TILESTATE_NOLOGOUT){
tileflags |= TILESTATE_NOLOGOUT;
}
if((flags & TILESTATE_REFRESH) == TILESTATE_REFRESH){
if(house){
std::cout << "Warning [x:" << px << ", y:" << py << ", z:" << pz << "] " << " House tile flagged as refreshing!";
}
tileflags |= TILESTATE_REFRESH;
}
break;
}
case OTBM_ATTR_ITEM:
{
Item* item = Item::CreateItem(propStream);
if(!item){
std::stringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] " << "Failed to create item.";
setLastErrorString(ss.str());
return false;
}
if(isHouseTile && !item->isNotMoveable()){
std::cout << "Warning: [OTBM loader] Moveable item in house id = " << house->getId() << " Item type = " << item->getID() << std::endl;
delete item;
item = NULL;
}
else{
if(tile){
tile->__internalAddThing(item);
item->__startDecaying();
}
else if(item->isGroundTile()){
if(ground_item)
delete ground_item;
ground_item = item;
}
else{ // !tile
tile = createTile(ground_item, item, px, py, pz);
tile->__internalAddThing(item);
item->__startDecaying();
}
}
break;
}
default:
std::stringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] " << "Unknown tile attribute.";
setLastErrorString(ss.str());
return false;
break;
}
}
NODE nodeItem = f.getChildNode(nodeTile, type);
while(nodeItem){
if(type == OTBM_ITEM){
PropStream propStream;
f.getProps(nodeItem, propStream);