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


C++ House::getExit方法代码示例

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


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

示例1: OnListBoxDoubleClick

void HousePalettePanel::OnListBoxDoubleClick(wxCommandEvent& event)
{
	House* house = reinterpret_cast<House*>(event.GetClientData());
	// I find it extremly unlikely that one actually wants the exit at 0,0,0, so just treat it as the null value
	if(house && house->getExit() != Position(0,0,0)) {
		gui.CenterOnPosition(house->getExit());
	}
}
开发者ID:Codex-NG,项目名称:rme,代码行数:8,代码来源:palette_house.cpp

示例2: undo


//.........这里部分代码省略.........

				if(oldtile->isSelected())
					editor.selection.addInternal(oldtile);
				if(newtile->isSelected())
					editor.selection.removeInternal(newtile);

				if(newtile->getHouseID() != oldtile->getHouseID())
				{
					// oooooomggzzz we need to remove it from the appropriate house!
					House* house = editor.map.houses.getHouse(newtile->getHouseID());
					if(house)
					{
						house->removeTile(newtile);
					}
					else
					{
						// Set tile house to 0, house has been removed
						newtile->setHouse(nullptr);
					}

					house = editor.map.houses.getHouse(oldtile->getHouseID());
					if(house)
					{
						house->addTile(oldtile);
					}
				}
				if(oldtile->spawn)
				{
					if(newtile->spawn)
					{
						if(*oldtile->spawn != *newtile->spawn)
						{
							editor.map.removeSpawn(newtile);
							editor.map.addSpawn(oldtile);
						}
					}
					else
					{
						editor.map.addSpawn(oldtile);
					}
				}
				else if(newtile->spawn)
				{
					editor.map.removeSpawn(newtile);
				}
				*data = newtile;
				
				
				// Update client dirty list
				if(editor.IsLiveClient() && dirty_list && type != ACTION_REMOTE)
				{
					// Local action, assemble changes
					dirty_list->AddChange(c);
				}
			} break;
			case CHANGE_MOVE_HOUSE_EXIT:
			{
				std::pair<uint32_t, Position>* p = reinterpret_cast<std::pair<uint32_t, Position>* >(c->data);
				ASSERT(p);
				House* whathouse = editor.map.houses.getHouse(p->first);
				if(whathouse)
				{
					Position oldpos = whathouse->getExit();
					whathouse->setExit(p->second);
					p->second = oldpos;
				}
			} break;
			case CHANGE_MOVE_WAYPOINT:
			{
				std::pair<std::string, Position>* p = reinterpret_cast<std::pair<std::string, Position>* >(c->data);
				ASSERT(p);
				Waypoint* wp = editor.map.waypoints.getWaypoint(p->first);

				if(wp)
				{
					// Change the tiles
					TileLocation* oldtile = editor.map.getTileL(wp->pos);
					TileLocation* newtile = editor.map.getTileL(p->second);
					
					// Only need to remove from old if it actually exists
					if(p->second != Position())
						if(oldtile && oldtile->getWaypointCount() > 0)
							oldtile->decreaseWaypointCount();

					newtile->increaseWaypointCount();

					// Update shit
					Position oldpos = wp->pos;
					wp->pos = p->second;
					p->second = oldpos;
				}
			} break;
			default:
			break;
		}
		++it;
	}
	editor.selection.finish(Selection::INTERNAL);
	commited = false;
}
开发者ID:Arydia,项目名称:rme,代码行数:101,代码来源:action.cpp

示例3: commit


//.........这里部分代码省略.........
					}
					if(oldtile->spawn)
					{
						if(newtile->spawn)
						{
							if(*oldtile->spawn != *newtile->spawn)
							{
								editor.map.removeSpawn(oldtile);
								editor.map.addSpawn(newtile);
							}
						}
						else
						{
							// Spawn has been removed
							editor.map.removeSpawn(oldtile);
						}
					}
					else if(newtile->spawn)
					{
						editor.map.addSpawn(newtile);
					}

					//oldtile->update();
					if(oldtile->isSelected())
						editor.selection.removeInternal(oldtile);

					*data = oldtile;
				}
				else
				{
					*data = editor.map.allocator(location);
					if(newtile->getHouseID() != 0)
					{
						// oooooomggzzz we need to add it to the appropriate house!
						House* house = editor.map.houses.getHouse(newtile->getHouseID());
						if(house)
						{
							house->addTile(newtile);
						}
					}

					if(newtile->spawn)
						editor.map.addSpawn(newtile);

				}
				// Mark the tile as modified
				newtile->modify();

				// Update client dirty list
				if(editor.IsLiveClient() && dirty_list && type != ACTION_REMOTE)
				{
					// Local action, assemble changes
					dirty_list->AddChange(c);
				}
			} break;
			case CHANGE_MOVE_HOUSE_EXIT:
			{
				std::pair<uint32_t, Position>* p = reinterpret_cast<std::pair<uint32_t, Position>* >(c->data);
				ASSERT(p);
				House* whathouse = editor.map.houses.getHouse(p->first);

				if(whathouse)
				{
					Position oldpos = whathouse->getExit();
					whathouse->setExit(p->second);
					p->second = oldpos;
				}
			} break;
			case CHANGE_MOVE_WAYPOINT:
			{
				std::pair<std::string, Position>* p = reinterpret_cast<std::pair<std::string, Position>* >(c->data);
				ASSERT(p);
				Waypoint* wp = editor.map.waypoints.getWaypoint(p->first);

				if(wp) {
					// Change the tiles
					TileLocation* oldtile = editor.map.getTileL(wp->pos);
					TileLocation* newtile = editor.map.getTileL(p->second);
					
					// Only need to remove from old if it actually exists
					if(p->second != Position())
						if(oldtile && oldtile->getWaypointCount() > 0)
							oldtile->decreaseWaypointCount();

					newtile->increaseWaypointCount();

					// Update shit
					Position oldpos = wp->pos;
					wp->pos = p->second;
					p->second = oldpos;
				}
			} break;
			default:
				break;
		}
		++it;
	}
	editor.selection.finish(Selection::INTERNAL);
	commited = true;
}
开发者ID:Arydia,项目名称:rme,代码行数:101,代码来源:action.cpp


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