Project

General

Profile

Feature #1733 ยป 0035-Add-is_tiledef_near_tile-is_tiledef_card_near.patch

Marko Lindqvist, 11/11/2025 10:31 PM

View differences:

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 */
    (1-1/1)