2019-12-15 11:58 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000349Spring engineGeneralpublic2007-01-02 11:19
ReporterKloot 
Assigned Totvo 
PrioritynormalSeveritytweakReproducibilityN/A
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000349: patch to enable seaplanes to land *IN* water
DescriptionThis is sort of a corollary to patch 0000343, and introduces a new FBI tag 'canSubmerge'. The exact behavior of planes is now as follows when told to land above water:

1) If a plane only has the 'floater' tag set to 1, it will land on the ocean surface.
2) If a plane only has the 'canSubmerge' tag set to 1, it will land on the ocean floor.
3) If a plane has both tags set to 1, it will obey rule #2.

Another way to achieve this without adding a new tag would be by eg. requiring that maxWaterDepth > 0, but mod authors might want to use that tag for other purposes.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon seaplanesV2.patch (4,906 bytes) 2006-12-28 00:12 -
    Index: Sim/Units/UnitDef.h
    ===================================================================
    --- Sim/Units/UnitDef.h	(revision 2977)
    +++ Sim/Units/UnitDef.h	(working copy)
    @@ -139,6 +139,7 @@
     
     	int selfDCountdown;
     
    +	bool canSubmerge;
     	bool canfly;
     	bool canmove;
     	bool canhover;
    Index: Sim/Units/UnitDefHandler.cpp
    ===================================================================
    --- Sim/Units/UnitDefHandler.cpp	(revision 2977)
    +++ Sim/Units/UnitDefHandler.cpp	(working copy)
    @@ -260,6 +260,8 @@
     	ud.tooltip=tdfparser.SGetValueDef(ud.name,"UNITINFO\\Description");
     	ud.moveType=0;
     
    +
    +	tdfparser.GetDef(ud.canSubmerge, "0", "UNITINFO\\canSubmerge");
     	tdfparser.GetDef(ud.canfly, "0", "UNITINFO\\canfly");
     	tdfparser.GetDef(ud.canmove, "0", "UNITINFO\\canmove");
     	tdfparser.GetDef(ud.reclaimable, "1", "UNITINFO\\reclaimable");
    @@ -273,6 +275,7 @@
     	tdfparser.GetDef(ud.builder, "0", "UNITINFO\\Builder");
     	string x = "0";
     	if(ud.builder) x = "1";
    +
     	tdfparser.GetDef(ud.canRestore,x,"UNITINFO\\canrestore");
     	tdfparser.GetDef(ud.canRepair,x,"UNITINFO\\canrepair");
     	tdfparser.GetDef(ud.canReclaim,x,"UNITINFO\\canreclaim");
    @@ -287,8 +290,11 @@
     	ud.maxSlope = cos(ud.maxSlope*(PI/180));
     	tdfparser.GetDef(ud.minWaterDepth, "-10e6", "UNITINFO\\MinWaterDepth");
     	tdfparser.GetDef(ud.maxWaterDepth, "10e6", "UNITINFO\\MaxWaterDepth");
    +
    +
     	std::string value;
     	ud.floater = tdfparser.SGetValue(value, "UNITINFO\\Waterline");
    +
     	tdfparser.GetDef(ud.waterline, "0", "UNITINFO\\Waterline");
     	if(ud.waterline>8 && ud.canmove)
     		ud.waterline+=5;		//make subs travel at somewhat larger depths to reduce vulnerability to surface weapons
    @@ -339,13 +345,16 @@
     	tdfparser.GetDef(ud.showNanoSpray, "1", "UNITINFO\\shownanospray");
     	ud.nanoColor=tdfparser.GetFloat3(float3(0.2f,0.7f,0.2f),"UNITINFO\\nanocolor");
     
    -	tdfparser.GetDef(ud.canfly, "0", "UNITINFO\\canfly");
    -	tdfparser.GetDef(ud.canmove, "0", "UNITINFO\\canmove");
    +
    +	// these are already retrieved above
    +//	tdfparser.GetDef(ud.canfly, "0", "UNITINFO\\canfly");
    +//	tdfparser.GetDef(ud.canmove, "0", "UNITINFO\\canmove");
     	tdfparser.GetDef(ud.canhover, "0", "UNITINFO\\canhover");
    +
     	if(tdfparser.SGetValue(value, "UNITINFO\\floater"))
     		tdfparser.GetDef(ud.floater, "0", "UNITINFO\\floater");
    +
     	tdfparser.GetDef(ud.builder, "0", "UNITINFO\\Builder");
    -
     	if(ud.builder && !ud.buildSpeed)		//core anti is flagged as builder for some reason
     		ud.builder=false;
     
    Index: Sim/MoveTypes/TAAirMoveType.cpp
    ===================================================================
    --- Sim/MoveTypes/TAAirMoveType.cpp	(revision 2977)
    +++ Sim/MoveTypes/TAAirMoveType.cpp	(working copy)
    @@ -252,12 +252,19 @@
     	StopMoving();
     }
     
    +
    +
     void CTAAirMoveType::UpdateLanded()
     {
     	SyncedFloat3 &pos = owner->pos;
     
    -	if(padStatus==0)		//dont place on ground if we are on a repair pad
    -		pos.y = ground->GetHeight(pos.x, pos.z);
    +	//dont place on ground if we are on a repair pad
    +	if (padStatus == 0) {
    +		if (owner -> unitDef -> canSubmerge)
    +			pos.y = ground -> GetApproximateHeight(pos.x, pos.z);
    +		else
    +			pos.y = ground -> GetHeight(pos.x, pos.z);
    +	}
     
     	owner->speed=ZeroVector;
     }
    @@ -270,7 +277,11 @@
     
     	UpdateAirPhysics();
     
    -	float h = pos.y - ground->GetHeight(pos.x, pos.z);
    +	float h = 0.0f;
    +	if (owner -> unitDef -> canSubmerge)
    +		h = pos.y - ground -> GetApproximateHeight(pos.x, pos.z);
    +	else
    +		h = pos.y - ground -> GetHeight(pos.x, pos.z);
     
     	if (h > orgWantedHeight*0.8f) {
     		//logOutput.Print("Houston, we have liftoff %f %f", h, wantedHeight);
    @@ -278,6 +289,8 @@
     	}
     }
     
    +
    +
     // Move the unit around a bit.. and when it gets too far away from goal position it switches to normal flying instead
     void CTAAirMoveType::UpdateHovering()
     {
    @@ -430,6 +443,8 @@
     		wantedHeading = GetHeadingFromVector(dir.x, dir.z);
     }
     
    +
    +
     void CTAAirMoveType::UpdateLanding()
     {
     	SyncedFloat3 &pos = owner->pos;
    @@ -475,17 +490,31 @@
     	}
     
     	//We have stopped, time to land
    -	wantedHeight=-2;
    +	float gh = ground->GetHeight(pos.x, pos.z);
    +	float gah = ground->GetApproximateHeight(pos.x, pos.z);
    +	float h = 0.0f;
    +
    +	// if aircraft submergible and above water we want height of ocean floor
    +	if ((owner -> unitDef -> canSubmerge) && (gah < 0)) {
    +		h = pos.y - gah;
    +		wantedHeight = gah;
    +	}
    +	else {
    +		h = pos.y - gh;
    +		wantedHeight = -2;
    +	}
    +
     	UpdateAirPhysics();
    -	float h = pos.y - ground->GetHeight(pos.x, pos.z);
     
     	if (h <= 0) {
     		//logOutput.Print("Landed");
     		SetState(AIRCRAFT_LANDED);
    -		pos.y = ground->GetHeight(pos.x, pos.z);
    +		pos.y = gah;
     	}
     }
     
    +
    +
     void CTAAirMoveType::UpdateHeading()
     {
     	short& heading=owner->heading;
    @@ -866,7 +895,7 @@
     		return false;
     
     	float h = ground->GetApproximateHeight(pos.x, pos.z);
    -	if (h < 0 && !owner->unitDef->floater)
    +	if ((h < 0) && !(owner -> unitDef -> floater || owner -> unitDef -> canSubmerge))
     		return false;
     
     	float3 tpos=owner->pos;
    
    patch file icon seaplanesV2.patch (4,906 bytes) 2006-12-28 00:12 +
  • patch file icon seaplanesV3.patch (12,518 bytes) 2007-01-01 21:21 -
    Index: AirMoveType.cpp
    ===================================================================
    --- AirMoveType.cpp	(revision 3041)
    +++ AirMoveType.cpp	(working copy)
    @@ -87,24 +87,27 @@
     	}
     }
     
    +
    +
     void CAirMoveType::Update(void)
     {
     	float3 &pos=owner->pos;
     
     	//This is only set to false after the plane has finished constructing
    -	if (useHeading){
    +	if (useHeading) {
     		useHeading = false;
     		SetState(AIRCRAFT_TAKEOFF);
     	}
     
    -	if(owner->stunned){
    -		UpdateAirPhysics(0,lastAileronPos,lastElevatorPos,0,ZeroVector);
    +	if (owner->stunned) {
    +		UpdateAirPhysics(0, lastAileronPos, lastElevatorPos, 0, ZeroVector);
     		goto EndNormalControl;
     	}
    +
     #ifdef DIRECT_CONTROL_ALLOWED
    -	if(owner->directControl && !(aircraftState==AIRCRAFT_CRASHING)){
    +	if (owner->directControl && !(aircraftState == AIRCRAFT_CRASHING)) {
     		SetState(AIRCRAFT_FLYING);
    -		DirectControlStruct* dc=owner->directControl;
    +		DirectControlStruct* dc = owner->directControl;
     		
     		inefficientAttackTime=0;
     		if(dc->forward || dc->back || dc->left || dc->right){
    @@ -125,36 +128,37 @@
     	}
     #endif
     
    -	if(reservedPad){
    +	if (reservedPad) {
     		CUnit* unit=reservedPad->unit;
     		float3 relPos=unit->localmodel->GetPiecePos(reservedPad->piece);
    -		float3 pos=unit->pos + unit->frontdir*relPos.z + unit->updir*relPos.y + unit->rightdir*relPos.x;
    -		if(padStatus==0){
    -			if(aircraftState!=AIRCRAFT_FLYING && aircraftState!=AIRCRAFT_TAKEOFF)
    +		float3 pos = unit->pos + (unit->frontdir * relPos.z) + (unit->updir * relPos.y) + (unit->rightdir * relPos.x);
    +
    +		if (padStatus == 0) {
    +			if (aircraftState != AIRCRAFT_FLYING && aircraftState != AIRCRAFT_TAKEOFF)
     				SetState(AIRCRAFT_FLYING);
     
    -			goalPos=pos;
    +			goalPos = pos;
     
    -			if(pos.distance(owner->pos)<400){
    -				padStatus=1;
    +			if (pos.distance(owner->pos) < 400) {
    +				padStatus = 1;
     			}
     			//			geometricObjects->AddLine(owner->pos,pos,1,0,1);
    -		} else if(padStatus==1){
    -			if(aircraftState!=AIRCRAFT_LANDING)
    +		} else if (padStatus == 1) {
    +			if (aircraftState != AIRCRAFT_LANDING)
     				SetState(AIRCRAFT_LANDING);
     
    -			goalPos=pos;
    -			reservedLandingPos=pos;
    +			goalPos = pos;
    +			reservedLandingPos = pos;
     
    -			if(owner->pos.distance(pos)<3 || aircraftState==AIRCRAFT_LANDED){
    -				padStatus=2;
    +			if (owner->pos.distance(pos) < 3 || aircraftState == AIRCRAFT_LANDED){
    +				padStatus = 2;
     			}
     			//			geometricObjects->AddLine(owner->pos,pos,10,0,1);
     		} else {
    -			if(aircraftState!=AIRCRAFT_LANDED)
    +			if (aircraftState != AIRCRAFT_LANDED)
     				SetState(AIRCRAFT_LANDED);
     
    -			owner->pos=pos;
    +			owner->pos = pos;
     
     			owner->AddBuildPower(unit->unitDef->buildSpeed/30,unit);
     			owner->currentFuel = min (owner->unitDef->maxFuel, owner->currentFuel + (owner->unitDef->maxFuel / (GAME_SPEED * owner->unitDef->refuelTime)));
    @@ -169,11 +173,12 @@
     		}
     	}
     
    -	switch(aircraftState){
    +
    +	switch (aircraftState) {
     	case AIRCRAFT_FLYING:
     #ifdef DEBUG_AIRCRAFT
    -	if(selectedUnits.selectedUnits.find(this)!=selectedUnits.selectedUnits.end()){
    -		logOutput.Print("Flying %i %i %.1f %i",moveState,fireState,inefficientAttackTime,(int)isFighter);
    +	if (selectedUnits.selectedUnits.find(this) != selectedUnits.selectedUnits.end()) {
    +		logOutput.Print("Flying %i %i %.1f %i", moveState, fireState, inefficientAttackTime, (int) isFighter);
     	}
     #endif
     		owner->restTime=0;
    @@ -219,7 +224,9 @@
     	default:
     		break;
     	}
    +
     EndNormalControl:
    +
     	if(pos!=oldpos){
     		oldpos=pos;
     		if(aircraftState==AIRCRAFT_FLYING || aircraftState==AIRCRAFT_CRASHING){
    @@ -284,6 +291,7 @@
     #endif
     }
     
    +
     void CAirMoveType::SlowUpdate(void)
     {
     	if(aircraftState!=AIRCRAFT_LANDED && owner->unitDef->maxFuel>0)
    @@ -366,6 +374,7 @@
     	}
     }
     
    +
     void CAirMoveType::UpdateFighterAttack(void)
     {
     	float3 &pos = owner->pos;
    @@ -544,6 +553,7 @@
     	lines.push_back(dl);/**/
     }
     
    +
     void CAirMoveType::UpdateAttack(void)
     {
     /*	std::vector<CWeapon*>::iterator wi;
    @@ -557,6 +567,7 @@
     	UpdateFlying(wantedHeight,1);
     }
     
    +
     void CAirMoveType::UpdateFlying(float wantedHeight,float engine)
     {
     	float3 &pos = owner->pos;
    @@ -657,57 +668,66 @@
     			}
     		}
     	} else {
    -		if(frontdir.y<-0.1f){
    -			elevator=1;
    -		} else if(frontdir.y>0.15f){
    -			elevator=-1;
    +		if (frontdir.y < -0.1f) {
    +			elevator = 1;
    +		} else if (frontdir.y > 0.15f) {
    +			elevator = -1;
     		}
     	}
    -	UpdateAirPhysics(rudder,aileron,elevator,engine,owner->frontdir);
    +
    +	UpdateAirPhysics(rudder, aileron, elevator, engine, owner->frontdir);
     }
     
    +
    +
     void CAirMoveType::UpdateLanded(void)
     {
     	float3 &pos = owner->pos;
     	SyncedFloat3 &rightdir = owner->rightdir;
     	SyncedFloat3 &frontdir = owner->frontdir;
     	SyncedFloat3 &updir = owner->updir;
    -	float3 &speed = owner->speed;
    +	float3 &speed = owner -> speed;
     
    -	speed=ZeroVector;
    +	speed = ZeroVector;
     
    -	updir=ground->GetNormal(pos.x,pos.z);
    +	updir = ground->GetNormal(pos.x, pos.z);
     	frontdir.Normalize();
    -	rightdir=frontdir.cross(updir);
    +	rightdir = frontdir.cross(updir);
     	rightdir.Normalize();
    -	updir=rightdir.cross(frontdir);
    +	updir = rightdir.cross(frontdir);
     }
     
     void CAirMoveType::UpdateTakeOff(float wantedHeight)
     {
     	float3& pos=owner->pos;
     	float3& speed=owner->speed;
    -	float h=pos.y-ground->GetHeight(pos.x,pos.z);
    +
    +	float h = 0.0f;
    +	if (owner -> unitDef -> canSubmerge)
    +		h = pos.y - ground -> GetApproximateHeight(pos.x, pos.z);
    +	else
    +		h = pos.y - ground -> GetHeight(pos.x,pos.z);
     	
    -	if(h>wantedHeight)
    +	if (h > wantedHeight)
     		SetState(AIRCRAFT_FLYING);
     
    -	if(h+speed.y*20<wantedHeight*1.02f)
    -		speed.y+=maxAcc;
    +	if ((h + speed.y * 20) < (wantedHeight * 1.02f))
    +		speed.y += maxAcc;
     	else
    -		speed.y-=maxAcc;
    -	if(h>wantedHeight*0.4f)
    -		speed+=owner->frontdir*maxAcc;
    +		speed.y -= maxAcc;
     
    -	speed*=invDrag;
    +	if (h > wantedHeight * 0.4f)
    +		speed += owner -> frontdir * maxAcc;
     
    +	speed *= invDrag;
    +
     	owner->frontdir.Normalize();
    -	owner->rightdir=owner->frontdir.cross(owner->updir);
    +	owner->rightdir = owner->frontdir.cross(owner->updir);
     	owner->rightdir.Normalize();
    -	owner->updir=owner->rightdir.cross(owner->frontdir);
    +	owner->updir = owner->rightdir.cross(owner->frontdir);
     
    -	pos+=speed;
    -	owner->midPos=pos+owner->frontdir*owner->relMidPos.z + owner->updir*owner->relMidPos.y + owner->rightdir*owner->relMidPos.x;
    +	pos += speed;
    +	owner->midPos = pos + (owner->frontdir * owner->relMidPos.z) + (owner->updir * owner->relMidPos.y) + (owner->rightdir * owner->relMidPos.x);
     }
     
     void CAirMoveType::UpdateLanding(void)
    @@ -717,96 +737,110 @@
     	SyncedFloat3 &frontdir = owner->frontdir;
     	SyncedFloat3 &updir = owner->updir;
     	float3 &speed = owner->speed;
    -	float speedf=speed.Length();
    +	float speedf = speed.Length();
     
    -	//find a landing spot if we dont have one
    -	if(reservedLandingPos.x<0){
    -		reservedLandingPos=FindLandingPos();
    -		if(reservedLandingPos.x>0){
    -			reservedLandingPos.y+=wantedHeight;
    -			float3 tp=pos;
    -			pos=reservedLandingPos;
    +	// find a landing spot if we dont have one
    +	if (reservedLandingPos.x < 0) {
    +		reservedLandingPos = FindLandingPos();
    +		if (reservedLandingPos.x > 0) {
    +			reservedLandingPos.y += wantedHeight;
    +			float3 tp = pos;
    +			pos = reservedLandingPos;
     			owner->physicalState = CSolidObject::OnGround;
     			owner->Block();
     			owner->physicalState = CSolidObject::Flying;
    -			pos=tp;
    +			pos = tp;
     			owner->Deactivate();
     			owner->cob->Call(COBFN_StopMoving);
     		} else {
     			goalPos.CheckInBounds();
    -			UpdateFlying(wantedHeight,1);
    +			UpdateFlying(wantedHeight, 1);
     			return;
     		}
    -	} else {	//see if landing spot is still empty
    -/*		float3 tpos=owner->pos;
    -		owner->pos=reservedLandingPos;
    -		int2 mp=owner->GetMapPos();
    -		owner->pos=tpos;
    +	} else {
    +		// see if landing spot is still empty
    +		/*
    +		float3 tpos = owner->pos;
    +		owner->pos = reservedLandingPos;
    +		int2 mp = owner->GetMapPos();
    +		owner->pos = tpos;
     
    -		for(int z=mp.y; z<mp.y+owner->ysize; z++){
    -			for(int x=mp.x; x<mp.x+owner->xsize; x++){
    -				if(readmap->groundBlockingObjectMap[z*gs->mapx+x]!=owner){
    -					owner->UnBlock();
    -					reservedLandingPos.x=-1;
    -					UpdateFlying(wantedHeight,1);
    +		for (int z = mp.y; z < mp.y + owner -> ysize; z++) {
    +			for (int x = mp.x; x < mp.x + owner -> xsize; x++) {
    +				if (readmap -> groundBlockingObjectMap[z * gs -> mapx + x] != owner){
    +					owner -> UnBlock();
    +					reservedLandingPos.x = -1;
    +					UpdateFlying(wantedHeight, 1);
     					return;
     				}
     			}
     		}*/
     	}
     
    -	//update our speed
    -	float3 dif=reservedLandingPos-pos;
    -	float dist=dif.Length();
    -	dif/=dist;
    +	// update our speed
    +	float3 dif = reservedLandingPos - pos;
    +	float dist = dif.Length();
    +	dif /= dist;
     	
    -	float wsf=min(owner->unitDef->speed,dist/speedf*1.8f*maxAcc);
    -	float3 wantedSpeed=dif*wsf;
    +	float wsf = min(owner->unitDef->speed, dist / speedf * 1.8f * maxAcc);
    +	float3 wantedSpeed = dif * wsf;
     
     	float3 delta = wantedSpeed - speed;
    -	float dl=delta.Length();
    +	float dl = delta.Length();
     
    -	if(dl<maxAcc*3)
    -		speed=wantedSpeed;
    +	if (dl < maxAcc * 3)
    +		speed = wantedSpeed;
     	else
    -		speed+=delta/dl*maxAcc*3;
    +		speed += delta / dl * maxAcc * 3;
     
    -	pos+=speed;
    +	pos += speed;
     
    -	//make the aircraft right itself up and turn toward goal
    -	if(rightdir.y<-0.01f)
    -		updir-=rightdir*0.02f;
    -	else if(rightdir.y>0.01f)
    -		updir+=rightdir*0.02f;
    +	// make the aircraft right itself up and turn toward goal
    +	if (rightdir.y < -0.01f)
    +		updir -= rightdir * 0.02f;
    +	else if (rightdir.y > 0.01f)
    +		updir += rightdir * 0.02f;
     
    -	if(frontdir.y<-0.01f)
    -		frontdir+=updir*0.02f;
    -	else if(frontdir.y>0.01f)
    -		frontdir-=updir*0.02f;
    +	if (frontdir.y < -0.01f)
    +		frontdir += updir * 0.02f;
    +	else if (frontdir.y > 0.01f)
    +		frontdir -= updir * 0.02f;
     
    -	if(rightdir.dot(dif)>0.01f)
    -		frontdir+=rightdir*0.02f;
    -	else if(rightdir.dot(dif)<-0.01f)
    -		frontdir-=rightdir*0.02f;
    +	if (rightdir.dot(dif) > 0.01f)
    +		frontdir += rightdir * 0.02f;
    +	else if (rightdir.dot(dif) < -0.01f)
    +		frontdir -= rightdir * 0.02f;
     
     	frontdir.Normalize();
    -	rightdir=frontdir.cross(updir);
    +	rightdir = frontdir.cross(updir);
     	rightdir.Normalize();
    -	updir=rightdir.cross(frontdir);
    +	updir = rightdir.cross(frontdir);
     
    -	owner->midPos=pos+frontdir*owner->relMidPos.z + updir*owner->relMidPos.y + rightdir*owner->relMidPos.x;
    +	owner->midPos = pos + (frontdir * owner->relMidPos.z) + (updir * owner->relMidPos.y) + (rightdir * owner->relMidPos.x);
     
    -	//see if we are at the landing spot
    -	if(dist<1){
    -		float h=ground->GetHeight(pos.x,pos.z);
    -		if(fabs(reservedLandingPos.y-h)>1)
    -			reservedLandingPos.y=h;
    -		else{
    +	// see if we are at the reserved (not user-clicked) landing spot
    +	if (dist < 1) {
    +		float gh = ground -> GetHeight(pos.x, pos.z);
    +		float gah = ground -> GetApproximateHeight(pos.x, pos.z);
    +		float alt = 0.0f;
    +
    +		// can we submerge and are we still above water?
    +		if ((owner -> unitDef -> canSubmerge) && (gah < 0)) {
    +			alt = pos.y - gah;
    +			reservedLandingPos.y = gah;
    +		}
    +		else {
    +			alt = pos.y - gh;
    +			reservedLandingPos.y = gh;
    +		}
    +
    +		if (alt <= 1)
     			SetState(AIRCRAFT_LANDED);
    -		}
     	}
     }
     
    +
    +
     void CAirMoveType::UpdateAirPhysics(float rudder, float aileron, float elevator,float engine,const float3& engineVector)
     {
     	float3 &pos = owner->pos;
    @@ -931,36 +965,41 @@
     	}
     }
     
    +
    +
     float3 CAirMoveType::FindLandingPos(void)
     {
    -	float3 ret(-1,-1,-1);
    +	float3 ret(-1, -1, -1);
    +	float3 tryPos = owner->pos + owner->speed * owner->speed.Length() / (maxAcc * 3);
    +	tryPos.y = ground -> GetHeight2(tryPos.x, tryPos.z);
     
    -	float3 tryPos=owner->pos+owner->speed*owner->speed.Length()/(maxAcc*3);
    -	tryPos.y=ground->GetHeight2(tryPos.x,tryPos.z);
    +	if ((tryPos.y < 0) && !(owner -> unitDef -> floater || owner -> unitDef -> canSubmerge)) {
    +		return ret;
    +	}
     
    -	if(tryPos.y<0)
    -		return ret;
     	tryPos.CheckInBounds();
     
    -	float3 tpos=owner->pos;
    -	owner->pos=tryPos;
    -	int2 mp=owner->GetMapPos();
    -	owner->pos=tpos;
    +	float3 tpos = owner->pos;
    +	owner->pos = tryPos;
    +	int2 mp = owner->GetMapPos();
    +	owner->pos = tpos;
     
    -	for(int z=mp.y; z<mp.y+owner->ysize; z++){
    -		for(int x=mp.x; x<mp.x+owner->xsize; x++){
    -			if(readmap->groundBlockingObjectMap[z*gs->mapx+x]){
    +	for (int z = mp.y; z < mp.y + owner -> ysize; z++) {
    +		for (int x = mp.x; x < mp.x + owner -> xsize; x++) {
    +			if (readmap -> groundBlockingObjectMap[z * gs->mapx + x]) {
     				return ret;
     			}
     		}
     	}
     
    -	if(ground->GetSlope(tryPos.x,tryPos.z)>0.03f)
    +	if (ground -> GetSlope(tryPos.x, tryPos.z) > 0.03f)
     		return ret;
     
     	return tryPos;
     }
     
    +
    +
     void CAirMoveType::CheckForCollision(void)
     {
     	SyncedFloat3& pos=owner->midPos;
    
    patch file icon seaplanesV3.patch (12,518 bytes) 2007-01-01 21:21 +

-Relationships
+Relationships

-Notes

~0000488

Kloot (developer)

Whoops, 'rule 0000002' obviously should read 'rule 2'.

~0000497

tvo (reporter)

committed, after minor modification

~0000499

tvo (reporter)

hmm I just noticed you only changed CTAAirMoveType, but there also is CAirMoveType. It seems they're used for different types of aircraft, so maybe you could look into fixing & testing CAirMoveType too?

~0000502

Kloot (developer)

will do as soon as the world stops spinning again :]

~0000504

Kloot (developer)

Patch for CAirMoveType (seaplanesV3) submitted.

For reference, aircraft that satisfy the expression...

    (type == "Builder" || ud->hoverAttack || ud->transportCapacity)

...use CTAAirMoveType, all others use CAirMoveType.

~0000507

tvo (reporter)

committed, thank you
+Notes

-Issue History
Date Modified Username Field Change
2006-12-28 00:12 Kloot New Issue
2006-12-28 00:12 Kloot File Added: seaplanesV2.patch
2006-12-28 00:17 Kloot Note Added: 0000488
2006-12-31 15:31 tvo Status new => resolved
2006-12-31 15:31 tvo Resolution open => fixed
2006-12-31 15:31 tvo Assigned To => tvo
2006-12-31 15:31 tvo Note Added: 0000497
2006-12-31 16:23 tvo Status resolved => feedback
2006-12-31 16:23 tvo Resolution fixed => reopened
2006-12-31 16:23 tvo Note Added: 0000499
2007-01-01 13:28 Kloot Note Added: 0000502
2007-01-01 21:21 Kloot Note Added: 0000504
2007-01-01 21:21 Kloot File Added: seaplanesV3.patch
2007-01-02 11:18 tvo Note Added: 0000507
2007-01-02 11:19 tvo Status feedback => resolved
2007-01-02 11:19 tvo Resolution reopened => fixed
+Issue History