Feature #1733 ยป 0035-Add-is_tiledef_near_tile-is_tiledef_card_near.patch
| common/tiledef.c | ||
|---|---|---|
|
/* common */
|
||
|
#include "game.h"
|
||
|
#include "map.h"
|
||
|
#include "tiledef.h"
|
||
| ... | ... | |
|
return TRUE;
|
||
|
}
|
||
|
/************************************************************************//**
|
||
|
Is there tiledef of the given type cardinally near tile?
|
||
|
(Does not check ptile itself.)
|
||
|
****************************************************************************/
|
||
|
bool is_tiledef_card_near(const struct civ_map *nmap, const struct tile *ptile,
|
||
|
const struct tiledef *ptd)
|
||
|
{
|
||
|
cardinal_adjc_iterate(nmap, ptile, adjc_tile) {
|
||
|
if (tile_matches_tiledef(ptd, adjc_tile)) {
|
||
|
return TRUE;
|
||
|
}
|
||
|
} cardinal_adjc_iterate_end;
|
||
|
return FALSE;
|
||
|
}
|
||
|
/************************************************************************//**
|
||
|
Is there tiledef of the given type near tile?
|
||
|
(Does not check ptile itself.)
|
||
|
****************************************************************************/
|
||
|
bool is_tiledef_near_tile(const struct civ_map *nmap, const struct tile *ptile,
|
||
|
const struct tiledef *ptd)
|
||
|
{
|
||
|
adjc_iterate(nmap, ptile, adjc_tile) {
|
||
|
if (tile_matches_tiledef(ptd, adjc_tile)) {
|
||
|
return TRUE;
|
||
|
}
|
||
|
} adjc_iterate_end;
|
||
|
return FALSE;
|
||
|
}
|
||
| common/tiledef.h | ||
|---|---|---|
|
bool tile_matches_tiledef(const struct tiledef *td, const struct tile *ptile)
|
||
|
fc__attribute((nonnull (1, 2)));
|
||
|
bool is_tiledef_card_near(const struct civ_map *nmap, const struct tile *ptile,
|
||
|
const struct tiledef *ptd);
|
||
|
bool is_tiledef_near_tile(const struct civ_map *nmap, const struct tile *ptile,
|
||
|
const struct tiledef *ptd);
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif /* __cplusplus */
|
||