$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stratagus.h"
#include "unittype.h"
#include "animation.h"
#include "player.h"
#include "unit.h"
#include "missile.h"
#include "actions.h"
#include "sound.h"
#include "map.h"
#include "pathfinder.h"
action_attack.cpp - The attack action. | |
#define | WEAK_TARGET 2 |
#define | MOVE_TO_TARGET 4 |
#define | ATTACK_TARGET 5 |
void | AnimateActionAttack (CUnit &unit) |
Show attack animation. | |
static int | CheckForDeadGoal (CUnit &unit) |
static int | CheckForTargetInRange (CUnit &unit) |
static void | MoveToTarget (CUnit &unit) |
static void | AttackTarget (CUnit &unit) |
void | HandleActionAttack (CUnit &unit) |
Handle command attack. |
#define ATTACK_TARGET 5 |
#define MOVE_TO_TARGET 4 |
#define WEAK_TARGET 2 |
void AnimateActionAttack | ( | CUnit & | unit | ) |
Show attack animation.
Animate unit attack!
unit | Unit, for that the attack animation is played. |
static void AttackTarget | ( | CUnit & | unit | ) | [static] |
Handle attacking the target.
unit | Unit, for that the attack is handled. |
static int CheckForDeadGoal | ( | CUnit & | unit | ) | [static] |
Check for dead goal.
unit | Unit using the goal. |
static int CheckForTargetInRange | ( | CUnit & | unit | ) | [static] |
Change invalid target for new target in range.
unit | Unit to check if goal is in range |
void HandleActionAttack | ( | CUnit & | unit | ) |
Handle command attack.
Unit attacks!
I added a little trick, if SubAction&WEAK_TARGET is true the goal is a weak goal. This means the unit AI (little AI) could choose a new better goal.
unit | Unit, for that the attack is handled. |
static void MoveToTarget | ( | CUnit & | unit | ) | [static] |
Controls moving a unit to its target when attacking
unit | Unit that is attacking and moving |