[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/action actions.c
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src/action actions.c |
Date: |
15 Dec 2003 08:17:04 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 03/12/15 08:17:04
Modified files:
src/action : actions.c
Log message:
More clean up
Patches:
Index: stratagus/src/action/actions.c
diff -u stratagus/src/action/actions.c:1.110
stratagus/src/action/actions.c:1.111
--- stratagus/src/action/actions.c:1.110 Sat Dec 13 19:20:49 2003
+++ stratagus/src/action/actions.c Mon Dec 15 08:17:04 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: actions.c,v 1.110 2003/12/13 08:20:49 wizzard Exp $
+// $Id: actions.c,v 1.111 2003/12/14 21:17:04 jsalmon3 Exp $
//@{
@@ -74,7 +74,7 @@
// Check for dead/removed goals.
//
if (goal->Destroyed || !goal->HP || goal->Removed ||
- goal->Orders[0].Action == UnitActionDie) {
+ goal->Orders[0].Action == UnitActionDie) {
return 1;
}
//
@@ -82,11 +82,12 @@
//
if (unit) {
// SharedVision makes all the rest of the checks meaningless
- if (IsSharedVision(unit->Player, goal) ||
unit->Player==goal->Player) {
+ if (IsSharedVision(unit->Player, goal) || unit->Player ==
goal->Player) {
return 0;
} else {
int x;
int y;
+
// Goal is invisible (by spell)
if (goal->Invisible) {
return 1;
@@ -102,8 +103,8 @@
if (goal->Type->VisibleUnderFog) {
return 0;
}
- for (x = goal->X; x < goal->X + goal->Type->TileWidth;
x++) {
- for (y = goal->Y; y < goal->Y +
goal->Type->TileHeight; y++) {
+ for (x = goal->X; x < goal->X + goal->Type->TileWidth;
++x) {
+ for (y = goal->Y; y < goal->Y +
goal->Type->TileHeight; ++y) {
if (IsMapFieldVisible(unit->Player, x,
y)) {
return 0;
}
@@ -195,9 +196,9 @@
}
/**
-** Unit has notwritten function.
+** Unit has not written function.
**
-** @param unit Unit pointer for notwritten action.
+** @param unit Unit pointer for not written action.
*/
local void HandleActionNotWritten(Unit* unit __attribute__((unused)))
{
@@ -325,8 +326,9 @@
local void HandleRegenerations(Unit* unit)
{
int f;
+
// Mana
- if (unit->Type->CanCastSpell && unit->Mana!=unit->Type->_MaxMana) {
+ if (unit->Type->CanCastSpell && unit->Mana != unit->Type->_MaxMana) {
unit->Mana++;
if (unit->Mana > unit->Type->_MaxMana) {
@@ -339,8 +341,8 @@
f = 0;
// Burn
- if (!unit->Removed && !unit->Destroyed && unit->Stats->HitPoints
- && unit->Orders[0].Action!=UnitActionBuilded ) {
+ if (!unit->Removed && !unit->Destroyed && unit->Stats->HitPoints &&
+ unit->Orders[0].Action != UnitActionBuilded ) {
f = (100 * unit->HP) / unit->Stats->HitPoints;
if (f <= unit->Type->BurnPercent) {
HitUnit(NoUnitP, unit, unit->Type->BurnDamageRate);
@@ -353,13 +355,13 @@
// Health doesn't regenerate while burning.
if (!f && unit->Stats) {
// Unit may not have stats assigned to it
- if (unit->Stats->RegenerationRate &&
unit->HP<unit->Stats->HitPoints) {
+ if (unit->Stats->RegenerationRate && unit->HP <
unit->Stats->HitPoints) {
unit->HP += unit->Stats->RegenerationRate;
if (unit->HP > unit->Stats->HitPoints) {
unit->HP = unit->Stats->HitPoints;
}
if (unit->Selected) {
- MustRedraw|=RedrawInfoPanel;
+ MustRedraw |= RedrawInfoPanel;
}
}
}
@@ -370,9 +372,8 @@
/**
** Handle things about the unit that decay over time
**
-** @param unit The unit that the decay is handled for
-** @param amount The amount of time to make up for.(in cycles)
-**
+** @param unit The unit that the decay is handled for
+** @param amount The amount of time to make up for.(in cycles)
*/
local void HandleBuffs(Unit* unit, int amount)
{
@@ -474,7 +475,7 @@
// o Or the order queue should be flushed.
//
if (unit->OrderCount > 1 &&
- (unit->Orders[0].Action == UnitActionStill ||
unit->OrderFlush)) {
+ (unit->Orders[0].Action == UnitActionStill ||
unit->OrderFlush)) {
if (unit->Removed) { // FIXME: johns I see this as
an error
DebugLevel0Fn("Flushing removed unit\n");
@@ -548,9 +549,8 @@
int buffsthiscycle;
int regenthiscycle;
- buffsthiscycle = !(GameCycle % CYCLES_PER_SECOND);
- regenthiscycle = !(GameCycle % CYCLES_PER_SECOND);
- blinkthiscycle = !(GameCycle % CYCLES_PER_SECOND);
+ buffsthiscycle = regenthiscycle =
+ blinkthiscycle = !(GameCycle % CYCLES_PER_SECOND);
//
// Must copy table, units could be removed.
@@ -615,7 +615,7 @@
}
#if defined(UNIT_ON_MAP) && 0 // debug unit store
- { const Unit* list;
+ { const Unit* list;
list = TheMap.Fields[unit->Y * TheMap.Width +
unit->X].Here.Units;
while (list) { // find the unit
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src/action actions.c,
address@hidden <=