What replaces unit_type??

Discussion among members of the development team.

Moderator: Forum Moderators

Post Reply
Ryo
Inactive Developer
Posts: 18
Joined: August 23rd, 2005, 12:50 pm

What replaces unit_type??

Post by Ryo »

Hello.

I'm trying to fix ai_python.cpp (which is quite broken, haven't worked on it for some time), and I wonder how to check whether a unit eg heals or not (same question applies to is_leader, illuminates, and other abilities).

Code used to be bool unit_type::heals( ) and friends, but apparently it was replaced by something else I can't quite figure out :)

Somebody pointed to unit_abilities.cpp:unit::get_ability_bool but it does check adjacent units, not something I want - I'd like to know for one specific unit, to export that data to Python scripts...
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Post by Boucman »

unit_types hasn't disapeared, however most of the data in it is now copied into the unit...
and the unit isn't linked to it's base type anymore

it's still possible to find back the type (see how generate_random_traits does it) however, most of the type there is a corresponding function in unit that will do the trick


for more details, ask Xan
Fight key loggers: write some perl using vim
Post Reply