Air transport fix.

Air transport fix.

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Air transport fix.

Post by smoth »

Ok, as we know we need isairbase to have unit fire from a transport. This causes a problem because airbases also repair aircraft. So transports would get occupied by aircraft seeking repair.

So I sepperated the tags.

Isairbase will no longer be needed for transports to have units firing from them.

Instead they can use a tag:
isfireplatform

for that purpose purpose of denoting a transport is a platform a unit can fire weapons or it's nano-gun from..

Patch here

This is just a short little patch I tested it and it worked. Nothing complicated.. I think it was like 3 lines I changed. Anyway, here you go devs.
Last edited by smoth on 29 Jun 2006, 08:57, edited 1 time in total.
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

Get back in IRC Smoth! We are trying to come up with a less cluncky and odd name for the tag!
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

nothing wrong with the name, do retract that statement.
User avatar
unpossible
Posts: 871
Joined: 10 May 2005, 19:24

Post by unpossible »

smoth wrote:nothing wrong with the name, do retract that statement.
i agree
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

:wink:
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Not needed,

just check

if (UnitDef->builder == true){
// ITS A REPAIR PAD
}else{
//IT'S A TRANSPORT!!!!
}
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

@AF: but why the heck would you have an FBI tag that, when used on a transport means "transported units can fire" and on a repair pad would mean "planes land on this to get repaired"... it's just another dumb throwback to OTA glitchiness... the use of isairbase was probably a hack that people figured out to trick OTA to do this in the first place.
User avatar
unpossible
Posts: 871
Joined: 10 May 2005, 19:24

Post by unpossible »

it must be neater to have it all defined in the unit file rather than interpreted by the code?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

well have both, as we want to keep backwards comaptability dont we?
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

for the 4 transport units in each mod that might potentially need this feature I don't think it's worth keeping backwards compatibility. or maybe make 2 new tags instead... for example isrepairpad=1/0 and isfireplatform=1/0 while isairbase is interpretted as AF said.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

It won't kill you to just use 1 of the 2 tags after all we are talking about "Only 4 units".

Now I might be able to get my monster lv3 transport for EE that I've been begging for.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Why 7zipping a 3 line patch? Does you internet cost $1000/byte or so?

Please make it easy for us to read it by posting it as plain text.
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

Woot Smoth is patching aswell now


/me hopes on transparacy channel for s3o's !! :-)
User avatar
Decimator
Posts: 1118
Joined: 24 Jul 2005, 04:15

Post by Decimator »

Patch wrote:Index: rts/Sim/Units/UnitDef.h
===================================================================
--- rts/Sim/Units/UnitDef.h (revision 1538)
+++ rts/Sim/Units/UnitDef.h (working copy)
@@ -172,7 +172,9 @@
float loadingRadius; //for transports
int transportCapacity;
int transportSize;
- bool isAirBase;// should the carried units still be able to shoot?
+ //$$
+ bool isfireplatform;// should the carried units still be able to shoot?
+ bool isAirBase;
float transportMass;

bool canCloak; //if the unit can cloak
Index: rts/Sim/Units/UnitDefHandler.cpp
===================================================================
--- rts/Sim/Units/UnitDefHandler.cpp (revision 1538)
+++ rts/Sim/Units/UnitDefHandler.cpp (working copy)
@@ -291,6 +291,7 @@

tdfparser.GetDef(ud.transportSize, "0", "UNITINFO\\transportsize");
tdfparser.GetDef(ud.transportCapacity, "0", "UNITINFO\\transportcapacity");
+ ud.isfireplatform=!!atoi(tdfparser.SGetValueDef("0", "UNITINFO\\isfireplatform").c_str()); //$$
ud.isAirBase=!!atoi(tdfparser.SGetValueDef("0", "UNITINFO\\isAirBase").c_str());
ud.loadingRadius=220;
tdfparser.GetDef(ud.transportMass, "100000", "UNITINFO\\TransportMass");
Index: rts/Sim/Units/UnitTypes/TransportUnit.cpp
===================================================================
--- rts/Sim/Units/UnitTypes/TransportUnit.cpp (revision 1538)
+++ rts/Sim/Units/UnitTypes/TransportUnit.cpp (working copy)
@@ -94,7 +94,7 @@
unit->AddDeathDependence (this);
unit->transporter = this;
unit->toBeTransported=false;
- if (!unitDef->isAirBase)
+ if (!unitDef->isfireplatform)//$$
unit->stunned=true; //make sure unit doesnt fire etc in transport
unit->UnBlock();
loshandler->FreeInstance(unit->los);
@@ -126,7 +126,7 @@
unit->transporter=0;
if(CTAAirMoveType* am=dynamic_cast<CTAAirMoveType*>(moveType))
unit->moveType->useHeading=true;
- unit->stunned=false; // de-stun in case it isairbase=0
+ unit->stunned=false; // de-stun in case it isfireplatform=0
unit->Block();
loshandler->MoveUnit(unit,false);
unit->moveType->LeaveTransport();
Lazy peoples :P
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Code: Select all

