GameLib_SearchEnt

This commit is contained in:
2014-06-28 19:58:38 +02:00
committed by Valeriano A.R
parent ef1f660f24
commit 61c3e0d048
2 changed files with 27 additions and 1 deletions

View File

@@ -507,6 +507,25 @@ void GameLib_ForEachEnt(int (*func)(Entity ent)){
} }
/////////////////////////////
// GameLib_SearchEnt
//
// Searches throught the entities.
Entity GameLib_SearchEnt(int (*func)(Entity ent,void *d),void *d){
int i;
Entity ent=NULL;
for(i=0;i<_n_entities;i++){
if(!_entity[i])
continue;
if(func(_entity[i],d)){
ent=_entity[i];
break;
}
}
return ent;
}
///////////////////////////// /////////////////////////////
// GameLib_PlaySound // GameLib_PlaySound
// //

View File

@@ -88,12 +88,19 @@ void GameLib_DelEnts();
///////////////////////////// /////////////////////////////
// GameLib_ForEachEn // GameLib_ForEachEnt
// //
// Iterates every entity. // Iterates every entity.
void GameLib_ForEachEnt(int (*func)(Entity ent)); void GameLib_ForEachEnt(int (*func)(Entity ent));
/////////////////////////////
// GameLib_SearchEnt
//
// Searches throught the entities.
Entity GameLib_SearchEnt(int (*func)(Entity ent,void *d),void *d);
///////////////////////////// /////////////////////////////
// GameLib_PlaySound // GameLib_PlaySound
// //