• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

ksquares

dots_client.cpp

Go to the documentation of this file.
00001 /* Generated by GGZComm/ruby version 0.4 */
00002 /* Protocol 'dots', version '4' */
00003 /* Do NOT edit this file! */
00004 
00005 #include "dots_client.h"
00006 #include <kggznet/kggzraw.h>
00007 
00008 #define ggz__seat_open 1
00009 
00010 dots::dots()
00011 : QObject()
00012 {
00013     requirelink = 0;
00014     fd = -1;
00015     raw = NULL;
00016 }
00017 
00018 void dots::ggzcomm_reqsync(const reqsync& message)
00019 {
00020     *raw << dotsOpcodes::message_reqsync;
00021 }
00022 
00023 void dots::ggzcomm_reqnewgame(const reqnewgame& message)
00024 {
00025     *raw << dotsOpcodes::message_reqnewgame;
00026 }
00027 
00028 void dots::ggzcomm_sndmoveh(const sndmoveh& message)
00029 {
00030     *raw << dotsOpcodes::message_sndmoveh;
00031     *raw << message.x;
00032     *raw << message.y;
00033 }
00034 
00035 void dots::ggzcomm_sndmovev(const sndmovev& message)
00036 {
00037     *raw << dotsOpcodes::message_sndmovev;
00038     *raw << message.x;
00039     *raw << message.y;
00040 }
00041 
00042 void dots::ggzcomm_sndoptions(const sndoptions& message)
00043 {
00044     *raw << dotsOpcodes::message_sndoptions;
00045     *raw << message.width;
00046     *raw << message.height;
00047 }
00048 
00049 void dots::ggzcomm_msgseat()
00050 {
00051     msgseat message;
00052     *raw >> message.seat;
00053     emit signalNotification(dotsOpcodes::message_msgseat, message);
00054 }
00055 
00056 void dots::ggzcomm_msgplayers()
00057 {
00058     msgplayers message;
00059     for(int i1 = 0; i1 < 2; i1++)
00060     {
00061         *raw >> message.seat[i1];
00062         if((message.seat[i1] != ggz__seat_open))
00063         {
00064             *raw >> message.player[i1];
00065         }
00066     }
00067     emit signalNotification(dotsOpcodes::message_msgplayers, message);
00068 }
00069 
00070 void dots::ggzcomm_msgmoveh()
00071 {
00072     msgmoveh message;
00073     *raw >> message.nx;
00074     *raw >> message.ny;
00075     *raw >> message.s;
00076     for(int i1 = 0; i1 < message.s; i1++)
00077     {
00078         *raw >> message.x[i1];
00079         *raw >> message.y[i1];
00080     }
00081     emit signalNotification(dotsOpcodes::message_msgmoveh, message);
00082 }
00083 
00084 void dots::ggzcomm_msgmovev()
00085 {
00086     msgmovev message;
00087     *raw >> message.nx;
00088     *raw >> message.ny;
00089     *raw >> message.s;
00090     for(int i1 = 0; i1 < message.s; i1++)
00091     {
00092         *raw >> message.x[i1];
00093         *raw >> message.y[i1];
00094     }
00095     emit signalNotification(dotsOpcodes::message_msgmovev, message);
00096 }
00097 
00098 void dots::ggzcomm_msggameover()
00099 {
00100     msggameover message;
00101     *raw >> message.winner;
00102     emit signalNotification(dotsOpcodes::message_msggameover, message);
00103 }
00104 
00105 void dots::ggzcomm_reqmove()
00106 {
00107     reqmove message;
00108     emit signalNotification(dotsOpcodes::message_reqmove, message);
00109 }
00110 
00111 void dots::ggzcomm_rspmove()
00112 {
00113     rspmove message;
00114     *raw >> message.status;
00115     *raw >> message.s;
00116     for(int i1 = 0; i1 < message.s; i1++)
00117     {
00118         *raw >> message.x[i1];
00119         *raw >> message.y[i1];
00120     }
00121     emit signalNotification(dotsOpcodes::message_rspmove, message);
00122 }
00123 
00124 void dots::ggzcomm_sndsync()
00125 {
00126     sndsync message;
00127     *raw >> message.turn;
00128     *raw >> message.score0;
00129     *raw >> message.score1;
00130     emit signalNotification(dotsOpcodes::message_sndsync, message);
00131 }
00132 
00133 void dots::ggzcomm_msgoptions()
00134 {
00135     msgoptions message;
00136     *raw >> message.width;
00137     *raw >> message.height;
00138     emit signalNotification(dotsOpcodes::message_msgoptions, message);
00139 }
00140 
00141 void dots::ggzcomm_reqoptions()
00142 {
00143     reqoptions message;
00144     emit signalNotification(dotsOpcodes::message_reqoptions, message);
00145 }
00146 
00147 void dots::ggzcomm_network_main()
00148 {
00149     int opcode;
00150 
00151     *raw >> opcode;
00152 
00153     if(requirelink)
00154     {
00155         if(opcode != nextlink) emit signalError();
00156         requirelink = 0;
00157     }
00158 
00159     switch(opcode)
00160     {
00161         case dotsOpcodes::message_msgseat:
00162             ggzcomm_msgseat();
00163             break;
00164         case dotsOpcodes::message_msgplayers:
00165             ggzcomm_msgplayers();
00166             break;
00167         case dotsOpcodes::message_msgmoveh:
00168             ggzcomm_msgmoveh();
00169             break;
00170         case dotsOpcodes::message_msgmovev:
00171             ggzcomm_msgmovev();
00172             break;
00173         case dotsOpcodes::message_msggameover:
00174             ggzcomm_msggameover();
00175             break;
00176         case dotsOpcodes::message_reqmove:
00177             ggzcomm_reqmove();
00178             break;
00179         case dotsOpcodes::message_rspmove:
00180             ggzcomm_rspmove();
00181             break;
00182         case dotsOpcodes::message_sndsync:
00183             ggzcomm_sndsync();
00184             break;
00185         case dotsOpcodes::message_msgoptions:
00186             ggzcomm_msgoptions();
00187             break;
00188         case dotsOpcodes::message_reqoptions:
00189             ggzcomm_reqoptions();
00190             break;
00191     }
00192 }
00193 
00194 void dots::ggzcomm_set_fd(int usefd)
00195 {
00196     fd = usefd;
00197     raw = new KGGZRaw();
00198     raw->setNetwork(fd);
00199 }
00200 
00201 void dots::ggzcomm_set_socket(KGGZRaw *useraw)
00202 {
00203     raw = useraw;
00204 }
00205 
00206 
00207 #include "dots_client.moc"

ksquares

Skip menu "ksquares"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal