[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src action/command.c editor/editloop....
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src action/command.c editor/editloop.... |
Date: |
22 Jan 2004 17:18:27 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/22 17:18:25
Modified files:
src/action : command.c
src/editor : editloop.c
src/game : game.c
src/include : network.h player.h settings.h unit.h
src/network : network.c
src/stratagus : selection.c
src/ui : interface.c menus.c
src/unit : unit.c unit_draw.c
Log message:
Added TeamSelection Abilities. Not used by default
(Keep my in sync with CVS)
Patches:
Index: stratagus/src/action/command.c
diff -u stratagus/src/action/command.c:1.127
stratagus/src/action/command.c:1.128
--- stratagus/src/action/command.c:1.127 Wed Jan 21 05:41:57 2004
+++ stratagus/src/action/command.c Thu Jan 22 17:18:17 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: command.c,v 1.127 2004/01/20 18:41:57 nobody_ Exp $
+// $Id: command.c,v 1.128 2004/01/22 06:18:17 wizzard Exp $
//@{
@@ -1349,7 +1349,7 @@
// If the player doesn't have any units then this is pointless?
Players[player].Type = PlayerNeutral;
for (i = 0; i < NumPlayers; ++i) {
- if (i != player) {
+ if (i != player && Players[i].Team != Players[player].Team) {
Players[i].Allied &= ~(1 << player);
Players[i].Enemy &= ~(1 << player);
Players[player].Enemy &= ~(1 << i);
@@ -1358,6 +1358,8 @@
// We do this because Shared vision is a bit complex.
CommandSharedVision(i, 0, player);
CommandSharedVision(player, 0, i);
+ // Remove Selection from Quit Player
+ ChangeTeamSelectedUnits(&Players[player], NULL, 0, 0);
}
}
Index: stratagus/src/editor/editloop.c
diff -u stratagus/src/editor/editloop.c:1.157
stratagus/src/editor/editloop.c:1.158
--- stratagus/src/editor/editloop.c:1.157 Wed Jan 21 15:57:13 2004
+++ stratagus/src/editor/editloop.c Thu Jan 22 17:18:18 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: editloop.c,v 1.157 2004/01/21 04:57:13 jsalmon3 Exp $
+// $Id: editloop.c,v 1.158 2004/01/22 06:18:18 wizzard Exp $
//@{
@@ -623,7 +623,7 @@
i = UnitIndex;
while (y < TheUI.ButtonPanelY +
- TheUI.ButtonPanel.Graphic->Height - IconHeight) {
+ 640/3 - IconHeight) {
if (i >= MaxShownUnits) {
break;
}
Index: stratagus/src/game/game.c
diff -u stratagus/src/game/game.c:1.128 stratagus/src/game/game.c:1.129
--- stratagus/src/game/game.c:1.128 Wed Jan 21 05:41:58 2004
+++ stratagus/src/game/game.c Thu Jan 22 17:18:19 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: game.c,v 1.128 2004/01/20 18:41:58 nobody_ Exp $
+// $Id: game.c,v 1.129 2004/01/22 06:18:19 wizzard Exp $
//@{
@@ -241,7 +241,7 @@
int j;
for (i = 0; i < PlayerMax - 1; ++i) {
- if (Players[i].Type != PlayerPerson && Players[i].Type !=
PlayerComputer ) {
+ if (Players[i].Type != PlayerPerson && Players[i].Type !=
PlayerComputer) {
continue;
}
for (j = 0; j < PlayerMax - 1; ++j) {
@@ -258,6 +258,36 @@
}
/**
+** Man vs Machine whith Humans on a Team
+*/
+local void GameTypeManTeamVsMachine(void)
+{
+ int i;
+ int j;
+
+ for (i = 0; i < PlayerMax - 1; ++i) {
+ if (Players[i].Type != PlayerPerson && Players[i].Type !=
PlayerComputer) {
+ continue;
+ }
+ for (j = 0; j < PlayerMax - 1; ++j) {
+ if (i != j) {
+ if (Players[i].Type == Players[j].Type) {
+ CommandDiplomacy(i, DiplomacyAllied, j);
+ Players[i].SharedVision |= (1 << j);
+ } else {
+ CommandDiplomacy(i, DiplomacyEnemy, j);
+ }
+ }
+ }
+ if (Players[i].Type == PlayerPerson) {
+ Players[i].Team = 2;
+ } else {
+ Players[i].Team = 1;
+ }
+ }
+}
+
+/**
** CreateGame.
**
** Load map, graphics, sounds, etc
@@ -374,6 +404,9 @@
case SettingsGameTypeManVsMachine:
GameTypeManVsMachine();
break;
+ case SettingsGameTypeManTeamVsMachine:
+ GameTypeManTeamVsMachine();
+
// Future game type ideas
#if 0
Index: stratagus/src/include/network.h
diff -u stratagus/src/include/network.h:1.47
stratagus/src/include/network.h:1.48
--- stratagus/src/include/network.h:1.47 Mon Dec 22 16:52:33 2003
+++ stratagus/src/include/network.h Thu Jan 22 17:18:19 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: network.h,v 1.47 2003/12/22 05:52:33 wizzard Exp $
+// $Id: network.h,v 1.48 2004/01/22 06:18:19 wizzard Exp $
#ifndef __NETWORK_H__
#define __NETWORK_H__
@@ -66,6 +66,7 @@
MessageInitConfig, /// Setup message configure clients
MessageSync, /// Heart beat
+ MessageSelection, /// Update a Selection from Team Player
MessageQuit, /// Quit game
MessageQuitAck, /// Quit reply - UNUSED YET - Protocol
Version 2 - Reserved for menus
MessageResend, /// Resend message
@@ -146,6 +147,23 @@
} NetworkChat;
/**
+** Network Selection Info
+*/
+typedef struct _network_selection_header_ {
+ unsigned NumberSent : 6; /// New Number Selected
+ unsigned Add : 1; /// Adding to Selection
+ unsigned Remove : 1; /// Removing from Selection
+ unsigned char Type[MaxNetworkCommands]; /// Command
+} NetworkSelectionHeader;
+
+/**
+** Network Selection Update
+*/
+typedef struct _network_selection_ {
+ UnitRef Unit[4]; /// Selection Units
+} NetworkSelection;
+
+/**
** Network packet header.
**
** Header for the packet.
@@ -197,6 +215,8 @@
/// Send extended network command.
extern void NetworkSendExtendedCommand(int command, int arg1, int arg2, int
arg3,
int arg4, int status);
+ /// Send Selections to Team
+extern void NetworkSendSelection(Unit** units, int count);
/// Register ccl functions related to network
extern void NetworkCclRegister(void);
//@}
Index: stratagus/src/include/player.h
diff -u stratagus/src/include/player.h:1.86 stratagus/src/include/player.h:1.87
--- stratagus/src/include/player.h:1.86 Wed Jan 21 03:44:56 2004
+++ stratagus/src/include/player.h Thu Jan 22 17:18:19 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: player.h,v 1.86 2004/01/20 16:44:56 nobody_ Exp $
+// $Id: player.h,v 1.87 2004/01/22 06:18:19 wizzard Exp $
#ifndef __PLAYER_H__
#define __PLAYER_H__
@@ -538,7 +538,7 @@
/// Two players share vision
#define PlayersShareVision(a, b) ((Players[a].SharedVision & (1 << (b))) &&
(Players[b].SharedVision & (1 << (a))) )
/// Players are on the same team (FIXME: use team)
-#define PlayersTeamed(a, b) ((Players[a].Allied & (1 << (b))) &&
(Players[b].Allied & (1 << (a))) )
+#define PlayersTeamed(a, b) (Players[a].Team == Players[b].Team)
/// Allowed to select multiple units, maybe not mine
#define CanSelectMultipleUnits(player) ((player) == ThisPlayer ||
PlayersTeamed(ThisPlayer->Player, (player)->Player))
Index: stratagus/src/include/settings.h
diff -u stratagus/src/include/settings.h:1.32
stratagus/src/include/settings.h:1.33
--- stratagus/src/include/settings.h:1.32 Mon Dec 22 16:52:34 2003
+++ stratagus/src/include/settings.h Thu Jan 22 17:18:20 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: settings.h,v 1.32 2003/12/22 05:52:34 wizzard Exp $
+// $Id: settings.h,v 1.33 2004/01/22 06:18:20 wizzard Exp $
#ifndef __SETTINGS_H__
#define __SETTINGS_H__
@@ -112,6 +112,7 @@
SettingsGameTypeTopVsBottom,
SettingsGameTypeLeftVsRight,
SettingsGameTypeManVsMachine,
+ SettingsGameTypeManTeamVsMachine,
// Future game type ideas
#if 0
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.249 stratagus/src/include/unit.h:1.250
--- stratagus/src/include/unit.h:1.249 Wed Jan 21 05:41:58 2004
+++ stratagus/src/include/unit.h Thu Jan 22 17:18:20 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.h,v 1.249 2004/01/20 18:41:58 nobody_ Exp $
+// $Id: unit.h,v 1.250 2004/01/22 06:18:20 wizzard Exp $
#ifndef __UNIT_H__
#define __UNIT_H__
@@ -543,6 +543,7 @@
unsigned Destroyed : 1; /// unit is
destroyed pending reference
unsigned Removed : 1; /// unit is
removed (not on map)
unsigned Selected : 1; /// unit is
selected
+ unsigned TeamSelected; /// unit is selected by a team
member.
unsigned Constructed : 1; /// Unit is in
construction
unsigned Active : 1; ///
Unit is active for AI
@@ -733,8 +734,10 @@
extern void (*DrawSelection)(Uint32, int, int, int, int);
extern int MaxSelectable; /// How many units
could be selected
-extern Unit** Selected; ///
currently selected units
-extern int NumSelected; /// how
many units selected
+extern Unit** Selected; /// currently selected units
+extern Unit** TeamSelected[PlayerMax]; /// teams currently selected units
+extern int NumSelected; /// how many units selected
+extern int NumTeamSelected[PlayerMax]; /// Number of Units a team member
has selected
/*----------------------------------------------------------------------------
@@ -1010,6 +1013,8 @@
extern void UnSelectAll(void);
/// Select group as selection
extern void ChangeSelectedUnits(Unit** units, int num_units);
+ /// Changed TeamUnit Selection
+extern void ChangeTeamSelectedUnits(Player* player, Unit** units, int adjust,
int count);
/// Add a unit to selection
extern int SelectUnit(Unit* unit);
/// Select one unit as selection
Index: stratagus/src/network/network.c
diff -u stratagus/src/network/network.c:1.127
stratagus/src/network/network.c:1.128
--- stratagus/src/network/network.c:1.127 Mon Jan 19 09:36:28 2004
+++ stratagus/src/network/network.c Thu Jan 22 17:18:21 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: network.c,v 1.127 2004/01/18 22:36:28 nobody_ Exp $
+// $Id: network.c,v 1.128 2004/01/22 06:18:21 wizzard Exp $
//@{
@@ -621,6 +621,97 @@
}
/**
+** Sends My Selections to Teamates
+**
+** @param units Units to send
+** @param count Number of units to send
+**
+*/
+global void NetworkSendSelection(Unit** units, int count)
+{
+ static NetworkPacket packet;
+ NetworkSelectionHeader* header;
+ NetworkSelection* selection;
+ int unitcount;
+ int ref;
+ int i;
+
+ //
+ // Build packet of Up to MaxNetworkCommands messages.
+ // FIXME: handle multiple packets (units > MaxNetworkCommands * 4
+ //
+ header = (NetworkSelectionHeader*)&(packet.Header);
+ header->NumberSent = count;
+ header->Add = 0;
+ header->Remove = 0;
+ unitcount = 0;
+ DebugLevel3("Time: %lu " _C_ ncq[0].Time);
+ for (i = 0; i <= (count / 4); ++i) {
+ DebugCheck(i > MaxNetworkCommands);
+ header->Type[i] = MessageSelection;
+ selection = (NetworkSelection*)&packet.Command[i];
+ for (ref = 0; ref < 4 && unitcount < count; ++ref) {
+ selection->Unit[ref] =
htons(UnitNumber(units[unitcount++]));
+ }
+ }
+ DebugLevel3("\n");
+
+ unitcount = i;
+
+ for (; i < MaxNetworkCommands; ++i) {
+ packet.Header.Type[i] = MessageNone;
+ }
+
+ //
+ // Send the Constructed packet to team members
+ //
+ for (i = 0; i < HostsCount; ++i) {
+ if (Players[Hosts[i].PlyNr].Team == ThisPlayer->Team) {
+ ref = NetSendUDP(NetworkFildes, Hosts[i].Host,
Hosts[i].Port,
+ &packet, sizeof(NetworkPacketHeader) +
sizeof(NetworkSelection) * unitcount);
+ DebugLevel3Fn("Sending %d to %d.%d.%d.%d:%d\n" _C_
+ ref _C_ NIPQUAD(ntohl(Hosts[i].Host)) _C_
ntohs(Hosts[i].Port));
+ }
+ }
+
+}
+/**
+** Process Received Unit Selection
+**
+** @param packet Network Packet to Process
+**
+*/
+local void NetworkProcessSelection(NetworkPacket* packet, int player)
+{
+ int i;
+ int j;
+ Unit* units[UnitMax];
+ NetworkSelectionHeader* header;
+ NetworkSelection* selection;
+ int adjust;
+ int count;
+ int unitcount;
+
+ header = (NetworkSelectionHeader*)&(packet->Header);
+ //
+ // Create Unit Array
+ //
+ count = header->NumberSent;
+ adjust = (header->Add << 1) | header->Remove;
+ unitcount = 0;
+
+ for (i = 0; header->Type[i] == MessageSelection; ++i) {
+ selection = (NetworkSelection*)&(packet->Command[i]);
+ for (j = 0; j < 4 && unitcount < count; ++j) {
+ units[unitcount++] = Units[ntohs(selection->Unit[j])];
+ }
+ }
+ DebugCheck(count != unitcount);
+
+ ChangeTeamSelectedUnits(&Players[player], units, adjust, count);
+}
+
+/**
** Remove a player from the game.
**
** @param player Player number
@@ -719,6 +810,12 @@
return;
}
player = Hosts[i].PlyNr;
+
+ // In a normal packet there is a least sync, selection may not have that
+ if (packet->Header.Type[0] == MessageSelection || commands == 0) {
+ NetworkProcessSelection(packet, player);
+ return;
+ }
//
// Parse the packet commands.
Index: stratagus/src/stratagus/selection.c
diff -u stratagus/src/stratagus/selection.c:1.68
stratagus/src/stratagus/selection.c:1.69
--- stratagus/src/stratagus/selection.c:1.68 Sat Jan 17 13:12:50 2004
+++ stratagus/src/stratagus/selection.c Thu Jan 22 17:18:21 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: selection.c,v 1.68 2004/01/17 02:12:50 wizzard Exp $
+// $Id: selection.c,v 1.69 2004/01/22 06:18:21 wizzard Exp $
//@{
@@ -54,11 +54,14 @@
-- Variables
----------------------------------------------------------------------------*/
-global int NumSelected; ///
Number of selected units
+global int NumSelected; /// Number of
selected units
+global int TeamNumSelected[PlayerMax]; /// how many units selected
global int MaxSelectable; /// Maximum number of
selected units
-global Unit** Selected; /// All
selected units
+global Unit** Selected; /// All
selected units
+global Unit** TeamSelected[PlayerMax]; /// teams currently selected units
-local unsigned GroupId; ///
Unique group # for automatic groups
+
+local unsigned GroupId; /// Unique
group # for automatic groups
/*----------------------------------------------------------------------------
-- Functions
@@ -80,6 +83,7 @@
unit->Selected = 0;
CheckUnitToBeDrawn(unit);
}
+
}
/**
@@ -127,8 +131,9 @@
}
UnSelectAll();
+ NetworkSendSelection(units, count);
for (n = i = 0; i < count; ++i) {
- if (!units[i]->Removed && units[i]->Type->Selectable) {
+ if (!units[i]->Removed && !units[i]->TeamSelected &&
units[i]->Type->Selectable) {
Selected[n++] = unit = units[i];
unit->Selected = 1;
if (count > 1) {
@@ -141,6 +146,56 @@
}
/**
+** Change A Unit Selection from my Team
+**
+** @param player The Player who is selecting the units
+** @param units The Units to add/remove
+** @param adjust 0 = reset, 1 = remove units, 2 = add units
+** @param count the number of units to be adjusted
+*/
+global void ChangeTeamSelectedUnits(Player* player, Unit** units, int adjust,
int count)
+{
+ int i;
+ int n;
+ Unit* unit;
+
+ switch (adjust) {
+ case 0:
+ // UnSelectAllTeam(player);
+ while (TeamNumSelected[player->Player]) {
+ unit =
TeamSelected[player->Player][--TeamNumSelected[player->Player]];
+ unit->TeamSelected &= ~(1 << player->Player);
+
TeamSelected[player->Player][TeamNumSelected[player->Player]] = NoUnitP;
// FIXME: only needed for old code
+ CheckUnitToBeDrawn(unit);
+ }
+ // FALL THROUGH
+ case 2:
+ for (i = 0; i < count; ++i) {
+ if (!units[i]->Removed &&
units[i]->Type->Selectable) {
+
TeamSelected[player->Player][TeamNumSelected[player->Player]++] = units[i];
+ units[i]->TeamSelected |= 1 <<
player->Player;
+ }
+ CheckUnitToBeDrawn(units[i]);
+ }
+ DebugCheck(TeamNumSelected[player->Player] >
MaxSelectable);
+ break;
+ case 1:
+ for (n = 0; n < TeamNumSelected[player->Player]; ++n) {
+ for (i = 0; i < count; ++i) {
+ if (units[i] ==
TeamSelected[player->Player][n]) {
+ TeamSelected[player->Player][n]
=
+
TeamSelected[player->Player][TeamNumSelected[player->Player]--];
+ }
+ }
+ }
+ DebugCheck(TeamNumSelected[player->Player] < 0);
+ break;
+ default:
+ DebugCheck(1);
+ }
+}
+
+/**
** Add a unit to the other selected units.
**
** @param unit Pointer to unit to add.
@@ -199,7 +254,24 @@
global void UnSelectUnit(Unit* unit)
{
int i;
+ int j;
+ if (unit->TeamSelected) {
+ for (i = 0; i < PlayerMax; ++i) {
+ if (unit->TeamSelected & (1 << i)) {
+ for (j = 0; TeamSelected[i][j] != unit; ++i) {
+ ;
+ }
+ DebugCheck(j >= TeamNumSelected[i]);
+
+ if (j < --TeamNumSelected[i]) {
+
+ TeamSelected[i][j] =
TeamSelected[i][TeamNumSelected[i]];
+ }
+ unit->TeamSelected &= ~(1 << i);
+ }
+ }
+ }
if (!unit->Selected) {
return;
}
@@ -291,6 +363,9 @@
if (!base->Type->Selectable && GameRunning) {
return 0;
}
+ if (base->TeamSelected) { // Somebody else onteam has this unit
+ return 0;
+ }
UnSelectAll();
Selected[0] = base;
@@ -320,6 +395,9 @@
if (unit == base) { // no need to have the same unit twice :)
continue;
}
+ if (unit->TeamSelected) { // Somebody else onteam has this unit
+ continue;
+ }
Selected[NumSelected++] = unit;
unit->Selected = 1;
CheckUnitToBeDrawn(unit);
@@ -334,6 +412,7 @@
}
}
+ NetworkSendSelection(Selected, NumSelected);
return NumSelected;
}
@@ -401,11 +480,15 @@
if (unit == base) { // no need to
have the same unit twice
continue;
}
+ if (unit->TeamSelected) { // Somebody else onteam has this unit
+ continue;
+ }
if (!SelectUnit(unit)) { // add unit to selection
return NumSelected;
}
}
+ NetworkSendSelection(Selected, NumSelected);
return NumSelected;
}
@@ -499,6 +582,9 @@
if (UnitUnusable(unit)) { // guess SelectUnits doesn't check
this
continue;
}
+ if (unit->TeamSelected) { // Somebody else onteam has this unit
+ continue;
+ }
table[n++] = unit;
if (n == MaxSelectable) {
break;
@@ -754,6 +840,9 @@
if (unit->Type->UnitType == UnitTypeFly) {
continue;
}
+ if (unit->TeamSelected) { // Somebody else onteam has this unit
+ continue;
+ }
table[n++] = unit;
if (n == MaxSelectable) {
break;
@@ -806,6 +895,9 @@
if (unit->Type->UnitType != UnitTypeFly) {
continue;
}
+ if (unit->TeamSelected) { // Somebody else onteam has this unit
+ continue;
+ }
table[n++] = unit;
if (n == MaxSelectable) {
break;
@@ -873,6 +965,9 @@
if (unit->Type->UnitType == UnitTypeFly) {
continue;
}
+ if (unit->TeamSelected) { // Somebody else onteam has this unit
+ continue;
+ }
table[n++] = unit;
if (n == MaxSelectable) {
break;
@@ -944,6 +1039,9 @@
if (unit->Type->UnitType != UnitTypeFly) {
continue;
}
+ if (unit->TeamSelected) { // Somebody else onteam has this unit
+ continue;
+ }
table[n++] = unit;
if (n == MaxSelectable) {
break;
@@ -964,9 +1062,17 @@
*/
global void InitSelections(void)
{
+ int i;
+
if (!Selected) {
Selected = malloc(MaxSelectable * sizeof(Unit*));
}
+
+ for (i = 0; i < PlayerMax; ++i) {
+ if (!TeamSelected[i]) {
+ TeamSelected[i] = malloc(MaxSelectable * sizeof(Unit*));
+ }
+ }
}
/**
@@ -980,7 +1086,7 @@
char* ref;
CLprintf(file, "\n--- -----------------------------------------\n");
- CLprintf(file, "--- MODULE: selection $Id: selection.c,v 1.68
2004/01/17 02:12:50 wizzard Exp $\n\n");
+ CLprintf(file, "--- MODULE: selection $Id: selection.c,v 1.69
2004/01/22 06:18:21 wizzard Exp $\n\n");
CLprintf(file, "SetGroupId(%d)\n", GroupId);
CLprintf(file, "Selection(%d, {", NumSelected);
@@ -997,11 +1103,19 @@
*/
global void CleanSelections(void)
{
+ int i;
+
GroupId = 0;
NumSelected = 0;
DebugCheck(NoUnitP); // Code fails if none
zero
free(Selected);
Selected = NULL;
+
+ for (i = 0; i < PlayerMax; ++i) {
+ free(TeamSelected[i]);
+ TeamSelected[i] = NULL;
+ TeamNumSelected[i] = 0;
+ }
}
// ----------------------------------------------------------------------------
Index: stratagus/src/ui/interface.c
diff -u stratagus/src/ui/interface.c:1.153 stratagus/src/ui/interface.c:1.154
--- stratagus/src/ui/interface.c:1.153 Sat Jan 17 02:17:32 2004
+++ stratagus/src/ui/interface.c Thu Jan 22 17:18:22 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: interface.c,v 1.153 2004/01/16 15:17:32 wizzard Exp $
+// $Id: interface.c,v 1.154 2004/01/22 06:18:22 wizzard Exp $
//@{
@@ -136,6 +136,7 @@
local void UiUnselectAll(void)
{
UnSelectAll();
+ NetworkSendSelection(NULL, 0);
SelectionChanged();
}
Index: stratagus/src/ui/menus.c
diff -u stratagus/src/ui/menus.c:1.610 stratagus/src/ui/menus.c:1.611
--- stratagus/src/ui/menus.c:1.610 Wed Jan 21 15:57:16 2004
+++ stratagus/src/ui/menus.c Thu Jan 22 17:18:22 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: menus.c,v 1.610 2004/01/21 04:57:16 jsalmon3 Exp $
+// $Id: menus.c,v 1.611 2004/01/22 06:18:22 wizzard Exp $
//@{
@@ -2005,7 +2005,7 @@
menu->Items[4 * j + 7].d.gem.state =
MI_GSTATE_UNCHECKED;
}
- if (ReplayGameType != ReplayNone) {
+ if (ReplayGameType != ReplayNone || ThisPlayer->Team ==
Players[i].Team) {
menu->Items[4 * j + 5].d.gem.state |=
MI_GSTATE_PASSIVE;
menu->Items[4 * j + 6].d.gem.state |=
MI_GSTATE_PASSIVE;
menu->Items[4 * j + 7].d.gem.state |=
MI_GSTATE_PASSIVE;
Index: stratagus/src/unit/unit.c
diff -u stratagus/src/unit/unit.c:1.367 stratagus/src/unit/unit.c:1.368
--- stratagus/src/unit/unit.c:1.367 Wed Jan 21 05:42:03 2004
+++ stratagus/src/unit/unit.c Thu Jan 22 17:18:24 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.367 2004/01/20 18:42:03 nobody_ Exp $
+// $Id: unit.c,v 1.368 2004/01/22 06:18:24 wizzard Exp $
//@{
@@ -615,6 +615,10 @@
UnSelectUnit(unit);
SelectionChanged();
}
+ // Remove unit from team selections
+ if (!unit->Selected && unit->TeamSelected) {
+ UnSelectUnit(unit);
+ }
// Unit is seen as under cursor
if (unit == UnitUnderCursor) {
@@ -3739,7 +3743,7 @@
int j;
CLprintf(file, "\n--- -----------------------------------------\n");
- CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.367 2004/01/20
18:42:03 nobody_ Exp $\n\n");
+ CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.368 2004/01/22
06:18:24 wizzard Exp $\n\n");
#if 0
//
Index: stratagus/src/unit/unit_draw.c
diff -u stratagus/src/unit/unit_draw.c:1.213
stratagus/src/unit/unit_draw.c:1.214
--- stratagus/src/unit/unit_draw.c:1.213 Thu Jan 22 07:01:29 2004
+++ stratagus/src/unit/unit_draw.c Thu Jan 22 17:18:24 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit_draw.c,v 1.213 2004/01/21 20:01:29 jsalmon3 Exp $
+// $Id: unit_draw.c,v 1.214 2004/01/22 06:18:24 wizzard Exp $
//@{
@@ -126,18 +126,30 @@
if (EditorRunning && unit == UnitUnderCursor &&
EditorState == EditorSelecting) {
color = ColorWhite;
- } else if (unit->Selected || (unit->Blink & 1)) {
+ } else if (unit->Selected || unit->TeamSelected || (unit->Blink & 1)) {
if (unit->Player->Player == PlayerNumNeutral) {
color = ColorYellow;
- } else if (unit->Player == ThisPlayer) {
- // FIXME: better allied?
+ } else if (unit->Selected && (unit->Player == ThisPlayer ||
+ PlayersTeamed(ThisPlayer->Player,
unit->Player->Player))) {
color = ColorGreen;
} else if (IsEnemy(ThisPlayer, unit)) {
color = ColorRed;
} else {
- color = unit->Player->Color;
+ int i;
+
+ for (i = 0; i < PlayerMax; ++i) {
+ if (unit->TeamSelected & (1 << i)) {
+ break;
+ }
+ }
+ if (i == PlayerMax) {
+ color = unit->Player->Color;
+ } else {
+ color = Players[i].Color;
+ }
}
- } else if (CursorBuilding && unit->Type->Building && unit->Player ==
ThisPlayer) {
+ } else if (CursorBuilding && unit->Type->Building &&
+ (unit->Player == ThisPlayer ||
PlayersTeamed(ThisPlayer->Player, unit->Player->Player))) {
// If building mark all own buildings
color = ColorGray;
} else {
@@ -632,7 +644,7 @@
{
#if 0
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.213
2004/01/21 20:01:29 jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.214
2004/01/22 06:18:24 wizzard Exp $\n\n");
CLprintf(file, "(mana-sprite \"%s\" %d %d %d %d)\n",
ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src action/command.c editor/editloop....,
address@hidden <=