[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus contrib/macosx.tgz doc/ChangeLog.html...
From: |
Crestez Leonard |
Subject: |
[Stratagus-CVS] stratagus contrib/macosx.tgz doc/ChangeLog.html... |
Date: |
Sat, 16 Aug 2003 20:26:31 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Crestez Leonard <address@hidden> 03/08/16 20:26:31
Modified files:
contrib : macosx.tgz
doc : ChangeLog.html
src/clone : unit_find.c
src/include : unit.h
src/ui : mouse.c
Log message:
Updated MacOS X package.
Removed ScreenMapPosition bloat functions.
Patches:
Index: stratagus/contrib/macosx.tgz
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.511 stratagus/doc/ChangeLog.html:1.512
--- stratagus/doc/ChangeLog.html:1.511 Wed Aug 13 10:55:45 2003
+++ stratagus/doc/ChangeLog.html Sat Aug 16 20:26:31 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.511 2003/08/13 14:55:45 martinxyz Exp $
+---- $Id: ChangeLog.html,v 1.512 2003/08/17 00:26:31 n0body Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,6 +36,8 @@
<li>Future 1.19 Release<p>
<ul>
<li>++
+ <li>Remove *ScreenMapPositon bloat (from Crestez Leonard).
+ <li>Fixed MacOS X compilation problems (from Duncan McQueen).
<li>Fixed middle-mouse scrolling, speed now configurable (from Martin
Renold).
<li>Removed global unit types for tankers, generalized gold mining (from
Crestez Dan Leonard).
<li>Removed unit-attack-peon and unit-attack-peasant (from Crestez Dan
Leonard).
Index: stratagus/src/clone/unit_find.c
diff -u stratagus/src/clone/unit_find.c:1.52
stratagus/src/clone/unit_find.c:1.53
--- stratagus/src/clone/unit_find.c:1.52 Sun Aug 10 22:14:46 2003
+++ stratagus/src/clone/unit_find.c Sat Aug 16 20:26:31 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit_find.c,v 1.52 2003/08/11 02:14:46 n0body Exp $
+// $Id: unit_find.c,v 1.53 2003/08/17 00:26:31 n0body Exp $
//@{
@@ -312,167 +312,6 @@
} else {
return 1;
}
-}
-
-/**
-** Searches for unit whose sprite is drawn at (x,y) pixel map position.
-**
-** @param x X position on screen map, pixel-based.
-** @param y Y position on screen map, pixel-based.
-**
-** @return Returns unit found at this pixel map coordinates
-*/
-global Unit* UnitOnScreenMapPosition(int x,int y)
-{
- Unit* table[UnitMax];
- int tx;
- int ty;
- int n;
- int i;
-
- // this code runs quite often (e.g. upon each motion notify) so this
- // little optimization could be appropriate
-
- tx = x / TileSizeX;
- ty = y / TileSizeY;
-
- // fast path, should work most of the time
- n = SelectUnitsOnTile(tx, ty, table);
- for( i=0; i<n; ++i ) {
- if( !table[i]->Type->Vanishes && InsideUnitSprite(table[i], x, y)) {
- return table[i];
- }
- }
-
- // if we got here we have to search for our unit in the neighborhood
-
- // ships and flyers could be 2 fields away
- n = UnitCacheSelect(tx-2,ty-2, tx+2, ty+2, table);
- for( i=0; i<n; ++i ) {
- if( !table[i]->Type->Vanishes && InsideUnitSprite(table[i], x, y)) {
- return table[i];
- }
- }
-
- return NoUnitP;
-}
-
-/**
-** Repairable unit on screen map position.
-**
-** @param x X position on screen map, pixel-based.
-** @param y Y position on screen map, pixel-based.
-**
-** @return Returns repairable unit found on screen map position.
-*/
-global Unit* RepairableOnScreenMapPosition(int x,int y)
-{
- Unit* table[UnitMax];
- int tx;
- int ty;
- int n;
- int i;
-
- tx = x / TileSizeX;
- ty = y / TileSizeY;
-
- n = UnitCacheSelect(tx-2,ty-2, tx+2, ty+2, table);
- for( i=0; i<n; ++i ) {
- // FIXME: could use more or less for repair? Repair of ships/catapults.
- // Only repairable if target is a building or tansporter and it's HP is
- // not at max
- if( (table[i]->Type->Building || table[i]->Type->Transporter)
- && table[i]->HP < table[i]->Stats->HitPoints ) {
- if (InsideUnitSprite(table[i], x, y)) {
- return table[i];
- }
- }
- }
- return NoUnitP;
-}
-
-/**
-** Choose target at pixel map coordinates.
-**
-** @param source Unit which wants to attack.
-** @param x X position on the display map, pixel-based.
-** @param y Y position on the display map, pixel-based.
-**
-** @return Returns ideal target
-*/
-global Unit* TargetOnScreenMapPosition(const Unit* source,int x,int y)
-{
- Unit* table[UnitMax];
- Unit* unit;
- Unit* best;
- int tx;
- int ty;
- int n;
- int i;
-
- // this code runs upon right button action only so it can affort being a
- // little inefficient.
-
- tx = x / TileSizeX;
- ty = y / TileSizeY;
-
- // ships and flyers could be 2 fields away
- n = UnitCacheSelect(tx-2,ty-2, tx+2, ty+2, table);
- best=NoUnitP;
- for( i=0; i<n; ++i ) {
- unit=table[i];
- // unusable unit ?
- // if( UnitUnusable(unit) ) can't attack constructions
- // FIXME: did SelectUnitsOnTile already filter this?
- // Invisible and not Visible
- if( unit->Removed || unit->Invisible
- || !(unit->Visible&(1<<source->Player->Player))
- || unit->Orders[0].Action==UnitActionDie ) {
- continue;
- }
- if ( !InsideUnitSprite(table[i], x, y)) {
- continue;
- }
- if( !CanTarget(source->Type,unit->Type) ) {
- continue;
- }
- //
- // Choose the best target.
- //
- if( !best || best->Type->Priority < unit->Type->Priority ) {
- best=unit;
- }
- }
- return best;
-}
-
-/**
-** Transporter unit on screen map position.
-**
-** @param x X position on screen map, pixel-based.
-** @param y Y position on screen map, pixel-based.
-**
-** @return Returns transporter unit found on tile.
-*/
-global Unit* TransporterOnScreenMapPosition(int x,int y)
-{
- Unit* table[UnitMax];
- int tx;
- int ty;
- int n;
- int i;
-
- tx = x / TileSizeX;
- ty = y / TileSizeY;
-
-// n=SelectUnitsOnTile(tx,ty,table);
- n = UnitCacheSelect(tx-2,ty-2, tx+2, ty+2, table);
- for( i=0; i<n; ++i ) {
- if( table[i]->Type->Transporter && InsideUnitSprite(table[i], x, y)) {
- return table[i];
- }
- }
- return NoUnitP;
}
/*----------------------------------------------------------------------------
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.204 stratagus/src/include/unit.h:1.205
--- stratagus/src/include/unit.h:1.204 Sun Aug 10 22:14:46 2003
+++ stratagus/src/include/unit.h Sat Aug 16 20:26:31 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.h,v 1.204 2003/08/11 02:14:46 n0body Exp $
+// $Id: unit.h,v 1.205 2003/08/17 00:26:31 n0body Exp $
#ifndef __UNIT_H__
#define __UNIT_H__
@@ -959,14 +959,6 @@
extern Unit* TargetOnMapTile(const Unit* unit,int tx,int ty);
/// Return transporter unit on that map tile
extern Unit* TransporterOnMapTile(int tx,int ty);
- /// Return any unit on that screen map position
-extern Unit* UnitOnScreenMapPosition (int , int );
- /// Return repairable unit on that screen map position
-extern Unit* RepairableOnScreenMapPosition (int , int );
- /// Return possible attack target on that screen map position
-extern Unit* TargetOnScreenMapPosition (const Unit* unit,int , int );
- /// Return transporter unit on that screen map position
-extern Unit* TransporterOnScreenMapPosition (int , int );
/// Return unit of a fixed type on a map tile.
extern Unit* UnitTypeOnMap(int tx,int ty,UnitType* type);
Index: stratagus/src/ui/mouse.c
diff -u stratagus/src/ui/mouse.c:1.138 stratagus/src/ui/mouse.c:1.139
--- stratagus/src/ui/mouse.c:1.138 Wed Aug 13 10:55:45 2003
+++ stratagus/src/ui/mouse.c Sat Aug 16 20:26:31 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mouse.c,v 1.138 2003/08/13 14:55:45 martinxyz Exp $
+// $Id: mouse.c,v 1.139 2003/08/17 00:26:31 n0body Exp $
//@{
@@ -135,7 +135,7 @@
//
flush=!(KeyModifiers&ModifierShift);
- if( UnitUnderCursor && (dest=TransporterOnScreenMapPosition(sx,sy))) {
+ if( UnitUnderCursor && (dest=TransporterOnMapTile(x,y))) {
// 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
@@ -172,7 +172,7 @@
//
if( KeyModifiers&ModifierControl && UnitUnderCursor ) {
// FIXME: what todo if more than one unit on that tile?
- dest=UnitOnScreenMapPosition(sx,sy);
+ dest=UnitOnMapTile(x,y);
if( dest ) {
if( dest!=unit ) {
dest->Blink=4;
@@ -185,7 +185,7 @@
//
// Enter transporters?
//
- if( UnitUnderCursor && (dest=TransporterOnScreenMapPosition(sx,sy))) {
+ if( UnitUnderCursor && (dest=TransporterOnMapTile(x,y))) {
if( dest->Player==unit->Player
&& unit->Type->UnitType==UnitTypeLand ) {
dest->Blink=4;
@@ -241,14 +241,14 @@
// Go and repair
if ( (unit->Type->CanRepair) &&
(UnitUnderCursor) &&
- (dest=RepairableOnScreenMapPosition(sx,sy)) &&
+ (dest=RepairableOnMapTile(x,y)) &&
((dest->Player==unit->Player) ||
(IsAllied(dest->Player,dest)))) {
dest->Blink=4;
SendCommandRepair(unit,x,y,dest,flush);
continue;
}
// Follow another unit
- if( UnitUnderCursor && (dest=UnitOnScreenMapPosition(sx,sy)) ) {
+ if( UnitUnderCursor && (dest=UnitOnMapTile(x,y)) ) {
if( (dest->Player==unit->Player || IsAllied(unit->Player,dest))
&& dest!=unit ) {
dest->Blink=4;
@@ -267,7 +267,7 @@
if( action==MouseActionDemolish || action==MouseActionAttack ) {
if( UnitUnderCursor ) {
// Picks the enemy with highest priority and can be attacked
- dest=TargetOnScreenMapPosition(unit, sx, sy);
+ dest=TargetOnMapTile(unit, x, y);
if( dest ) {
if( IsEnemy(unit->Player,dest) ) {
dest->Blink=4;
@@ -296,7 +296,7 @@
}
}
- dest=UnitOnScreenMapPosition(sx,sy);
+ dest=UnitOnMapTile(x,y);
if( dest ) {
if( (dest->Player==unit->Player
|| IsAllied(unit->Player,dest)) && dest!=unit ) {
@@ -335,7 +335,7 @@
// FIXME: attack/follow/board ...
if( action==MouseActionMove || action==MouseActionSail ) {
- if( UnitUnderCursor && (dest=UnitOnScreenMapPosition(sx,sy)) ) {
+ if( UnitUnderCursor && (dest=UnitOnMapTile(x,y)) ) {
// Follow allied units, but not self.
if( (dest->Player==unit->Player
|| IsAllied(unit->Player,dest)) && dest!=unit ) {
@@ -785,17 +785,17 @@
int x;
int y;
+ x=sx/TileSizeX;
+ y=sy/TileSizeY;
+
if( UnitUnderCursor ) {
- dest=RepairableOnScreenMapPosition(sx,sy);
+ dest=RepairableOnMapTile(x,y);
} else {
dest=NoUnitP;
}
-
- x=sx/TileSizeX;
- y=sy/TileSizeY;
for( i=0; i<NumSelected; ++i ) {
unit=Selected[i];
- if( unit->Type->CowerWorker ) {
+ if( unit->Type->CanRepair ) {
// FIXME: Should move test in repairable
if( dest && dest->Type && (dest->Player==unit->Player
|| IsAllied(unit->Player,dest)) ) {
@@ -826,7 +826,7 @@
Unit* transporter;
if( UnitUnderCursor ) {
- transporter=TransporterOnScreenMapPosition(x*TileSizeX,y*TileSizeY);
+ transporter=TransporterOnMapTile(x,y);
} else {
transporter=NoUnitP;
}
@@ -883,7 +883,7 @@
unit=Selected[i];
if( unit->Type->CanAttack || unit->Type->Building ) {
if( UnitUnderCursor
- && (dest=TargetOnScreenMapPosition(unit,sx,sy)) ) {
+ && (dest=TargetOnMapTile(unit,x,y)) ) {
DebugLevel3Fn("Attacking %p\n" _C_ dest);
dest->Blink=4;
} else {
@@ -955,7 +955,7 @@
if( unit->Type->Volatile ) {
// FIXME: choose correct unit no flying ...
if( UnitUnderCursor ) {
- dest=TargetOnScreenMapPosition(unit,sx,sy);
+ dest=TargetOnMapTile(unit,x,y);
if( dest==unit ) { // don't let a unit self destruct
dest=NoUnitP;
}
@@ -1036,13 +1036,13 @@
int x;
int y;
+ x=sx/TileSizeX;
+ y=sy/TileSizeY;
if( UnitUnderCursor ) {
- dest=UnitOnScreenMapPosition(sx, sy);
+ dest=UnitOnMapTile(x, y);
} else {
dest=NoUnitP;
}
- x=sx/TileSizeX;
- y=sy/TileSizeY;
DebugLevel3Fn("SpellCast on: %p (%d,%d)\n" _C_ dest _C_ x _C_ y);
/* NOTE: Vladi:
This is a high-level function, it sends target spot and unit
@@ -1477,7 +1477,7 @@
y=(TheMap.Height-1)*TileSizeY;
}
- if( UnitUnderCursor && (unit=UnitOnScreenMapPosition(x,y)) ) {
+ if( UnitUnderCursor &&
(unit=UnitOnMapTile(x/TileSizeX,y/TileSizeY)) ) {
unit->Blink=4; // if right click on building -- blink
} else { // if not not click on building -- green cross
MakeLocalMissile(MissileTypeGreenCross
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus contrib/macosx.tgz doc/ChangeLog.html...,
Crestez Leonard <=