Open source remastering of the Freespace 2 engine
aigoals.cpp File Reference
#include "ai/aigoals.h"
#include "globalincs/linklist.h"
#include "mission/missionlog.h"
#include "mission/missionparse.h"
#include "network/multi.h"
#include "network/multimsgs.h"
#include "object/object.h"
#include "object/objectdock.h"
#include "object/waypoint.h"
#include "parse/sexp.h"
#include "playerman/player.h"
#include "ship/ship.h"
#include "weapon/weapon.h"

Go to the source code of this file.


#define MAX_GOAL_PRIORITY   200
#define AI_GOAL_NOT_KNOWN   3
#define SHIP_STATUS_GONE   1


const char * Ai_goal_text (int goal)
void ai_maybe_add_form_goal (wing *wingp)
void ai_post_process_mission ()
int ai_query_goal_valid (int ship, int ai_goal_type)
void ai_remove_ship_goal (ai_info *aip, int index)
void ai_clear_ship_goals (ai_info *aip)
void ai_clear_wing_goals (int wingnum)
void ai_mission_wing_goal_complete (int wingnum, ai_goal *remove_goalp)
void ai_mission_goal_complete (ai_info *aip)
void ai_goal_purge_invalid_goals (ai_goal *aigp, ai_goal *goal_list, ai_info *aip, int ai_wingnum)
void ai_goal_purge_all_invalid_goals (ai_goal *aigp)
int ai_goal_find_dockpoint (int shipnum, int dock_type)
void ai_goal_fixup_dockpoints (ai_info *aip, ai_goal *aigp)
void ai_add_goal_sub_player (int type, int mode, int submode, char *target_name, ai_goal *aigp)
int ai_goal_find_empty_slot (ai_goal *goals, int active_goal)
int ai_goal_num (ai_goal *goals)
void ai_add_goal_sub_scripting (int type, int mode, int submode, int priority, char *target_name, ai_goal *aigp)
void ai_add_ship_goal_scripting (int mode, int submode, int priority, char *shipname, ai_info *aip)
void ai_add_ship_goal_player (int type, int mode, int submode, char *shipname, ai_info *aip)
void ai_add_wing_goal_player (int type, int mode, int submode, char *shipname, int wingnum)
void ai_add_goal_sub_sexp (int sexp, int type, ai_goal *aigp, char *actor_name)
int ai_find_goal_index (ai_goal *aigp, int mode, int submode, int priority)
int ai_remove_goal_sexp_sub (int sexp, ai_goal *aigp)
void ai_remove_wing_goal_sexp (int sexp, int wingnum)
void ai_add_ship_goal_sexp (int sexp, int type, ai_info *aip)
void ai_add_wing_goal_sexp (int sexp, int type, int wingnum)
void ai_add_goal_ship_internal (ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate)
void ai_add_goal_wing_internal (wing *wingp, int goal_type, char *name, int immediate)
void ai_copy_mission_wing_goal (ai_goal *aigp, ai_info *aip)
int ai_mission_goal_achievable (int objnum, ai_goal *aigp)
int ai_goal_priority_compare (const void *a, const void *b)
void prioritize_goals (ai_info *aip)
void validate_mission_goals (int objnum, ai_info *aip)
void ai_process_mission_orders (int objnum, ai_info *aip)
void ai_update_goal_references (ai_goal *goals, int type, const char *old_name, const char *new_name)
int query_referenced_in_ai_goals (ai_goal *goals, int type, const char *name)
char * ai_add_dock_name (const char *str)


int Ai_goal_signature
int Num_ai_dock_names = 0
char Ai_dock_names [MAX_AI_DOCK_NAMES][NAME_LENGTH]
ai_goal_list Ai_goal_names []
int Num_ai_goals = sizeof(Ai_goal_names) / sizeof(ai_goal_list)
char * Mode_text [MAX_AI_BEHAVIORS]

Macro Definition Documentation


Definition at line 53 of file aigoals.cpp.


Definition at line 54 of file aigoals.cpp.

#define AI_GOAL_NOT_KNOWN   3

Definition at line 55 of file aigoals.cpp.


Definition at line 56 of file aigoals.cpp.

#define MAX_GOAL_PRIORITY   200

Definition at line 40 of file aigoals.cpp.


Definition at line 35 of file aigoals.cpp.


Definition at line 36 of file aigoals.cpp.


Definition at line 38 of file aigoals.cpp.


Definition at line 37 of file aigoals.cpp.


Definition at line 46 of file aigoals.cpp.


