Changeset 524

Show
Ignore:
Timestamp:
04/27/08 13:11:16 (9 months ago)
Author:
LeoD
Message:

weird bugs today :F

Files:

Legend:

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

    r473 r524  
    8383        minDistance -= inputSpeed(input); 
    8484 
    85         if(minDistance < 1
    86             minDistance = 1
     85        if(minDistance < 2.5
     86            minDistance = 2.5
    8787    } 
    8888 
  • trunk/src/defend/game/hud/Hud.d

    r519 r524  
    118118            }); 
    119119             
    120             debug foreach(obj; mouse.selection) 
     120            version(none) foreach(obj; mouse.selection) 
    121121            { 
    122122                auto p = mouse.getScreenPos(obj.realPos); 
  • trunk/src/defend/game/hud/Mouse.d

    r522 r524  
    347347                                                         vec2i(terrain.dimension.x, 
    348348                                                               terrain.dimension.y)); 
    349                                                                    
     349                                                            
    350350                gameObjects.order(gameObjects.gateway, selection, 
    351351                                  OrderMapRightClick(cast(ushort)translated.x, 
     
    371371                if(target is null) 
    372372                { 
     373                    // tmp :D 
     374                    //for(uint i = 0; i < 100; i++)      
    373375                    gameObjects.order(gameObjects.gateway, selection, 
    374376                                      OrderMapRightClick(mapPos.x, mapPos.y)); 
  • trunk/src/defend/game/net/Client.d

    r483 r524  
    7373 
    7474        MessagePong messageOut; 
    75         socket.send(messageOut);     
     75        socket.send(messageOut); 
     76         
     77        //logger.trace("sending pong"); 
    7678    } 
    7779     
     
    357359                        phaseQueue.first.simulationSteps); 
    358360         
     361        debug if(phaseQueue.first.whichPhase % 30 == 0) 
     362            logger.trace("phase length: {}", phaseQueue.first.length); 
     363         
    359364        StartPhase(phaseQueue.first); 
    360365 
  • trunk/src/defend/game/net/Server.d

    r519 r524  
    102102            } 
    103103 
    104             uint last = 0; 
     104            uint lastPing = 0; 
    105105            while(!socket.stop) 
    106106            { 
    107                 if(server.gameStarted && getTickCount() - last > 1000 && 
    108                    pingAnswer
     107                if(server.gameStarted && getTickCount() - lastPing > 1000 //&& 
     108                   /*pingAnswer*/
    109109                { 
     110                    if(!pingAnswer) 
     111                    { 
     112                        logger.warn("no pong in 1 second"); 
     113                         
     114                        // man, wtf 
     115                        Thread.sleep(2); 
     116                    } 
     117                 
     118                    //logger.trace("sending ping"); 
     119                 
    110120                    MessagePing message; 
    111121                    socket.send(message); 
     
    113123                    pingAnswer = false; 
    114124                    pingSend = getTickCount(); 
    115                     last = getTickCount(); 
     125                    lastPing = getTickCount(); 
    116126                } 
    117127 
    118128                Thread.yield(); 
    119129            } 
     130             
     131            //logger.trace("thread's done for"); 
    120132        } 
    121133        catch(Exception exception) 
     
    161173        lastHighestPing = pingLast; 
    162174         
    163         debug(networking) if(pingCount == 0) 
    164             logger.info("ping: {}", pingLast); 
    165          
    166         pingCount++; 
    167  
    168         if(pingCount == 5) 
     175        /*debug(networking)*/ //if(pingCount == 0) 
     176        //  logger.info("ping: {}", pingLast); 
     177         
     178        if(++pingCount == 5) 
    169179            pingCount = 0;   
    170180    } 
     
    187197           message.patch != DEFEND_VERSION_PATCH) 
    188198        { 
    189             // FIX: What should we do in this case? 
     199            // TODO: What should we do in this case? 
    190200            logger.warn("version unknown"); 
    191201        }    
     
    561571    } 
    562572 
    563     const uint MIN_PHASE_LENGTH = 200; 
     573    const uint MIN_PHASE_LENGTH = 100; 
    564574    const uint MAX_PHASE_LENGTH = 1000; 
    565575    const uint SIMULATION_STEPS_PER_SECOND = 50; 
     
    684694         
    685695        stop = true; 
    686         Thread.join(); 
     696        join(); 
    687697 
    688698        foreach(client; cm) 
  • trunk/src/defend/objects/Core.d

    r522 r524  
    846846    final MapPos searchFreeTileAround(MapPos from) 
    847847    { 
    848         const uint radius = 1; 
    849         assert(radius >= 1); 
    850  
    851848        bool hasResult = false; 
    852849        float minDistance; 
  • trunk/src/defend/objects/types/Building.d

    r521 r524  
    577577        super.onRemove(); 
    578578             
    579         //void spawn(vec3 point, uint number) 
    580              
    581579        foreach(x, y; mapRectangle) 
    582             particles("smoke").spawn(terrain.getWorldPos(x, y) + vec3(0, 0.5, 1), 1); 
     580            particles("smoke").spawn(terrain.getWorldPos(x, y) + vec3(0, 1.5, 1), 1); 
    583581             
    584582        markMap(true); 
     
    590588        if(selected && buildTarget != mapPos) 
    591589        { 
    592             glLineWidth(3); 
     590            glLineWidth(2); 
    593591            renderer.setRenderState(RenderState.DepthTest, false); 
    594592             
     
    634632 
    635633                    auto obj = cast(Unit)gameObjects.localCreate(owner, 
    636                                                              entry.unitType.objectType, 
    637                                                              unitPos.x, 
    638                                                              unitPos.y); 
     634                                                                 entry.unitType.objectType, 
     635                                                                 unitPos.x, 
     636                                                                 unitPos.y); 
    639637                     
    640638                    assert(obj !is null); 
  • trunk/src/defend/objects/types/Unit.d

    r521 r524  
    265265                { 
    266266                    pause = 3; 
    267                     path = []
     267                    path = null
    268268                     
    269269                    moveFinished(); 
     
    668668    { 
    669669        // Debug the path 
    670         debug if(selected && moving && path.length) 
     670        debug(unit) if(selected && moving && path.length) 
    671671        { 
    672672            MapPos a = mapPos; 
  • trunk/src/gen/list/SyncQueue.d

    r401 r524  
    3939                result = queue.empty; 
    4040             
     41            return result; 
     42        } 
     43         
     44        uint length() 
     45        { 
     46            uint result; 
     47             
     48            synchronized(mutex) 
     49                result = queue.length; 
     50                 
    4151            return result; 
    4252        } 
  • trunk/src/gen/math/Vector.d

    r501 r524  
    312312    } 
    313313 
    314     Vec3 normalized(float n = 1
    315     { 
    316         return *this * cast(T)(1 / (length() / n)); 
     314    Vec3 normalized(
     315    { 
     316        return *this * cast(T)(1 / length()); 
    317317    } 
    318318 
  • trunk/src/gen/net/tcp/Message.d

    r506 r524  
    2828    message_type_t*[char[]] messageTypes; 
    2929     
     30    char[] getMessageTypeName(message_type_t type) 
     31    { 
     32        foreach(key, val; messageTypes) 
     33            if(*val == type) 
     34                return key; 
     35                 
     36        assert(false); 
     37    } 
     38     
    3039    // will remain until I write the message's length at the beginning of it 
    3140    ubyte[] messageSeparator = ['\r', '\n', 255, 254, 253]; 
  • trunk/src/gen/net/tcp/Socket.d

    r509 r524  
    141141                    //Trace.formatln("message: {}", line.length); 
    142142                 
     143                    // debug 
     144                    //auto name = getMessageTypeName(*(cast(message_type_t*)line[0 .. message_type_t.sizeof])); 
     145                     
     146                    //if(name == "MessagePing " || name == "MessagePong ") 
     147                    //  logger.trace("<= {}", name); 
     148                 
    143149                    handleMessage(line); 
    144150                     
     
    168174                if(!writeQueue.poll(0.5, message)) 
    169175                    continue; 
     176                 
     177                // debug 
     178                //auto name = getMessageTypeName(*(cast(message_type_t*)message.data[0 .. message_type_t.sizeof])); 
     179                 
     180                //if(name == "MessagePing " || name == "MessagePong ") 
     181                //  logger.trace("=> {}", name); 
     182                 
     183                //logger.trace("REMAIN: {}", writeQueue.length); 
    170184                 
    171185                assert(message !is null, "message is null"); 
     
    193207                    } 
    194208                     
    195                     assert(sent <= remain, "wtf"); 
     209                    assert(sent <= remain, "wft"); 
    196210                    remain -= sent; 
    197211                } 
  • trunk/src/gen/scene/ParticleSystem.d

    r501 r524  
    9797            velocity = vec3(random!(float)(-1, 1), random!(float)(-1, 1), random!(float)(-1, 1)); 
    9898            velocity *= 3; 
    99             velocity = velocity.normalized(0.2)
     99            velocity = velocity.normalized() * 0.2
    100100 
    101101            color = vec4(1, 1, 1, 0.5 + 0.5 * random!(float)(0, 1)); 
     
    112112            position += velocity * time; 
    113113             
    114             color.a -= 0.1 * time; 
     114            color.a -= 0.045 * time; 
    115115            size += 0.1 * time; 
    116116            velocity -= velocity * time * 0.2f;