Jump to content

problem with change channel command


Recommended Posts

hi everyone.I have a problem with command of changed the channel.

after 5-7 seconds from order entry,send to login.

syslog:

Spoiler

Mar 27 18:40:21 :: GLOBAL_TIME: Mar 27 18:40:21 time_gap 0
Mar 27 18:40:21 :: COMMAND: ramramramram: ch
Mar 27 18:40:21 :: DISCONNECT: ramramramram (DESC::~DESC)
Mar 27 18:40:21 :: SAVE: ramramramram 957420x256395
Mar 27 18:40:21 :: QUEST clear timer 1
Mar 27 18:40:21 :: SYSTEM: closing socket. DESC #20

my code:

Spoiler

void CHARACTER::ChannelSwitch(int new_ch){
            long lAddr;
            long lMapIndex;
            WORD wPort;
            long x = this->GetX();
            long y = this->GetY();

            if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort))
            {
                    sys_err("[SCHIMBA CH]Nu s-a gasit locatia acestei mape: mapindex[%ld] x[%ld] y[%ld] name[%s]", lMapIndex, x, y, GetName());
                    return;
            }
            if(lMapIndex >= 10000){
                return;
            }
            
            std::map<WORD, int>micha;
            
            for(int i = 0; i < 2; i++){ //replace with maximum channels -1   actual 1300x - 1330x
                for(int i2 = 1; i2 < 3; i2++){ //replace with your core values actual  13x02 - 13x08
                    micha[273 * 100 + (i * 10) + i2] = i+1;
                }        
            }
            //micha[13002] = 1;
            int chan;
            if(micha.find(wPort) != micha.end())
                chan = micha[wPort];
            else
                return;
            Stop();
            Save();
            
            if(GetSectree()){
                GetSectree()->RemoveEntity(this);
                ViewCleanup();
                EncodeRemovePacket(this);
            }
            TPacketGCWarp p;

            p.bHeader    = HEADER_GC_WARP;
            p.lX    = x;
            p.lY    = y;
            p.lAddr    = lAddr;
            p.wPort    = (wPort - 100*(chan-1) + 100*(new_ch-1));
            

            GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
}

ch1_1:27301
ch1_2:27302
ch2_1:27311
ch2_2:27312

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

  • 5 years later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.