Пример #1
0
/**
 * Get the score to enter this tile from a direction.
 *
 * @param packed The packed tile.
 * @param direction The direction we move on this tile.
 * @return 256 if tile is not accessable, or a score for entering otherwise.
 */
static int16 Script_Unit_Pathfind_GetScore(uint16 packed, uint8 orient8)
{
	int16 res;
	Unit *u;

	if (g_scriptCurrentUnit == NULL) return 0;

	u = g_scriptCurrentUnit;

	if (g_dune2_enhanced) {
		res = Unit_GetTileEnterScore(u, packed, orient8);
	} else {
		res = Unit_GetTileEnterScore(u, packed, orient8 << 5);
	}

	if (res == -1) res = 256;

	return res;
}
Пример #2
0
/**
 * Get the score to enter this tile from a direction.
 *
 * @param packed The packed tile.
 * @param direction The direction we move on this tile.
 * @return 256 if tile is not accessable, or a score for entering otherwise.
 */
static int16 Script_Unit_Pathfind_GetScore(uint16 packed, uint8 direction)
{
	int16 res;
	Unit *u;

	if (g_scriptCurrentUnit == NULL) return 0;

	u = g_scriptCurrentUnit;

	res = Unit_GetTileEnterScore(u, packed, direction << 5);

	if (res == -1) res = 256;

	return res;
}