Author Topic: Default Gravity For lib/std/room.c  (Read 1814 times)

Offline hells

  • Acquaintance
  • *
  • Posts: 11
    • View Profile
Default Gravity For lib/std/room.c
« on: June 05, 2012, 01:36:59 pm »
By default the room picks up 1.0 for gravity in the private definition of gravity.

private float           Gravity       = 1.0;

Should be changed to:

private float           Gravity       = DEFAULT_GRAVITY;


Offline hells

  • Acquaintance
  • *
  • Posts: 11
    • View Profile
Re: Default Gravity For lib/std/room.c
« Reply #1 on: June 05, 2012, 07:09:50 pm »
Extra changes to fix where GetCarriedMass is called when it should be calling GetCarriedWeight so it can handle gravity correctly.

lib/living.c
Added GetCarriedWeight after GetCarriedMass.
Code: [Select]
int GetCarriedWeight(){
    return (currency::GetCurrencyWeight() + carry::GetCarriedWeight());
}

lib/currency.c
Added GetCurrencyWeight after GetCurrencyMass:
Code: [Select]
varargs int GetCurrencyWeight(string type){
return GetCurrencyMass(type) * environment(this_player())->GetGravity();
}

lib/race.c
Added GetCarriedWeight dummy to race so things don't blow up in living:
Code: [Select]
int GetCarriedWeight(){ return 0; }

Also updated GetMobility:
Code: [Select]
int GetMobility(){
    int max = GetMaxCarry();
    int encum, mob;

    if( GetParalyzed() ){
        return 0;
    }
    if( max < 1 ){
        max = 1;
    }
    encum = (GetCarriedWeight() * 100)/max;
    encum -= (encum * this_object()->GetStatLevel("agility"))/200;
    mob = 100 - encum;
    if( mob > 100 ){
        mob = 100;
    }
    else if( mob < 1 ){
        mob = 0;
    }
    return mob;
}

lib/race.h
Same added header for the GetCarriedWeight function:
Code: [Select]
int GetCarriedMass();
int GetCarriedWeight();
int GetMaxCarry();



There are a few places in vehicles and mounts that still use Mass rather than weight but I haven't made those changes yet. I will reply to this thread when I get around to it.

Changes as always are public domain, do whatever you like with this post.