$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

src/action/actions.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "stratagus.h"
#include "video.h"
#include "unittype.h"
#include "animation.h"
#include "player.h"
#include "unit.h"
#include "actions.h"
#include "missile.h"
#include "interface.h"
#include "map.h"
#include "sound.h"
#include "spells.h"

actions.cpp - The actions.

unsigned SyncHash
static void(* HandleActionTable [256])(CUnit &)
static void UnitRotate (CUnit &unit, int rotate)
 Hash calculated to find sync failures.
int UnitShowAnimation (CUnit &unit, const CAnimation *anim)
 Handle the animation of a unit.
int UnitShowAnimationScaled (CUnit &unit, const CAnimation *anim, int scale)
 Handle the animation of a unit.
static void HandleActionNone (CUnit &unit)
static void HandleActionNotWritten (CUnit &unit)
static void HandleRegenerations (CUnit &unit)
static void HandleBuffs (CUnit &unit, int amount)
static void RunAction (unsigned char action, CUnit &unit)
static void HandleUnitAction (CUnit &unit)
void UnitActions ()
 Handle the actions of all units each game cycle.

Function Documentation

static void HandleActionNone ( CUnit unit  )  [static]

Unit does nothing!

Parameters:
unit Unit pointer for none action.

static void HandleActionNotWritten ( CUnit unit  )  [static]

Unit has not written function.

Parameters:
unit Unit pointer for not written action.

static void HandleBuffs ( CUnit unit,
int  amount 
) [static]

Handle things about the unit that decay over time

Parameters:
unit The unit that the decay is handled for
amount The amount of time to make up for.(in cycles)

static void HandleRegenerations ( CUnit unit  )  [static]

Increment a unit's health

Parameters:
unit the unit to operate on

static void HandleUnitAction ( CUnit unit  )  [static]

Handle the action of a unit.

Parameters:
unit Pointer to handled unit.

static void RunAction ( unsigned char  action,
CUnit unit 
) [static]

void UnitActions (  ) 

Handle the actions of all units each game cycle.

Update the actions of all units each game cycle.

Todo:
To improve the preformance use slots for waiting.

static void UnitRotate ( CUnit unit,
int  rotate 
) [static]

Hash calculated to find sync failures.

Rotate a unit

Parameters:
unit Unit to rotate
rotate Number of frames to rotate (>0 clockwise, <0 counterclockwise)

int UnitShowAnimation ( CUnit unit,
const CAnimation anim 
)

Handle the animation of a unit.

Show unit animation.

Parameters:
unit Unit of the animation.
anim Animation script to handle.
Returns:
The flags of the current script step.

int UnitShowAnimationScaled ( CUnit unit,
const CAnimation anim,
int  scale 
)

Handle the animation of a unit.

Show unit animation.

Parameters:
unit Unit of the animation.
anim Animation script to handle.
scale Scaling factor of the wait times in animation (8 means no scaling).
Returns:
The flags of the current script step.


Variable Documentation

void(* HandleActionTable[256])(CUnit &) [static]

Jump table for actions.

Note:
can move function into unit structure.

unsigned SyncHash

(C) Copyright 1998-2011 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.