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


C++ Tile::__internalAddThing方法代码示例

本文整理汇总了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;
}
开发者ID:Litho,项目名称:forgottenserver,代码行数:20,代码来源:iomap.cpp

示例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;
}
开发者ID:JoseEduardo,项目名称:otserv,代码行数:23,代码来源:iomapotbm.cpp

示例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;
}
开发者ID:Fir3element,项目名称:035,代码行数:24,代码来源:iomap.cpp

示例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;
							}
						}
					}
开发者ID:Fir3element,项目名称:035,代码行数:67,代码来源:iomap.cpp

示例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);
开发者ID:ArthurF5,项目名称:lforgottenserver,代码行数:67,代码来源:iomap.cpp

示例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);
开发者ID:JoseEduardo,项目名称:otserv,代码行数:67,代码来源:iomapotbm.cpp


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