stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src action/action_move.c include/play...


From: address@hidden
Subject: [Stratagus-CVS] stratagus/src action/action_move.c include/play...
Date: 24 Jan 2004 10:35:05 +1100

CVSROOT:        /home/strat
Module name:    stratagus
Changes by:      <address@hidden>       04/01/24 10:35:04

Modified files:
        src/action     : action_move.c 
        src/include    : player.h 
        src/network    : commands.c 
        src/ui         : mainscr.c 
        src/unit       : unit.c 

Log message:
        ReplayRevealMap Fixes, with selection and UI.
        Allies Can see full stats on buildings and units

Patches:
Index: stratagus/src/action/action_move.c
diff -u stratagus/src/action/action_move.c:1.80 
stratagus/src/action/action_move.c:1.81
--- stratagus/src/action/action_move.c:1.80     Wed Jan 21 05:41:57 2004
+++ stratagus/src/action/action_move.c  Sat Jan 24 10:35:00 2004
@@ -21,7 +21,7 @@
 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 //      GNU General Public License for more details.
 //
-//      $Id: action_move.c,v 1.80 2004/01/20 18:41:57 nobody_ Exp $
+//      $Id: action_move.c,v 1.81 2004/01/23 23:35:00 wizzard Exp $
 
 //@{
 
@@ -163,8 +163,10 @@
                        if (NumSelected == 1) { //  Remove building cursor
                                CancelBuildingMode();
                        }
-                       UnSelectUnit(unit);
-                       SelectionChanged();
+                       if (!ReplayRevealMap) {
+                               UnSelectUnit(unit);
+                               SelectionChanged();
+                       }
                }
 
                unit->IX = -xd * TileSizeX;
Index: stratagus/src/include/player.h
diff -u stratagus/src/include/player.h:1.87 stratagus/src/include/player.h:1.88
--- stratagus/src/include/player.h:1.87 Thu Jan 22 17:18:19 2004
+++ stratagus/src/include/player.h      Sat Jan 24 10:35:01 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: player.h,v 1.87 2004/01/22 06:18:19 wizzard Exp $
+//      $Id: player.h,v 1.88 2004/01/23 23:35:01 wizzard Exp $
 
 #ifndef __PLAYER_H__
 #define __PLAYER_H__
@@ -539,6 +539,8 @@
 #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].Team == Players[b].Team)
+       /// Players are allied together
+#define PlayersAllied(a, b) ((Players[a].Allied & (1 << (b))) && 
(Players[b].Allied & (1 << (a))) )
        /// Allowed to select multiple units, maybe not mine
 #define CanSelectMultipleUnits(player) ((player) == ThisPlayer || 
PlayersTeamed(ThisPlayer->Player, (player)->Player))
 
Index: stratagus/src/network/commands.c
diff -u stratagus/src/network/commands.c:1.98 
stratagus/src/network/commands.c:1.99
--- stratagus/src/network/commands.c:1.98       Sat Jan 24 08:40:40 2004
+++ stratagus/src/network/commands.c    Sat Jan 24 10:35:02 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: commands.c,v 1.98 2004/01/23 21:40:40 jsalmon3 Exp $
+//      $Id: commands.c,v 1.99 2004/01/23 23:35:02 wizzard Exp $
 
 //@{
 
