Project

General

Profile

Feature #1225 ยป 0030-idex_lookup_.-Make-world-parameter-const.patch

Marko Lindqvist, 01/24/2025 11:56 PM

View differences:

common/idex.c
Lookup city with given id.
Returns NULL if the city is not registered (which is not an error).
**************************************************************************/
struct city *idex_lookup_city(struct world *iworld, int id)
struct city *idex_lookup_city(const struct world *iworld, int id)
{
struct city *pcity;
......
Lookup unit with given id.
Returns NULL if the unit is not registered (which is not an error).
**************************************************************************/
struct unit *idex_lookup_unit(struct world *iworld, int id)
struct unit *idex_lookup_unit(const struct world *iworld, int id)
{
struct unit *punit;
common/idex.h
extern "C" {
#endif /* __cplusplus */
/**************************************************************************
/***************************************************************************
idex = ident index: a lookup table for quick mapping of unit and city
id values to unit and city pointers.
***************************************************************************/
......
void idex_unregister_city(struct world *iworld, struct city *pcity);
void idex_unregister_unit(struct world *iworld, struct unit *punit);
struct city *idex_lookup_city(struct world *iworld, int id);
struct unit *idex_lookup_unit(struct world *iworld, int id);
struct city *idex_lookup_city(const struct world *iworld, int id);
struct unit *idex_lookup_unit(const struct world *iworld, int id);
#ifdef __cplusplus
}
    (1-1/1)