/******************************************************************************* * UNITMOVE.H * * - Declarations and functions for unit movement * * * * SDLGL - SDLGLMAP_INFO * * (c)2002 - 2017 Paul Mueller * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Library General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * *******************************************************************************/ #ifndef _FSC_UNITMOVE_H_ #define _FSC_UNITMOVE_H_ /******************************************************************************* * INCLUDES * *******************************************************************************/ #include "game.h" /* GAME_MAX_LIST */ /******************************************************************************* * DEFINES * *******************************************************************************/ #define UNITMOVE_CHOOSE_NUMBER 1 /* Choose unit with this number */ #define UNITMOVE_CHOOSE_POSITION 2 /* Choose unit at this position */ #define UNITMOVE_CHOOSE_CURRENT 3 /* Choose unit at list-cursor */ #define UNITMOVE_CHOOSE_NEXT 4 /* Choose next unit in list */ #define UNITMOVE_CHOOSE_NEXTSKIP 5 /* Choose next unit in list and skip actual one */ /******************************************************************************* * TYPEDEFS * *******************************************************************************/ typedef struct { int unit_no; /* Number of unit to move */ int pos_x, pos_y; /* Map x/y position of chosen unit */ int map_pos; int owner_no; /* Owner of this unit */ char name[20 + 1]; /* Name of unit */ int hp[2]; /* UI_VALUE_ACT ..._FULL Unit_HPStr */ int moves[2]; /* UI_VALUE_ACT ..._FULL */ char type; /* Type of this unit, for AI -- Unit_ClassName */ /* Number of icon for display */ int attack, defense; /* Attack and defense values */ int ability; /* UNIT_AIROLE_* saves some func calls */ /* Class of ship */ int range_no; /* To save some call while playing */ /* The range of the ship: 0 / 1 / 2 */ /* RULES_RANGE_* */ int order; /* Actual order */ int cargo_type, cargo_load; /* Number of settlers, pduction-points */ int level; /* Has to be filled, if planet is chosen with unit */ char special_orders[10]; } UNIT_MNG_T; typedef struct { /* ----- The different info for the the actual unit chosen -------- */ char nation_no; /* Unit belongs to this nation */ /* --------- Info about unit in 'list[] for display --------------- */ /* ---------- Values of chosen unit itself ------------------------ */ int map_pos; char moves_left; char type; char range_no; char ability; char order_no; } UNIT_MNG_T; /******************************************************************************* * CODE * *******************************************************************************/ void unitmove_fill_manageinfo(UNIT_MNG_T *pmnginfo); void unitmoveCreate(int num, int pos, int type_no); void unitmoveGetManageInfo(char map_pos, UNIT_MNG_T *unit_mng); int unitmoveExecuteOrder(UNIT_MNG_T *unit_mng); int unitmove_choose(UNIT_MNG_T *unit_mng, int value, char which); void unitmove_set_order(int unit_no, int order, int target, int build); void unitmove_attack(int attacker_no, int defender_no); void unitmoveEndTurn(char nation_no); #endif /* _FSC_UNITMOVE_H_ */