[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src action/command.c include/actions....
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src action/command.c include/actions.... |
Date: |
31 Jan 2004 02:14:52 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/31 02:14:52
Modified files:
src/action : command.c
src/include : actions.h
src/ui : botpanel.c mouse.c
src/unit : script_unit.c unit.c
Log message:
Buildings work as transporters while doing other stuff. Minor fixes.
Patches:
Index: stratagus/src/action/command.c
diff -u stratagus/src/action/command.c:1.132
stratagus/src/action/command.c:1.133
--- stratagus/src/action/command.c:1.132 Wed Jan 28 07:54:45 2004
+++ stratagus/src/action/command.c Sat Jan 31 02:14:48 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: command.c,v 1.132 2004/01/27 20:54:45 jsalmon3 Exp $
+// $Id: command.c,v 1.133 2004/01/30 15:14:48 nobody_ Exp $
//@{
@@ -604,6 +604,27 @@
// Check if unit is still valid? (NETWORK!)
//
if (!unit->Removed && unit->Orders[0].Action != UnitActionDie) {
+ //
+ // For bunkers, don't go into an action. Just drop
everything here and now.
+ //
+ if (unit->Type->Building) {
+ int i;
+ Unit* uins;
+
+ // Unload all units.
+ uins = unit->UnitInside;
+ for (i = unit->InsideCount; i; --i, uins =
uins->NextContained) {
+ if (uins->Boarded) {
+ uins->X = unit->X;
+ uins->Y = unit->Y;
+ if (UnloadUnit(uins)) {
+ unit->BoardCount--;
+ }
+ }
+ }
+ return;
+ }
+
if (!(order = GetNextOrder(unit, flush))) {
return;
}
Index: stratagus/src/include/actions.h
diff -u stratagus/src/include/actions.h:1.65
stratagus/src/include/actions.h:1.66
--- stratagus/src/include/actions.h:1.65 Fri Jan 23 16:14:47 2004
+++ stratagus/src/include/actions.h Sat Jan 31 02:14:49 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: actions.h,v 1.65 2004/01/23 05:14:47 jsalmon3 Exp $
+// $Id: actions.h,v 1.66 2004/01/30 15:14:49 nobody_ Exp $
#ifndef __ACTIONS_H__
#define __ACTIONS_H__
@@ -190,8 +190,8 @@
extern int UnitShowAnimation(Unit* unit,const Animation* animation);
/// Handle the actions of all units each game cycle
extern void UnitActions(void);
- /// Handle Cloaked Unit's Visible
-extern void HandleCloak(void);
+ /// Unload an unit.
+extern int UnloadUnit(Unit* unit);
//@}
#endif // !__ACTIONS_H__
Index: stratagus/src/ui/botpanel.c
diff -u stratagus/src/ui/botpanel.c:1.106 stratagus/src/ui/botpanel.c:1.107
--- stratagus/src/ui/botpanel.c:1.106 Sat Jan 31 01:02:49 2004
+++ stratagus/src/ui/botpanel.c Sat Jan 31 02:14:50 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: botpanel.c,v 1.106 2004/01/30 14:02:49 nobody_ Exp $
+// $Id: botpanel.c,v 1.107 2004/01/30 15:14:50 nobody_ Exp $
//@{
@@ -104,7 +104,7 @@
char* cp;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: buttons $Id: botpanel.c,v 1.106 2004/01/30
14:02:49 nobody_ Exp $\n\n");
+ CLprintf(file, ";;; MODULE: buttons $Id: botpanel.c,v 1.107 2004/01/30
15:14:50 nobody_ Exp $\n\n");
for (i = 0; i < NumUnitButtons; ++i) {
CLprintf(file, "(define-button 'pos %d 'level %d 'icon '%s\n",
@@ -870,10 +870,11 @@
switch (CurrentButtons[button].Action) {
case ButtonUnload:
//
- // Unload on coast, transporter standing,
unload all units.
+ // Unload on coast, transporter standing,
unload all units right now.
+ // That or a bunker.
//
- if (NumSelected == 1 && Selected[0]->Orders[0].Action
== UnitActionStill &&
- CoastOnMap(Selected[0]->X,
Selected[0]->Y)) {
+ if ((NumSelected == 1 && Selected[0]->Orders[0].Action
== UnitActionStill &&
+ CoastOnMap(Selected[0]->X,
Selected[0]->Y)) || Selected[0]->Type->Building) {
SendCommandUnload(Selected[0],
Selected[0]->X, Selected[0]->Y, NoUnitP,
!(KeyModifiers & ModifierShift));
Index: stratagus/src/ui/mouse.c
diff -u stratagus/src/ui/mouse.c:1.175 stratagus/src/ui/mouse.c:1.176
--- stratagus/src/ui/mouse.c:1.175 Sat Jan 31 01:02:50 2004
+++ stratagus/src/ui/mouse.c Sat Jan 31 02:14:50 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mouse.c,v 1.175 2004/01/30 14:02:50 nobody_ Exp $
+// $Id: mouse.c,v 1.176 2004/01/30 15:14:50 nobody_ Exp $
//@{
@@ -139,7 +139,8 @@
dest = UnitUnderCursor;
// don't allow stopping enemy transporters!
- if (dest && dest->Type->Transporter &&
PlayersTeamed(ThisPlayer->Player, dest->Player->Player)) {
+ if (dest && dest->Type->Transporter && (!dest->Type->Building) &&
+ PlayersTeamed(ThisPlayer->Player,
dest->Player->Player)) {
// n0b0dy: So we are clicking on a transporter. We have to:
// 1) Flush the transporters orders.
// 2) Tell the transporter to follow the units. We have to
queue all
@@ -188,7 +189,11 @@
dest->Blink = 4;
DebugLevel0Fn("Board transporter\n");
// Let the transporter move to the unit. And QUEUE!!!
- SendCommandFollow(dest, unit, 0);
+ // Don't do it for buildings.
+ if (!dest->Type->Building) {
+ DebugLevel0Fn("Send command follow");
+ SendCommandFollow(dest, unit, 0);
+ }
SendCommandBoard(unit, -1, -1, dest, flush);
continue;
}
@@ -460,7 +465,8 @@
return;
}
} else {
- for (i = TheUI.NumTrainingButtons; i >= 0; --i)
{
+ i = min(TheUI.NumTrainingButtons,
Selected[0]->Data.Train.Count);
+ for (--i; i >= 0; --i) {
if (x >= TheUI.TrainingButtons[i].X &&
x <
TheUI.TrainingButtons[i].X + TheUI.TrainingButtons[i].Width + 7 &&
y >=
TheUI.TrainingButtons[i].Y &&
Index: stratagus/src/unit/script_unit.c
diff -u stratagus/src/unit/script_unit.c:1.103
stratagus/src/unit/script_unit.c:1.104
--- stratagus/src/unit/script_unit.c:1.103 Sat Jan 31 01:02:50 2004
+++ stratagus/src/unit/script_unit.c Sat Jan 31 02:14:51 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: script_unit.c,v 1.103 2004/01/30 14:02:50 nobody_ Exp $
+// $Id: script_unit.c,v 1.104 2004/01/30 15:14:51 nobody_ Exp $
//@{
@@ -855,6 +855,9 @@
unit->Blink = LuaToNumber(l, j + 1);
} else if (!strcmp(value, "moving")) {
unit->Moving = 1;
+ --j;
+ } else if (!strcmp(value, "boarded")) {
+ unit->Boarded = 1;
--j;
} else if (!strcmp(value, "rs")) {
unit->Rs = LuaToNumber(l, j + 1);
Index: stratagus/src/unit/unit.c
diff -u stratagus/src/unit/unit.c:1.383 stratagus/src/unit/unit.c:1.384
--- stratagus/src/unit/unit.c:1.383 Sat Jan 31 01:02:51 2004
+++ stratagus/src/unit/unit.c Sat Jan 31 02:14:51 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.383 2004/01/30 14:02:51 nobody_ Exp $
+// $Id: unit.c,v 1.384 2004/01/30 15:14:51 nobody_ Exp $
//@{
@@ -3631,6 +3631,9 @@
if (unit->Moving) {
CLprintf(file, " \"moving\",");
}
+ if (unit->Boarded) {
+ CLprintf(file, " \"boarded\",");
+ }
CLprintf(file, " \"rs\", %d,", unit->Rs);
CLprintf(file, " \"units-boarded-count\", %d,", unit->BoardCount);
CLprintf(file, "\n \"units-contained\", {");
@@ -3769,7 +3772,7 @@
int j;
CLprintf(file, "\n--- -----------------------------------------\n");
- CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.383 2004/01/30
14:02:51 nobody_ Exp $\n\n");
+ CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.384 2004/01/30
15:14:51 nobody_ Exp $\n\n");
#if 0
//