MCPcopy Create free account
hub / github.com/diasurgical/devilution / MAI_Path

Function MAI_Path

Source/monster.cpp:2981–3022  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2979}
2980
2981BOOL MAI_Path(int i)
2982{
2983 MonsterStruct *Monst;
2984 BOOL clear;
2985
2986 if ((DWORD)i >= MAXMONSTERS)
2987 app_fatal("MAI_Path: Invalid monster %d", i);
2988
2989 Monst = &monster[i];
2990 if (Monst->MType->mtype != MT_GOLEM) {
2991 if (Monst->_msquelch == 0)
2992 return FALSE;
2993 if (Monst->_mmode != MM_STAND)
2994 return FALSE;
2995 if (Monst->_mgoal != MGOAL_NORMAL && Monst->_mgoal != MGOAL_MOVE && Monst->_mgoal != MGOAL_SHOOT)
2996 return FALSE;
2997 if (Monst->_mx == 1 && Monst->_my == 0)
2998 return FALSE;
2999 }
3000
3001 clear = LineClearF1(
3002 PosOkMonst2,
3003 i,
3004 Monst->_mx,
3005 Monst->_my,
3006 Monst->_menemyx,
3007 Monst->_menemyy);
3008 if (!clear || Monst->_pathcount >= 5 && Monst->_pathcount < 8) {
3009 if (Monst->_mFlags & MFLAG_CAN_OPEN_DOOR)
3010 MonstCheckDoors(i);
3011 Monst->_pathcount++;
3012 if (Monst->_pathcount < 5)
3013 return FALSE;
3014 if (M_PathWalk(i))
3015 return TRUE;
3016 }
3017
3018 if (Monst->MType->mtype != MT_GOLEM)
3019 Monst->_pathcount = 0;
3020
3021 return FALSE;
3022}
3023
3024void MAI_Snake(int i)
3025{

Callers 2

MAI_GolumFunction · 0.85
ProcessMonstersFunction · 0.85

Calls 4

app_fatalFunction · 0.85
LineClearF1Function · 0.85
MonstCheckDoorsFunction · 0.85
M_PathWalkFunction · 0.85

Tested by

no test coverage detected