@@ -173,7 +173,7 @@
 
        replay->Comment1 = strdup("Generated by Stratagus Version " VERSION "");
        replay->Comment2 = strdup("Visit http://Stratagus.Org for more 
information");
-       replay->Comment3 = strdup("$Id: commands.c,v 1.98 2004/01/23 21:40:40 
jsalmon3 Exp $");
+       replay->Comment3 = strdup("$Id: commands.c,v 1.99 2004/01/23 23:35:02 
wizzard Exp $");
 
        if (GameSettings.NetGameType == SettingsSinglePlayerGame) {
                replay->Type = ReplaySinglePlayer;
@@ -818,6 +818,7 @@
                        NotifyPlayer(ThisPlayer, NotifyYellow, 0, 0, "No sync 
info for this replay !");
                } else {
                        NotifyPlayer(ThisPlayer, NotifyYellow, 0, 0, "Replay 
got out of sync (%lu)! ", GameCycle);
+                       DebugLevel0("OUT OF SYNC %u != %u" _C_ SyncRandSeed _C_ 
ReplayStep->SyncRandSeed);
                        // ReplayStep = 0;
                        // NextLogCycle = ~0UL;
                        // return;
Index: stratagus/src/ui/mainscr.c
diff -u stratagus/src/ui/mainscr.c:1.154 stratagus/src/ui/mainscr.c:1.155
--- stratagus/src/ui/mainscr.c:1.154    Sat Jan 17 13:12:51 2004
+++ stratagus/src/ui/mainscr.c  Sat Jan 24 10:35:03 2004
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: mainscr.c,v 1.154 2004/01/17 02:12:51 wizzard Exp $
+//      $Id: mainscr.c,v 1.155 2004/01/23 23:35:03 wizzard Exp $
 
 //@{
 
@@ -214,7 +214,9 @@
                UiDrawLifeBar(unit, x, y);
 
                if (unit->Player == ThisPlayer ||
-                       PlayersTeamed(ThisPlayer->Player, 
unit->Player->Player)) {              // Only for own units.
+                       PlayersTeamed(ThisPlayer->Player, unit->Player->Player) 
||
+                       PlayersAllied(ThisPlayer->Player, unit->Player->Player) 
||
+                       ReplayRevealMap) {              // Only for own units.
                        if (unit->HP && unit->HP < 10000) {
                                sprintf(buf, "%d/%d", unit->HP, 
stats->HitPoints);
                                VideoDrawTextCentered(x + 
(type->Icon.Icon->Width + 7) / 2,
@@ -256,7 +258,9 @@
        //              Show How much a resource has left for owner and neutral.
        //
        if (unit->Player == ThisPlayer || unit->Player->Player == 
PlayerNumNeutral ||
-               PlayersTeamed(ThisPlayer->Player, unit->Player->Player)) {
+               PlayersTeamed(ThisPlayer->Player, unit->Player->Player) ||
+               PlayersAllied(ThisPlayer->Player, unit->Player->Player) ||
+               ReplayRevealMap) {
                if (type->GivesResource) {
                        sprintf(buf, "%s Left:", 
DefaultResourceNames[type->GivesResource]);
                        VideoDrawText(x + 108 - VideoTextLength(GameFont, buf), 
y + 8 + 78,
@@ -274,7 +278,8 @@
        //              Only for owning player.
        //
 #ifndef DEBUG
-       if (unit->Player != ThisPlayer && !PlayersTeamed(ThisPlayer->Player, 
unit->Player->Player)) {
+       if (unit->Player != ThisPlayer && !PlayersTeamed(ThisPlayer->Player, 
unit->Player->Player) &&
+               !PlayersAllied(ThisPlayer->Player, unit->Player->Player) && 
!ReplayRevealMap) {
                return;
        }
 #endif
@@ -1142,7 +1147,9 @@
                } else {
                        // FIXME: not correct for enemies units
                        if (Selected[0]->Player == ThisPlayer ||
-                               PlayersTeamed(ThisPlayer->Player, 
Selected[0]->Player->Player)) {
+                               PlayersTeamed(ThisPlayer->Player, 
Selected[0]->Player->Player) ||
+                               PlayersAllied(ThisPlayer->Player, 
Selected[0]->Player->Player) ||
+                               ReplayRevealMap) {
                                if (Selected[0]->Type->Building &&
                                                (Selected[0]->Orders[0].Action 
== UnitActionBuilded ||
                                                        
Selected[0]->Orders[0].Action == UnitActionResearch ||
Index: stratagus/src/unit/unit.c
diff -u stratagus/src/unit/unit.c:1.372 stratagus/src/unit/unit.c:1.373
--- stratagus/src/unit/unit.c:1.372     Sat Jan 24 09:10:37 2004
+++ stratagus/src/unit/unit.c   Sat Jan 24 10:35:03 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: unit.c,v 1.372 2004/01/23 22:10:37 jsalmon3 Exp $
+//      $Id: unit.c,v 1.373 2004/01/23 23:35:03 wizzard Exp $
 
 //@{
 
@@ -2680,21 +2680,22 @@
   
----------------------------------------------------------------------------*/
 
 /**
-**             Unit on map screen.
+**  Unit on map screen.
 **
-**             Select units on screen. (x, y are in pixels relative to map 
0,0).
+**  Select units on screen. (x, y are in pixels relative to map 0,0).
+**  Not GAMEPLAY safe, uses ReplayRevealMap
 **
-**             More units on same position.
-**                             Cycle through units. ounit is the old one.
-**                             First take highest unit.
+**  More units on same position.
+**    Cycle through units. ounit is the old one.
+**    First take highest unit.
 **
-**             FIXME: If no unit, we could select near units?
+**  FIXME: If no unit, we could select near units?
 **
-**             @param ounit            Old selected unit.
-**             @param x                X pixel position.
-**             @param y                Y pixel position.
+**  @param ounit  Old selected unit.
+**  @param x      X pixel position.
+**  @param y      Y pixel position.
 **
-**             @return                         An unit on x, y position.
+**  @return       An unit on x, y position.
 */
 global Unit* UnitOnScreen(Unit* ounit, int x, int y)
 {
@@ -2715,7 +2716,7 @@
        }
        for (table = Units; table < Units + NumUnits; ++table) {
                unit = *table;
-               if (!UnitVisibleAsGoal(unit, ThisPlayer)) {
+               if (!UnitVisibleAsGoal(unit, ThisPlayer) && !ReplayRevealMap) {
                        continue;
                }
                type = unit->Type;
@@ -3755,7 +3756,7 @@
        int j;
 
        CLprintf(file, "\n--- -----------------------------------------\n");
-       CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.372 2004/01/23 
22:10:37 jsalmon3 Exp $\n\n");
+       CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.373 2004/01/23 
23:35:03 wizzard Exp $\n\n");
 
 #if 0
        //




reply via email to

[Prev in Thread] Current Thread [Next in Thread]