MCPcopy Create free account
hub / github.com/TurningWheel/Barony / fillPathMap

Function fillPathMap

src/paths.cpp:982–1236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

980}
981
982void fillPathMap(int* pathMap, int x, int y, int zone)
983{
984 bool obstacle = true;
985
986 int index = y * MAPLAYERS + x * MAPLAYERS * map.height;
987 if ( !map.tiles[OBSTACLELAYER + index] && map.tiles[index]
988 && !(swimmingtiles[map.tiles[index]] || lavatiles[map.tiles[index]]) )
989 {
990 obstacle = false;
991 }
992 else if ( pathMap == pathMapFlying && !map.tiles[OBSTACLELAYER + index] )
993 {
994 obstacle = false;
995 }
996 if ( obstacle == false )
997 {
998 node_t* node;
999 list_t* list = checkTileForEntity(x, y);
1000 if ( list )
1001 {
1002 for ( node = list->first; node != NULL; node = node->next )
1003 {
1004 Entity* entity = (Entity*)node->element;
1005 if ( entity )
1006 {
1007 if ( isPathObstacle(entity) )
1008 {
1009 obstacle = true;
1010 break;
1011 }
1012 /*else if ( entity->behavior == &actWallBuilder || entity->behavior == &actWallBuster )
1013 {
1014 obstacle = false;
1015 break;
1016 }*/
1017 }
1018 }
1019 //list_FreeAll(list);
1020 //free(list);
1021 }
1022 }
1023
1024 if ( obstacle )
1025 {
1026 return;
1027 }
1028
1029 pathMap[y + x * map.height] = zone;
1030 bool repeat;
1031 do
1032 {
1033 repeat = false;
1034
1035 int u, v;
1036 for ( u = 0; u < map.width; u++ )
1037 {
1038 for ( v = 0; v < map.height; v++ )
1039 {

Callers 2

generatePathMapsFunction · 0.85
buildGraphMethod · 0.85

Calls 2

checkTileForEntityFunction · 0.85
isPathObstacleFunction · 0.85

Tested by

no test coverage detected