MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Script_Unit_Pathfind_GetScore

Function Script_Unit_Pathfind_GetScore

src/script/unit.c:988–1006  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

986 * @return 256 if tile is not accessable, or a score for entering otherwise.
987 */
988static int16 Script_Unit_Pathfind_GetScore(uint16 packed, uint8 orient8)
989{
990 int16 res;
991 Unit *u;
992
993 if (g_scriptCurrentUnit == NULL) return 0;
994
995 u = g_scriptCurrentUnit;
996
997 if (g_dune2_enhanced) {
998 res = Unit_GetTileEnterScore(u, packed, orient8);
999 } else {
1000 res = Unit_GetTileEnterScore(u, packed, orient8 << 5);
1001 }
1002
1003 if (res == -1) res = 256;
1004
1005 return res;
1006}
1007
1008/**
1009 * Smoothen the route found by the pathfinder.

Callers 3

Script_Unit_PathfinderFunction · 0.85

Calls 1

Unit_GetTileEnterScoreFunction · 0.85

Tested by

no test coverage detected