Share (Contract terms)

Source: Internet
Author: User

Share (contract) to receive all the map sent over the package, this is the GS thread-driven { for (;;) {        //...        if(!itmap.second->RecvData (Pkt)) Break; if(Pkt.cmd = =Ms2gs_ turn Client_cmd)        {onturntoclient (Pkt.channelid, Pkt.data, Pkt.len); }        Else if(Pkt.cmd = =Ms2gs_json)        {Onjson (Pkt.channelid, Pkt.data, Pkt.len); }        Else if(Ms2gs_db_buff_info = =pkt.cmd) {onleavemap (Pkt.channelid, Pkt.data, Pkt.len); }        Else if(Ms2gs_obj_leave = = pkt.cmd)//Player Switch Map{onenternewmap (Pkt.channelid, Pkt.data, Pkt.len); }        Else if(Ms2gs_guild_opt = =pkt.cmd) {m_spguildopt-onguildopt (Pkt.channelid, Pkt.data, Pkt.len); }        Else if(Ms2gs_prop_mgr = =pkt.cmd) {M_sppropmanager-onpropmgropt (Pkt.channelid, Pkt.data, Pkt.len); }        Else if(Ms2ms_cmd = =pkt.cmd) {onturntomap (Pkt.mapid, Pkt.data, Pkt.len); }        Else if(Ms2gs_mall_opt = =pkt.cmd) {m_spmallopt-onmallopt (Pkt.channelid, Pkt.data, Pkt.len); }        Else if(Ms2gs_auction_opt = =pkt.cmd) {m_spauctionopt-onauctionopt (Pkt.channelid, Pkt.data, Pkt.len); }        //...}} has its own module is a cross-map props, gangs, mall, team, because some operations is not with which map relationship is not big, so it made cross-map mode initacrossmapopt ();//cross-map operationsInitacrossmanager ();//Cross map ManagerThese operations or managers are sent from the map of the package, so or from the loop to pick up the package, according to the internal Protocol, to the corresponding cross-map module or in the share layer of processing, and so on after the corresponding processing of the cross-module after processing, the cross-map module itself is not to send messages, He's going to send it through share: events.sendaucopt2ms.= [ This](intNchannelid,void* PData,intNlen) {Sendcmd2msbychannelid (Nchannelid, Gs2ms_auction, PData, Nlen);};voidShare::sendcmd2msbychannelid (intNchannelid,intNcmd,void* PData,intNlen) {Gamechannel* PGC =M_vecchannel[nchannelid]; if(!PGC)return; PGC->m_pmap->gs2msdata (Ncmd, Nchannelid, PData, Nlen);//send via map to playerThe same is true for sending to the client, after all, all player channels and map information are on the share side so the packet is picked up in share, sent or sent from share

Share (Contract terms)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.