Definition at line 47 of file aigoals.cpp.


Definition at line 1359 of file aigoals.cpp.

#define SHIP_STATUS_GONE   1

Definition at line 1357 of file aigoals.cpp.


Definition at line 1358 of file aigoals.cpp.


Definition at line 1360 of file aigoals.cpp.

Function Documentation

char* ai_add_dock_name ( const char *  str)

Definition at line 2427 of file aigoals.cpp.

void ai_add_goal_ship_internal ( ai_info aip,
int  goal_type,
char *  name,
int  docker_point,
int  dockee_point,
int  immediate 

Definition at line 1244 of file aigoals.cpp.

void ai_add_goal_sub_player ( int  type,
int  mode,
int  submode,
char *  target_name,
ai_goal aigp 

Definition at line 611 of file aigoals.cpp.

void ai_add_goal_sub_scripting ( int  type,
int  mode,
int  submode,
int  priority,
char *  target_name,
ai_goal aigp 

Definition at line 705 of file aigoals.cpp.

void ai_add_goal_sub_sexp ( int  sexp,
int  type,
ai_goal aigp,
char *  actor_name 

Definition at line 807 of file aigoals.cpp.

void ai_add_goal_wing_internal ( wing wingp,
int  goal_type,
char *  name,
int  immediate 

Definition at line 1324 of file aigoals.cpp.

void ai_add_ship_goal_player ( int  type,
int  mode,
int  submode,
char *  shipname,
ai_info aip 

Definition at line 757 of file aigoals.cpp.

void ai_add_ship_goal_scripting ( int  mode,
int  submode,
int  priority,
char *  shipname,
ai_info aip 

Definition at line 730 of file aigoals.cpp.

void ai_add_ship_goal_sexp ( int  sexp,
int  type,
ai_info aip 

Definition at line 1201 of file aigoals.cpp.

void ai_add_wing_goal_player ( int  type,
int  mode,
int  submode,
char *  shipname,
int  wingnum 

Definition at line 783 of file aigoals.cpp.

void ai_add_wing_goal_sexp ( int  sexp,
int  type,
int  wingnum 

Definition at line 1210 of file aigoals.cpp.

void ai_clear_ship_goals ( ai_info aip)

Definition at line 251 of file aigoals.cpp.

void ai_clear_wing_goals ( int  wingnum)

Definition at line 270 of file aigoals.cpp.

void ai_copy_mission_wing_goal ( ai_goal aigp,
ai_info aip 

Definition at line 1340 of file aigoals.cpp.

int ai_find_goal_index ( ai_goal aigp,
int  mode,
int  submode,
int  priority 

Definition at line 1017 of file aigoals.cpp.

int ai_goal_find_dockpoint ( int  shipnum,
int  dock_type 

Definition at line 488 of file aigoals.cpp.

int ai_goal_find_empty_slot ( ai_goal goals,
int  active_goal 

Definition at line 665 of file aigoals.cpp.

void ai_goal_fixup_dockpoints ( ai_info aip,
ai_goal aigp 

Definition at line 539 of file aigoals.cpp.

int ai_goal_num ( ai_goal goals)

Definition at line 691 of file aigoals.cpp.

int ai_goal_priority_compare ( const void a,
const void b 

Definition at line 1844 of file aigoals.cpp.

void ai_goal_purge_all_invalid_goals ( ai_goal aigp)

Definition at line 465 of file aigoals.cpp.

void ai_goal_purge_invalid_goals ( ai_goal aigp,
ai_goal goal_list,
ai_info aip,
int  ai_wingnum 

Definition at line 377 of file aigoals.cpp.

const char* Ai_goal_text ( int  goal)

Definition at line 96 of file aigoals.cpp.

void ai_maybe_add_form_goal ( wing wingp)

Definition at line 134 of file aigoals.cpp.

int ai_mission_goal_achievable ( int  objnum,
ai_goal aigp 

Definition at line 1365 of file aigoals.cpp.

void ai_mission_goal_complete ( ai_info aip)

Definition at line 360 of file aigoals.cpp.

void ai_mission_wing_goal_complete ( int  wingnum,
ai_goal remove_goalp 

Definition at line 300 of file aigoals.cpp.

void ai_post_process_mission ( )

Definition at line 159 of file aigoals.cpp.

void ai_process_mission_orders ( int  objnum,
ai_info aip 

Definition at line 1977 of file aigoals.cpp.

int ai_query_goal_valid ( int  ship,
int  ai_goal_type 

Determines if a goal is valid for a particular type of ship

shipShip type to test
ai_goal_typeGoal type to test

Definition at line 208 of file aigoals.cpp.

int ai_remove_goal_sexp_sub ( int  sexp,
ai_goal aigp 

Definition at line 1037 of file aigoals.cpp.

void ai_remove_ship_goal ( ai_info aip,
int  index 

Definition at line 231 of file aigoals.cpp.

void ai_remove_wing_goal_sexp ( int  sexp,
int  wingnum 

Definition at line 1175 of file aigoals.cpp.

void ai_update_goal_references ( ai_goal goals,
int  type,
const char *  old_name,
const char *  new_name 

Definition at line 2295 of file aigoals.cpp.

void prioritize_goals ( ai_info aip)

Definition at line 1892 of file aigoals.cpp.

int query_referenced_in_ai_goals ( ai_goal goals,
int  type,
const char *  name 

Definition at line 2362 of file aigoals.cpp.

void validate_mission_goals ( int  objnum,
ai_info aip 

Definition at line 1902 of file aigoals.cpp.

Variable Documentation

char Ai_dock_names[MAX_AI_DOCK_NAMES][NAME_LENGTH]

Definition at line 60 of file aigoals.cpp.

ai_goal_list Ai_goal_names[]
Initial value:
{ "Attack ship", AI_GOAL_CHASE, 0 },
{ "Dock", AI_GOAL_DOCK, 0 },
{ "Waypoints", AI_GOAL_WAYPOINTS, 0 },
{ "Waypoints once", AI_GOAL_WAYPOINTS_ONCE, 0 },
{ "Depart", AI_GOAL_WARP, 0 },
{ "Attack subsys", AI_GOAL_DESTROY_SUBSYSTEM, 0 },
{ "Form on wing", AI_GOAL_FORM_ON_WING, 0 },
{ "Undock", AI_GOAL_UNDOCK, 0 },
{ "Attack wing", AI_GOAL_CHASE_WING, 0 },
{ "Guard ship", AI_GOAL_GUARD, 0 },
{ "Disable ship", AI_GOAL_DISABLE_SHIP, 0 },
{ "Disarm ship", AI_GOAL_DISARM_SHIP, 0 },
{ "Attack any", AI_GOAL_CHASE_ANY, 0 },
{ "Ignore ship", AI_GOAL_IGNORE, 0 },
{ "Ignore ship (new)", AI_GOAL_IGNORE_NEW, 0 },
{ "Guard wing", AI_GOAL_GUARD_WING, 0 },
{ "Evade ship", AI_GOAL_EVADE_SHIP, 0 },
{ "Stay near ship", AI_GOAL_STAY_NEAR_SHIP, 0 },
{ "keep safe dist", AI_GOAL_KEEP_SAFE_DISTANCE, 0 },
{ "Rearm ship", AI_GOAL_REARM_REPAIR, 0 },
{ "Stay still", AI_GOAL_STAY_STILL, 0 },
{ "Play dead", AI_GOAL_PLAY_DEAD, 0 },
{ "Attack weapon", AI_GOAL_CHASE_WEAPON, 0 },
{ "Fly to ship", AI_GOAL_FLY_TO_SHIP, 0 },
Definition: aigoals.h:36
Definition: aigoals.h:37
#define AI_GOAL_DOCK
Definition: aigoals.h:30
Definition: aigoals.h:31
Definition: aigoals.h:38
Definition: aigoals.h:47
Definition: aigoals.h:41
#define AI_GOAL_WARP
Definition: aigoals.h:33
Definition: aigoals.h:42
Definition: aigoals.h:40
Definition: aigoals.h:52
Definition: aigoals.h:44
Definition: aigoals.h:57
Definition: aigoals.h:56
Definition: aigoals.h:53
Definition: aigoals.h:32
Definition: aigoals.h:43
Definition: aigoals.h:48
Definition: aigoals.h:39
Definition: aigoals.h:54
Definition: aigoals.h:29
Definition: aigoals.h:49
Definition: aigoals.h:34
Definition: aigoals.h:35

Definition at line 62 of file aigoals.cpp.

int Ai_goal_signature

Definition at line 58 of file aigoals.cpp.

char* Mode_text[MAX_AI_BEHAVIORS]

Definition at line 108 of file aicode.cpp.

int Num_ai_dock_names = 0

Definition at line 59 of file aigoals.cpp.

int Num_ai_goals = sizeof(Ai_goal_names) / sizeof(ai_goal_list)

Definition at line 90 of file aigoals.cpp.