Mass for features

Mass for features

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Mass for features

Post by PauloMorfeo »

At the moment feature definitions have the mass hardcoded:
https://taspring.clan-sy.com/svn/spring ... andler.cpp

Code: Select all

FeatureDef* CFeatureHandler::GetFeatureDef(const std::string name)
{
    fd->mass=fd->metal*0.4f+fd->maxHealth*0.1f;
}
Make it:

Code: Select all

FeatureDef* CFeatureHandler::GetFeatureDef(const std::string name)
{
    float defaultMass= metal*0.4f+fd->maxHealth*0.1f;
    fd->mass= atof (wreckParser.SGetValueDef (defaultMass, name + "\\Mass").c_str ());
}
I don't know what "atof" is and the others get passed a string instead of a float (float defaultMass) so you better change that to .. whatever.
Basically, just make features also have mass defined by the TDFs.
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Re: Mass for features

Post by NOiZE »

PauloMorfeo wrote:Basically, just make features also have mass defined by the TDFs.
+1
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Mass for features

Post by zwzsg »

Agreed. I'm actually surprised it's not already the case.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

How about something like this? (it compiles ;-) )

Code: Select all

    const string massStr = wreckParser.SGetValueDef("", name + "\\Mass");   
    if (massStr.empty()) {
      // generate the mass from the metal and health values
      fd->mass = (fd->metal * 0.4f) + (fd->maxHealth * 0.1f);
    } else {
      fd->mass = (float)atof(massStr.c_str()); 
    }
    fd->mass = max(0.001f, fd->mass);
P.S. I haven't actually checked if the max() safety is required
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Post by PauloMorfeo »

Seems ok, even though i don't know, for example, what that max(); function does.

I would say to just mimic the way units load the tag "mass" to make it consistent but it would break the balances of already existing mods because features would end up having diferent values than before...

And thanks for adding it. Will be very helpfull to have it already in the next version.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

It's like "fd->mass = (fd->mass<0.001f ? 0.001f : fd->mass);", only shorter. Rounds it up to 0.001 if it's smaller than that.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

I've been told that 0.74b1 is going to use SVN rev 2684.
The changes for this feature are in r2688/r2689, just a
little too late ;-)
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Post by PauloMorfeo »

:(
:( :( :(

iiik
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

It might get pushed back to a later rev, apparently...
Post Reply

Return to “Feature Requests”