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


C++ GridBox::getMaxX方法代码示例

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


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

示例1: Grid_RecalcBoxRouting

/**
 * @brief This function recalculates the routing in and around the box bounded by min and max.
 * @sa CMod_LoadRouting
 * @sa Grid_RecalcRouting
 * @param[in] mapTiles List of tiles the current (RMA-)map is composed of
 * @param[in] routing The routing map (either server or client map)
 * @param[in] box The box to recalc routing for
 * @param[in] list The local models list (a local model has a name starting with * followed by the model number)
 */
void Grid_RecalcBoxRouting (mapTiles_t* mapTiles, Routing& routing, const GridBox& box, const char** list)
{
	int x, y, z, actorSize, dir;

	/* check unit heights */
	for (actorSize = 1; actorSize <= ACTOR_MAX_SIZE; actorSize++) {
		GridBox rBox(box);	/* the box we will actually reroute */
		/* Offset the initial X and Y to compensate for larger actors when needed. */
		rBox.expandXY(actorSize - 1);
		/* also start one level above the box to measure high floors correctly */
		rBox.addOneZ();
		for (y = rBox.getMinY(); y <= rBox.getMaxY(); y++) {
			for (x = rBox.getMinX(); x <= rBox.getMaxX(); x++) {
				/** @note RT_CheckCell goes from top (7) to bottom (0) */
				for (z = rBox.getMaxZ(); z >= 0; z--) {
					const int newZ = RT_CheckCell(mapTiles, routing, actorSize, x, y, z, list);
					assert(newZ <= z);
					z = newZ;
				}
			}
		}
	}

	/* check connections */
	for (actorSize = 1; actorSize <= ACTOR_MAX_SIZE; actorSize++) {
		GridBox rBox(box);			/* the box we will actually reroute */
		rBox.expandXY(actorSize);	/* for connections, expand by the full size of the actor */
		rBox.addOneZ();
		for (y = rBox.getMinY(); y <= rBox.getMaxY(); y++) {
			for (x = rBox.getMinX(); x <= rBox.getMaxX(); x++) {
				for (dir = 0; dir < CORE_DIRECTIONS; dir++) {
					/* for places outside the model box, skip dirs that can not be affected by the model */
					if (x > box.getMaxX() && dir != 1 && dir != 5 && dir != 6)
						continue;
					if (y > box.getMaxY() && dir != 3 && dir != 5 && dir != 7)
						continue;
					if (actorSize == ACTOR_SIZE_NORMAL) {
						if (x < box.getMinX() && dir != 0 && dir != 4 && dir != 7)
							continue;
						if (y < box.getMinY() && dir != 2 && dir != 4 && dir != 6)
							continue;
					} else {
						/* the position of 2x2 actors is their lower left cell */
						if (x < box.getMinX() - 1 && dir != 0 && dir != 4 && dir != 7)
							continue;
						if (y < box.getMinY() - 1 && dir != 2 && dir != 4 && dir != 6)
							continue;
					}
				//	RT_UpdateConnectionColumn(mapTiles, routing, actorSize, x, y, dir, list);
					RT_UpdateConnectionColumn(mapTiles, routing, actorSize, x, y, dir, list, rBox.getMinZ(), rBox.getMaxZ());
				}
			}
		}
	}
}
开发者ID:cigo,项目名称:ufoai,代码行数:64,代码来源:grid.cpp


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