Changeset 572

Show
Ignore:
Timestamp:
05/24/08 16:01:11 (8 months ago)
Author:
LeoD
Message:

fixed yet another NaN in Unit.finalDirection

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/defend/Camera.d

    r567 r572  
    9898        minDistance -= inputSpeed(input); 
    9999 
    100         if(minDistance < 1.1
    101             minDistance = 1.1
     100        if(minDistance < 2
     101            minDistance = 2
    102102    } 
    103103 
     
    152152            return true; 
    153153        }); 
     154         
     155        /+foreach(object; gameObjects) 
     156        { 
     157            auto bbox = object.sceneNode.boundingBox.expanded(2); 
     158         
     159            if(bbox.checkCollision(pos) && bbox.max.y > minDistance) 
     160            { 
     161                minDistance = bbox.max.y; 
     162                return; 
     163            } 
     164        }+/ 
    154165    } 
    155166 
     
    268279    void scroll(vec3 v) 
    269280    { 
    270         pos += right * v.x; 
    271         pos += dir * v.y; 
    272         pos += up * v.z; 
     281        void move(vec3 v) 
     282        { 
     283            auto newPos = pos + v; 
     284         
     285            /*foreach(object; gameObjects) 
     286            { 
     287                auto bbox = object.sceneNode.boundingBox.expanded(2); 
     288             
     289                if(bbox.checkCollision(newPos)) 
     290                    return; 
     291            }*/ 
     292             
     293            pos = newPos; 
     294        } 
     295         
     296        move(right * v.x); 
     297        move(dir * v.y); 
     298        move(up * v.z); 
    273299    } 
    274300 
  • trunk/src/defend/Main.d

    r567 r572  
    5151 
    5252    // Spam :P 
    53     Log.defaultLevel = LogLevel.Info
     53    Log.defaultLevel = LogLevel.Spam
    5454 
    5555    // Load the config 
  • trunk/src/defend/sim/Core.d

    r571 r572  
    413413    } 
    414414 
    415     /+final bool isTypeInHierarchy(object_type_t type) 
    416     { 
    417         return objectType == type || hasParent(type) !is null; 
    418     }+/ 
    419  
    420415    this() 
    421416    { 
     
    934929            pf = property_value_t.ctFromReal!(1.0); 
    935930         
     931        // dis no good 
    936932        _life = cast(int)cast(real)property(Property.MaxLife); 
    937933 
  • trunk/src/defend/sim/Effector.d

    r570 r572  
    1212alias fixed property_value_t; 
    1313 
    14 fixed objProp(real r) { return property_value_t.fromReal(r); } 
     14property_value_t objProp(real r) { return property_value_t.fromReal(r); } 
    1515 
    1616struct EffectorInfo 
  • trunk/src/defend/sim/civ/Test.d

    r570 r572  
    5959            with(civ.objectTypes["unit"]) 
    6060            { 
    61                 mulPropertyFactor(Unit.Property.MovementSpeed, property_value_t.ctFromReal!(2.0)); 
     61                mulPropertyFactor(Unit.Property.MovementSpeed, objProp(2)); 
    6262            } 
    6363        } 
  • trunk/src/defend/sim/obj/Citizen.d

    r570 r572  
    277277                    else 
    278278                    { 
    279                         //debug(citizen) trace("doing build step"); 
    280                          
    281279                        building.oneBuildStep(); 
    282280                         
  • trunk/src/defend/sim/obj/Unit.d

    r571 r572  
    358358    vec3 _direction; 
    359359    vec3 direction() { return _direction; } 
    360     void direction(vec3 v) { assert(v.ok); _direction = v; } 
    361      
    362     vec3 finalDirection; 
     360    void direction(vec3 v) { logger.spam("new dir"); assert(v.ok); _direction = v; } 
     361     
     362    vec3 _finalDirection; 
     363    vec3 finalDirection() { return _finalDirection; } 
     364    void finalDirection(vec3 v) { logger.spam("final dir"); assert(v.ok); _finalDirection = v; } 
    363365     
    364366    fixed movePercent; // from 0 to 1000 
     
    570572    void localMove(MapPos pos) 
    571573    { 
     574        finalDirection = vec3.zero; // to prevent NaN 
    572575        move(pos); 
    573576        finalDirection = getDirection(mapPos, pos); 
  • trunk/src/gen/math/BoundingBox.d

    r561 r572  
    5050        max += amount; 
    5151        min -= amount; 
     52    } 
     53     
     54    BoundingBox expanded(T amount) 
     55    { 
     56        BoundingBox result = *this; 
     57        result.expand(amount); 
     58         
     59        return result; 
    5260    } 
    5361