~z-man/armagetronad/0.2.8-armagetronad-sty+ct+lua

« back to all changes in this revision

Viewing changes to src/tron/gCycle.cpp

Merge with mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
625
625
        tASSERT( cycle );
626
626
 
627
627
        // create
628
 
        if ( &(*cycle->chatBot_) == 0 )
629
 
            cycle->chatBot_ = std::auto_ptr< gCycleChatBot >( new gCycleChatBot( cycle ) );
 
628
        if ( cycle->chatBot_.get() == 0 )
 
629
            cycle->chatBot_.reset( new gCycleChatBot( cycle ) );
630
630
 
631
631
        return *cycle->chatBot_;
632
632
    }
2064
2064
    // loads a specific texture from a specific folder
2065
2065
    static rSurface * LoadTextureSafe2( Slot slot, int mp )
2066
2066
    {
2067
 
        static std::auto_ptr<rSurface> cache[SLOT_MAX][2];
2068
 
        std::auto_ptr<rSurface> & surface = cache[slot][mp];
 
2067
        static std::unique_ptr<rSurface> cache[SLOT_MAX][2];
 
2068
        std::unique_ptr<rSurface> & surface = cache[slot][mp];
2069
2069
        if ( surface.get() == NULL )
2070
2070
        {
2071
2071
            static char const * names[SLOT_MAX]={"bike.png","cycle_body.png", "cycle_wheel.png"};
2074
2074
            char const * folder = mp ? "moviepack" : "textures";
2075
2075
            tString file = tString(folder) + "/" + name;
2076
2076
 
2077
 
            surface = std::auto_ptr<rSurface> ( tNEW( rSurface( file ) ) );
 
2077
            surface.reset( tNEW( rSurface( file ) ) );
2078
2078
        }
2079
2079
 
2080
2080
        if ( surface->GetSurface() )
2426
2426
        currentWall(NULL),
2427
2427
        lastWall(NULL)
2428
2428
{
2429
 
    se_cycleCreatedWriter << p->GetLogName() << pos.x << pos.y << d.x << d.y;
 
2429
    se_cycleCreatedWriter << p->GetLogName() << this->MapPosition().x << this->MapPosition().y << this->MapDirection().x << this->MapDirection().y;
2430
2430
    se_cycleCreatedWriter.write();
2431
2431
 
2432
2432
    windingNumberWrapped_ = windingNumber_ = Grid()->DirectionWinding(dirDrive);
2751
2751
            gCycleChatBot & bot = gCycleChatBot::Get( this );
2752
2752
            bot.Activate( currentTime );
2753
2753
        }
2754
 
        else if ( &(*chatBot_) )
 
2754
        else if ( chatBot_.get() )
2755
2755
        {
2756
2756
            chatBot_->nextChatAI_ = 0;
2757
2757
        }
4406
4406
    sr_DepthOffset(true);
4407
4407
    if ( rTextureGroups::TextureMode[rTextureGroups::TEX_WALL] != 0 )
4408
4408
        glDisable(GL_TEXTURE_2D);
4409
 
    
 
4409
 
4410
4410
    gNetPlayerWall * run = list;
4411
4411
    while( run )
4412
4412
    {
4419
4419
    sr_DepthOffset(false);
4420
4420
    if ( rTextureGroups::TextureMode[rTextureGroups::TEX_WALL] != 0 )
4421
4421
        glEnable(GL_TEXTURE_2D);
4422
 
    
 
4422
 
4423
4423
    run = list;
4424
4424
    while( run )
4425
4425
    {
6800
6800
        tString PlayerName = ePlayerNetID::FilterName(params.ExtractNonBlankSubString(pos));
6801
6801
        ePlayerNetID *pPlayer = 0;
6802
6802
        pPlayer = ePlayerNetID::FindPlayerByName(PlayerName, NULL);
6803
 
        if(!pPlayer) {
 
6803
 
 
6804
        // If no player, or the player is not allowed to respawn.
 
6805
        if( ! pPlayer || ! pPlayer->CanRespawn() ) {
6804
6806
            return;
6805
6807
        }
 
6808
 
 
6809
                // Get the size multiplier to adjust the cordinates to be based on the map's.
 
6810
        float sizeMultiplier = gArena::SizeMultiplier();
 
6811
 
6806
6812
        const tString message_str = params.ExtractNonBlankSubString(pos);
6807
6813
        int message = atoi(message_str);
6808
6814
        const tString x_str = params.ExtractNonBlankSubString(pos);
6809
 
        REAL x = atof(x_str);
 
6815
        REAL x = atof(x_str) * sizeMultiplier;
6810
6816
        const tString y_str = params.ExtractNonBlankSubString(pos);
6811
 
        REAL y = atof(y_str);
 
6817
        REAL y = atof(y_str) * sizeMultiplier;
6812
6818
        const tString dirx_str = params.ExtractNonBlankSubString(pos);
6813
 
        REAL dirx = atof(dirx_str);
 
6819
        REAL dirx = atof(dirx_str) * sizeMultiplier;
6814
6820
        const tString diry_str = params.ExtractNonBlankSubString(pos);
6815
 
        REAL diry = atof(diry_str);
 
6821
        REAL diry = atof(diry_str) * sizeMultiplier;
6816
6822
        // prepare coord and direction ...
6817
6823
        eCoord ppos, pdir;
6818
6824
        if (((x_str == "") && (y_str == "")) || ((dirx ==0) && (diry == 0))) {
6861
6867
        if(!pPlayer) {
6862
6868
                return;
6863
6869
        }
 
6870
 
 
6871
        // Get the size multiplier to adjust the cordinates to be based on the map's.
 
6872
        float sizeMultiplier = gArena::SizeMultiplier();
 
6873
 
6864
6874
        const tString x_str = params.ExtractNonBlankSubString(pos);
6865
 
        REAL x = atof(x_str);
 
6875
        REAL x = atof(x_str) * sizeMultiplier;
6866
6876
        const tString y_str = params.ExtractNonBlankSubString(pos);
6867
 
        REAL y = atof(y_str);
 
6877
        REAL y = atof(y_str) * sizeMultiplier;
6868
6878
        tString relabs = params.ExtractNonBlankSubString(pos);
6869
6879
        if (relabs=="") relabs="rel";
6870
6880
 
6871
6881
        const tString xdir_str = params.ExtractNonBlankSubString(pos);
6872
 
        REAL xdir = atof(xdir_str);
 
6882
        REAL xdir = atof(xdir_str) * sizeMultiplier;
6873
6883
        const tString ydir_str = params.ExtractNonBlankSubString(pos);
6874
 
        REAL ydir = atof(ydir_str);
 
6884
        REAL ydir = atof(ydir_str) * sizeMultiplier;
6875
6885
        if ((xdir_str == "") && (ydir_str == "")) {
6876
6886
                xdir = ydir = 0.0;
6877
6887
        }