[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src action/action_build.c include/uni...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src action/action_build.c include/uni... |
Date: |
1 Feb 2004 17:03:36 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/02/01 17:03:35
Modified files:
src/action : action_build.c
src/include : unit.h
src/ui : mouse.c
src/unit : unit.c
Log message:
My Hopeful final attempt to fix placement on buildings under fog
Patches:
Index: stratagus/src/action/action_build.c
diff -u stratagus/src/action/action_build.c:1.111
stratagus/src/action/action_build.c:1.112
--- stratagus/src/action/action_build.c:1.111 Wed Jan 28 07:54:44 2004
+++ stratagus/src/action/action_build.c Sun Feb 1 17:03:32 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_build.c,v 1.111 2004/01/27 20:54:44 jsalmon3 Exp $
+// $Id: action_build.c,v 1.112 2004/02/01 06:03:32 wizzard Exp $
//@{
@@ -143,8 +143,9 @@
//
// Check if the building could be build there.
+ // 1 really attempt to build here
//
- if (!CanBuildUnitType(unit, type, x, y)) {
+ if (!CanBuildUnitType(unit, type, x, y, 1)) {
//
// Some tries to build the building.
//
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.254 stratagus/src/include/unit.h:1.255
--- stratagus/src/include/unit.h:1.254 Sat Jan 31 17:56:37 2004
+++ stratagus/src/include/unit.h Sun Feb 1 17:03:33 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.h,v 1.254 2004/01/31 06:56:37 wizzard Exp $
+// $Id: unit.h,v 1.255 2004/02/01 06:03:33 wizzard Exp $
#ifndef __UNIT_H__
#define __UNIT_H__
@@ -839,9 +839,7 @@
/// FIXME: more docu
extern int CanBuildOn(int x, int y, int mask);
/// FIXME: more docu
-extern int CanBuildUnitType(const Unit* unit,const UnitType* type, int x, int
y);
- /// FIXME: more docu
-extern int CanBuildUnitTypeMask(const Unit* unit,const UnitType* type, int x,
int y, int mask);
+extern int CanBuildUnitType(const Unit* unit,const UnitType* type, int x, int
y, int real);
/// Find resource
extern Unit* FindResource(const Unit* unit, int x, int y, int range, int
resource);
Index: stratagus/src/ui/mouse.c
diff -u stratagus/src/ui/mouse.c:1.178 stratagus/src/ui/mouse.c:1.179
--- stratagus/src/ui/mouse.c:1.178 Sun Feb 1 13:14:58 2004
+++ stratagus/src/ui/mouse.c Sun Feb 1 17:03:34 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mouse.c,v 1.178 2004/02/01 02:14:58 wizzard Exp $
+// $Id: mouse.c,v 1.179 2004/02/01 06:03:34 wizzard Exp $
//@{
@@ -1447,8 +1447,8 @@
}
}
}
- if (CanBuildUnitTypeMask(Selected[0],
CursorBuilding, x, y,
- Selected[0]->Type->MovementMask) &&
+ // 0 Test build, don't really build
+ if (CanBuildUnitType(Selected[0],
CursorBuilding, x, y, 0) &&
(explored || ReplayRevealMap)) {
PlayGameSound(GameSounds.PlacementSuccess.Sound,
MaxSampleVolume);
Index: stratagus/src/unit/unit.c
diff -u stratagus/src/unit/unit.c:1.387 stratagus/src/unit/unit.c:1.388
--- stratagus/src/unit/unit.c:1.387 Sun Feb 1 13:14:59 2004
+++ stratagus/src/unit/unit.c Sun Feb 1 17:03:34 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.387 2004/02/01 02:14:59 wizzard Exp $
+// $Id: unit.c,v 1.388 2004/02/01 06:03:34 wizzard Exp $
//@{
@@ -2081,27 +2081,12 @@
** @param type Building unit-type.
** @param x X tile map position.
** @param y Y tile map position.
+** @param real Really build, or just placement
** @return True if the building could be
build..
**
** @todo can't handle building units !1x1, needs a rewrite.
*/
-global int CanBuildUnitType(const Unit* unit, const UnitType* type, int x, int
y)
-{
- return CanBuildUnitTypeMask(unit, type, x, y, type->MovementMask);
-}
-/**
-** Can build unit-type on this point.
-**
-** @param unit Worker that want to build the building
or NULL.
-** @param type Building unit-type.
-** @param x X tile map position.
-** @param y Y tile map position.
-** @param mask movement mask to check
-** @return True if the building could be
build..
-**
-** @todo can't handle building units !1x1, needs a rewrite.
-*/
-global int CanBuildUnitTypeMask(const Unit* unit, const UnitType* type, int x,
int y, int mask)
+global int CanBuildUnitType(const Unit* unit, const UnitType* type, int x, int
y, int real)
{
int w;
int h;
@@ -2210,10 +2195,10 @@
for (h = type->TileHeight; h--;) {
for (w = type->TileWidth; w--;) {
- if (player) {
- testmask = MapFogFilterFlags(player, x + w, y +
h, mask);
+ if (player && !real) {
+ testmask = MapFogFilterFlags(player, x + w, y +
h, type->MovementMask);
} else {
- testmask = mask;
+ testmask = type->MovementMask;
}
if (!CanBuildOn(x + w, y + h, testmask)) {
if (unit) {
@@ -3793,7 +3778,7 @@
int j;
CLprintf(file, "\n--- -----------------------------------------\n");
- CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.387 2004/02/01
02:14:59 wizzard Exp $\n\n");
+ CLprintf(file, "--- MODULE: units $Id: unit.c,v 1.388 2004/02/01
06:03:34 wizzard Exp $\n\n");
#if 0
//
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src action/action_build.c include/uni...,
address@hidden <=