ud.isAirBase=!!atoi(tdfparser.SGetValueDef("0", "UNITINFO\\isAirBase").c_str()); 
double negative? "!!"== if it is not not ?

Code: Select all

ud.isAirBase=atoi(tdfparser.SGetValueDef("0", "UNITINFO\\isAirBase").c_str()); 
In accordance with what i suggested how about?

Code: Select all

int isfp= atoi(tdfparser.SGetValueDef("999", "UNITINFO\\isfireplatform").c_str());
if((isfp == 999)&&(ud.isAirBase))
{
    ud.isfireplatform= !ud.builder;//$$
    ud.isAirBase = ud.builder;
}else{
    ud.isfireplatform= (bool)isfp;//$$
}
ud.isAirBase=!!atoi(tdfparser.SGetValueDef("0", "UNITINFO\\isAirBase").c_str());
If the unit is a repair pad then ud.builder == true, which means isfireplatform == false, and vice versa, and also having a default value that isnt usual aka 0/1, so that you can tell if the user defined it. Though there's probably a better way of telling that so please edit accordingly.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

You are making it overly complicated AF.
ud.isAirBase=!!atoi(tdfparser.SGetValueDef("0", "UNITINFO\\isAirBase").c_str());
I didn't change this. That is how they origonally had it.

Look it is all very simple..>

I didn't change anything All I did was add 3 things.

I added:

ISFIREPLATFORM TAG as a valid FBI value, MIMIKING the structure used for the isairbase tag.

I then told the transports to use this to determine the paralysis status of a unit on a transport.

Quit nitpicking the code. You are trying t o complicate things. It still is backwards compatible.
Last edited by smoth on 29 Jun 2006, 20:52, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

AF wrote:Not needed,

just check

if (UnitDef->builder == true){
// ITS A REPAIR PAD
}else{
//IT'S A TRANSPORT!!!!
}
We don't need this, It is bad, what if I want to have a transport and repair pad... which I do.


This is a simple fix, AF you do not do this to anyone else who writes a patch. Why are you nitpicking 2 lines of new code?

The exact changes

Code: Select all

- bool isAirBase;// should the carried units still be able to shoot?
+ //$$
+ bool isfireplatform;// should the carried units still be able to shoot?
+ bool isAirBase; 

- unit->stunned=false; // de-stun in case it isairbase=0
+ unit->stunned=false; // de-stun in case it isfireplatform=0 

- if (!unitDef->isAirBase)
+ if (!unitDef->isfireplatform)//$$ 

- unit->stunned=false; // de-stun in case it isairbase=0
+ unit->stunned=false; // de-stun in case it isfireplatform=0 
Last edited by smoth on 29 Jun 2006, 20:58, edited 1 time in total.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

That would be executed if the user DID NOT define the extra tag you added
what if I want to have a transport and repair pad...
You would define both as 1. This is a backwards compatible measure to prevent aircraft following transports for repair. Afterall your change doesnt fix the problem unless the units fbi is changed. My solution fixes that while keeping your addition intact.

Please dont be so overly hostile about it.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

AF wrote:

Code: Select all

ud.isAirBase=!!atoi(tdfparser.SGetValueDef("0", "UNITINFO\\isAirBase").c_str()); 
double negative? "!!"== if it is not not ?
shortcut for converting to bool, seems to be needed with certains MSVCs
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

That would be executed if the user DID NOT define the extra tag you added[/quote]
wth.... just come on team speak... read your pm.
AF wrote:You would define both as 1. This is a backwards compatible measure to prevent aircraft following transports for repair. Afterall your change doesnt fix the problem unless the units fbi is changed. My solution fixes that while keeping your addition intact.

Look AF, it is very, very simple.... on a transport a unit is paralysed by the transport. It is in the code.

There is a condition that IF the transport isairbase then it will not paralyse the unit.

I created a needed sepperation of the two by adding a tag. I do not know why you are so oppossed to it. If you knew how to fix it why you didn't already submit a patch. Is this what you are going to do when I submit a patch? every time I do something?


AF wrote:Please dont be so overly hostile about it.
I am not, this is THE ONLY TIME you have nitpicked a patch.
Locked

Return to “Engine”