Freeciv21
Develop your civilization from humble roots to a global empire
idex.h
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2020 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 #pragma once
14 
15 /**************************************************************************
16  idex = ident index: a lookup table for quick mapping of unit and city
17  id values to unit and city pointers.
18 ***************************************************************************/
19 
20 // common
21 #include "world_object.h"
22 
23 void idex_init(struct world *iworld);
24 void idex_free(struct world *iworld);
25 
26 void idex_register_city(struct world *iworld, struct city *pcity);
27 void idex_register_unit(struct world *iworld, struct unit *punit);
28 
29 void idex_unregister_city(struct world *iworld, struct city *pcity);
30 void idex_unregister_unit(struct world *iworld, struct unit *punit);
31 
32 struct city *idex_lookup_city(struct world *iworld, int id);
33 struct unit *idex_lookup_unit(struct world *iworld, int id);
void idex_free(struct world *iworld)
Free the hashs.
Definition: idex.cpp:49
void idex_register_unit(struct world *iworld, struct unit *punit)
Register a unit into idex, with current punit->id.
Definition: idex.cpp:79
struct unit * idex_lookup_unit(struct world *iworld, int id)
Lookup unit with given id.
Definition: idex.cpp:152
void idex_unregister_city(struct world *iworld, struct city *pcity)
Remove a city from idex, with current pcity->id.
Definition: idex.cpp:97
void idex_init(struct world *iworld)
idex = ident index: a lookup table for quick mapping of unit and city id values to unit and city poin...
Definition: idex.cpp:40
struct city * idex_lookup_city(struct world *iworld, int id)
Lookup city with given id.
Definition: idex.cpp:139
void idex_unregister_unit(struct world *iworld, struct unit *punit)
Remove a unit from idex, with current punit->id.
Definition: idex.cpp:118
void idex_register_city(struct world *iworld, struct city *pcity)
Register a city into idex, with current pcity->id.
Definition: idex.cpp:61
Definition: city.h:291
Definition: unit.h:134