├── source ├── copia ├── AZPGeneral.txt ├── azpazeta.mime ├── a.out ├── beep ├── copia.azp ├── zip ├── 1x1.png ├── DUP.png ├── azpazeta.azp ├── zip.azp ├── AZPServer ├── Adrix.png ├── Azpazeta ├── Golf.png ├── Hiper.png ├── INEM.png ├── beep.bin ├── inicio.png ├── like.png ├── save.png ├── splash.png ├── tren.png ├── AdrixUp.png ├── Centro1.png ├── Centro2.png ├── Centro3.png ├── Gorguez.png ├── Icono48.png ├── Icono64.ico ├── Icono64.png ├── Icono64.xcf ├── Portada.png ├── Portada.xcf ├── Portada2.png ├── Portada3.png ├── Portada4.png ├── azpazeta-libs.conf ├── dislike.png ├── estacion.jpg ├── zip.azp.azp ├── AdrixBase.png ├── AdrixLeft.png ├── AdrixRight.png ├── Bocadillo.png ├── caballeria.jpg ├── nformat.azp.azp ├── nfile.azp ├── ArchivoDivel ├── azpazeta-source.zip ├── like_dislike_buttons.jpg ├── azpazeta.keys ├── AA Ejecutar.sh ├── Pruebas.sh ├── BuildPackage.txt ├── azpupdater.h ├── gortren.h ├── Estrauctura de AZP Files ├── azpserver.h ├── libmodloader.h ├── libmodloader.cpp ├── VarGlobal.h ├── azpazeta.xml ├── BaseAzpazetaXML ├── azpazeta-mime.xml ├── azpazeta-text-mime.xml ├── VarGlobal.cpp ├── prueba.c ├── chr_taskbar.h ├── golf.h ├── dkey.h ├── Instalar MIME.txt ├── chr_taskbar.cpp ├── police.h ├── dialogbox.h ├── azpazeta.h ├── gorguez.h ├── Azpazeta.desktop ├── mercado.h ├── beep.cpp ├── hiper.h ├── azpazeta.cpp ├── libazpupdater.cpp ├── save.h ├── sample.xpm ├── tren.h ├── Makefile ├── Idiomas.h ├── inicio.hpp ├── Icono.xpm ├── dialogbox.cpp ├── police.cpp ├── golf.cpp ├── dkey.cpp ├── Icono64.xpm ├── x-azpazeta-savefile.xpm ├── azpazeta.svg ├── tren.cpp ├── hiper.cpp ├── Librerias.h ├── azpserver.cpp ├── mercado.cpp ├── save.cpp ├── DUP.xpm └── inicio.cpp ├── configure-stamp ├── debian ├── compat ├── postinst ├── changelog ├── control ├── copyright └── rules ├── multiplayer ├── Cliente ├── Servidor ├── leeme.txt ├── nfile.azp ├── Socket.h ├── Socket_Cliente.h ├── Socket_Servidor.h ├── Crear Libreria.txt ├── Makefile ├── divsock.h ├── Cliente.cpp ├── Socket_Cliente.c ├── Socket.c ├── Socket_Servidor.c ├── Cliente.c ├── divsock.cpp └── Servidor.c ├── azpazeta.recipe └── README.md /source/copia: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /configure-stamp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 7 -------------------------------------------------------------------------------- /source/AZPGeneral.txt: -------------------------------------------------------------------------------- 1 | Hi, this is the user information 2 | -------------------------------------------------------------------------------- /source/azpazeta.mime: -------------------------------------------------------------------------------- 1 | application/x-azpazeta-savefile: 2 | ext: azp 3 | -------------------------------------------------------------------------------- /source/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/a.out -------------------------------------------------------------------------------- /source/beep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/beep -------------------------------------------------------------------------------- /source/copia.azp: -------------------------------------------------------------------------------- 1 | Azpazeta_Save_File_v.1.0:MONEY=4000:CITY=4:MISION=15:NOMBRE=A:AUX=1 2 | -------------------------------------------------------------------------------- /source/zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/zip -------------------------------------------------------------------------------- /source/1x1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/1x1.png -------------------------------------------------------------------------------- /source/DUP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/DUP.png -------------------------------------------------------------------------------- /source/azpazeta.azp: -------------------------------------------------------------------------------- 1 | Azpazeta_Save_File_v.1.0:MONEY=4000:CITY=2:MISION=15:NOMBRE=A:AUX=0 2 | -------------------------------------------------------------------------------- /source/zip.azp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/zip.azp -------------------------------------------------------------------------------- /source/AZPServer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/AZPServer -------------------------------------------------------------------------------- /source/Adrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Adrix.png -------------------------------------------------------------------------------- /source/Azpazeta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Azpazeta -------------------------------------------------------------------------------- /source/Golf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Golf.png -------------------------------------------------------------------------------- /source/Hiper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Hiper.png -------------------------------------------------------------------------------- /source/INEM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/INEM.png -------------------------------------------------------------------------------- /source/beep.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/beep.bin -------------------------------------------------------------------------------- /source/inicio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/inicio.png -------------------------------------------------------------------------------- /source/like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/like.png -------------------------------------------------------------------------------- /source/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/save.png -------------------------------------------------------------------------------- /source/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/splash.png -------------------------------------------------------------------------------- /source/tren.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/tren.png -------------------------------------------------------------------------------- /multiplayer/Cliente: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/multiplayer/Cliente -------------------------------------------------------------------------------- /source/AdrixUp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/AdrixUp.png -------------------------------------------------------------------------------- /source/Centro1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Centro1.png -------------------------------------------------------------------------------- /source/Centro2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Centro2.png -------------------------------------------------------------------------------- /source/Centro3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Centro3.png -------------------------------------------------------------------------------- /source/Gorguez.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Gorguez.png -------------------------------------------------------------------------------- /source/Icono48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Icono48.png -------------------------------------------------------------------------------- /source/Icono64.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Icono64.ico -------------------------------------------------------------------------------- /source/Icono64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Icono64.png -------------------------------------------------------------------------------- /source/Icono64.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Icono64.xcf -------------------------------------------------------------------------------- /source/Portada.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Portada.png -------------------------------------------------------------------------------- /source/Portada.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Portada.xcf -------------------------------------------------------------------------------- /source/Portada2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Portada2.png -------------------------------------------------------------------------------- /source/Portada3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Portada3.png -------------------------------------------------------------------------------- /source/Portada4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Portada4.png -------------------------------------------------------------------------------- /source/azpazeta-libs.conf: -------------------------------------------------------------------------------- 1 | # Configuracion de Azpazeta Libs 2 | /opt/extras.ubuntu.com/azpazeta/lib 3 | -------------------------------------------------------------------------------- /source/dislike.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/dislike.png -------------------------------------------------------------------------------- /source/estacion.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/estacion.jpg -------------------------------------------------------------------------------- /source/zip.azp.azp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/zip.azp.azp -------------------------------------------------------------------------------- /multiplayer/Servidor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/multiplayer/Servidor -------------------------------------------------------------------------------- /multiplayer/leeme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/multiplayer/leeme.txt -------------------------------------------------------------------------------- /source/AdrixBase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/AdrixBase.png -------------------------------------------------------------------------------- /source/AdrixLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/AdrixLeft.png -------------------------------------------------------------------------------- /source/AdrixRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/AdrixRight.png -------------------------------------------------------------------------------- /source/Bocadillo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/Bocadillo.png -------------------------------------------------------------------------------- /source/caballeria.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/caballeria.jpg -------------------------------------------------------------------------------- /source/nformat.azp.azp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/nformat.azp.azp -------------------------------------------------------------------------------- /source/nfile.azp: -------------------------------------------------------------------------------- 1 | Azpazeta_Save_File_v.1.0:MONEY=3100:CITY=5:MISION=15:AUX=1:DROGA=0:SOBORNO=1:BLACKLIST=0: 2 | -------------------------------------------------------------------------------- /source/ArchivoDivel: -------------------------------------------------------------------------------- 1 | #!/home/julian/DEB/azpazeta-1.0.0.1/source/a.out 2 | #Esto es un comentario 3 | IMPORTANTE 4 | -------------------------------------------------------------------------------- /source/azpazeta-source.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/azpazeta-source.zip -------------------------------------------------------------------------------- /multiplayer/nfile.azp: -------------------------------------------------------------------------------- 1 | Azpazeta_Save_File_v.1.0:MONEY=5000:CITY=5:MISION=15:AUX=1:DROGA=3:SOBORNO=1:BLACKLIST=2: 2 | 3 | -------------------------------------------------------------------------------- /source/like_dislike_buttons.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aarroyoc/azpazeta-original/master/source/like_dislike_buttons.jpg -------------------------------------------------------------------------------- /source/azpazeta.keys: -------------------------------------------------------------------------------- 1 | application/x-azpazeta-savefile 2 | description=Azpazeta Save File 3 | [es]description=Partida de Azpazeta 4 | -------------------------------------------------------------------------------- /source/AA Ejecutar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Iniciando entorno de trabajo" 4 | 5 | gedit *.cpp 6 | gedit *.h 7 | gedit *.hpp 8 | gedit Makefile 9 | -------------------------------------------------------------------------------- /source/Pruebas.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #gksudo -u root "cp *.png /usr/share/Azpazeta/media/" 4 | sudo cp *.png /opt/extras.ubuntu.com/azpazeta/media/ 5 | -------------------------------------------------------------------------------- /source/BuildPackage.txt: -------------------------------------------------------------------------------- 1 | dpkg-buildpackage -S -sa -rfakeroot -tc -D -k824E9059 2 | debuild -S -k824E9059 3 | dput -f my_ppa templvs_1.0.0.1_source.changes 4 | 5 | -------------------------------------------------------------------------------- /azpazeta.recipe: -------------------------------------------------------------------------------- 1 | # bzr-builder format 0.3 deb-version {debupstream}+{revno}+{revno:packaging} 2 | lp:~adrian-arroyocalle/+junk/azpazeta 3 | merge packaging lp:~adrian-arroyocalle/azpazeta/debian 4 | 5 | -------------------------------------------------------------------------------- /multiplayer/Socket.h: -------------------------------------------------------------------------------- 1 | #ifndef _SOCKET_H 2 | #define _SOCKET_H 3 | 4 | int Lee_Socket (int fd, char *Datos, int Longitud); 5 | int Escribe_Socket (int fd, char *Datos, int Longitud); 6 | 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /multiplayer/Socket_Cliente.h: -------------------------------------------------------------------------------- 1 | #ifndef _SOCKET_CLIENTE_H 2 | #define _SOCKET_CLIENTE_H 3 | 4 | int Abre_Conexion_Unix (char *Servicio); 5 | int Abre_Conexion_Inet (char *Host_Servidor, char *Servicio); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /multiplayer/Socket_Servidor.h: -------------------------------------------------------------------------------- 1 | #ifndef _SOCKET_SERVIDOR_H 2 | #define _SOCKET_SERVIDOR_H 3 | 4 | int Abre_Socket_Inet (char *Servicio); 5 | int Abre_Socket_Unix (char *Servicio); 6 | int Acepta_Conexion_Cliente (int Descriptor); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /source/azpupdater.h: -------------------------------------------------------------------------------- 1 | #ifndef AZPUPDATER_H_ 2 | #define AZPUPDATER_H_ 3 | 4 | class /*DLLIMPORT*/ AZPUpdater{ 5 | 6 | public: 7 | bool CheckUpdates(); 8 | //bool InstallUpdates(); 9 | 10 | 11 | }; 12 | 13 | 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /source/gortren.h: -------------------------------------------------------------------------------- 1 | //gortren.h 2 | #ifndef GORTREN_H_ 3 | #define GORTREN_H_ 4 | #include "Librerias.h" 5 | 6 | class Gortren : public wxDialog{ 7 | public: 8 | Gortren(); 9 | 10 | 11 | 12 | 13 | 14 | }; 15 | 16 | 17 | 18 | 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /source/Estrauctura de AZP Files: -------------------------------------------------------------------------------- 1 | Son ZIPs con varias carpetas y archivos 2 | 3 | AZPGeneral -> Datos generales del juego 4 | META-DATA -> Datos del usuario 5 | SERVER-DATA -> Datos sobre multijugador y servers 6 | SKIN-DATA -> Skins para Adrix 7 | TEXTURE-DATA -> Texture Packs del jugador 8 | -------------------------------------------------------------------------------- /source/azpserver.h: -------------------------------------------------------------------------------- 1 | #ifndef AZPSERVER_H_ 2 | #define AZPSERVER_H_ 3 | 4 | 5 | class AZPServer{ 6 | public: 7 | void IniciarConexion(); 8 | void PasarDatos(); 9 | void RecibirDatos(); 10 | void CerrarConexion(); 11 | 12 | }; 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /source/libmodloader.h: -------------------------------------------------------------------------------- 1 | #ifndef MODLOADER_H_ 2 | #define MODLOADER_H_ 3 | #define DLLIMPORT __declspec (dllexport) 4 | 5 | class /*DLLIMPORT en Windows*/ ModLoader{ 6 | public: 7 | bool CheckMod(); 8 | 9 | 10 | 11 | 12 | 13 | }; 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /source/libmodloader.cpp: -------------------------------------------------------------------------------- 1 | //LIBMODLOADER --- Usa este esquema para crear tus mods 2 | #include 3 | #include "libmodloader.h" 4 | 5 | bool ModLoader::CheckMod() 6 | { 7 | wxMessageBox("Ningun mod instalado","Mod Loader for Azpazeta",wxOK|wxICON_INFORMATION); 8 | return true; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /multiplayer/Crear Libreria.txt: -------------------------------------------------------------------------------- 1 | julian@ubuntu:~/DEB/socket$ g++ -c -o divsock.o divsock.cpp 2 | julian@ubuntu:~/DEB/socket$ ar rcs libdivsock.a divsock.o 3 | julian@ubuntu:~/DEB/socket$ g++ -fPIC -c -o divsockdin.o divsock.cpp 4 | julian@ubuntu:~/DEB/socket$ g++ -shared -fPIC -o libdivsock.so divsockdin.o 5 | 6 | -------------------------------------------------------------------------------- /source/VarGlobal.h: -------------------------------------------------------------------------------- 1 | #include "tren.h" 2 | #include "save.h" 3 | #include "inicio.hpp" 4 | #ifndef VARGLOBAL_H_ 5 | #define VARGLOBAL_H_ 6 | /*int x, y; 7 | int level=0; 8 | int money=2000; 9 | int city=0; 10 | char name; 11 | wxString newname; 12 | int adrx; 13 | int adry; 14 | int mision=0; 15 | int aux;*/ 16 | #endif 17 | -------------------------------------------------------------------------------- /source/azpazeta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Azpazeta Save File 5 | Partida de Azpazeta 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /source/BaseAzpazetaXML: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Azpazeta Save File 5 | Partida de Azpazeta 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | azpazeta-original 2 | ================= 3 | 4 | Azpazeta 1.0.0 Original Source Code. 5 | The new Azpazeta is here: http://launchpad.net/azpazeta 6 | Please, note that this source code is unmaintained. 7 | 8 | Build 9 | ===== 10 | Run make on the source directory. You should have installed wxWidgets 2.9 or upper and a C++ compiler. 11 | -------------------------------------------------------------------------------- /source/azpazeta-mime.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Azpazeta Save File 5 | Partidas de Azpazeta 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /multiplayer/Makefile: -------------------------------------------------------------------------------- 1 | all : Socket.o Socket_Servidor.o Socket_Cliente.o Servidor Cliente 2 | 3 | CPPFLAGS = -g -I. 4 | 5 | Servidor : Servidor.c 6 | g++ -g -I. Socket.o Socket_Servidor.o Servidor.c -o Servidor 7 | 8 | Cliente : Cliente.c 9 | g++ -g -I. Socket.o Socket_Cliente.o Cliente.c -o Cliente 10 | 11 | clean : 12 | rm *.o Cliente Servidor 13 | -------------------------------------------------------------------------------- /source/azpazeta-text-mime.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Azpazeta Save File 5 | Partidas de Azpazeta 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /debian/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Mime types y extensiones 3 | xdg-mime install source/azpazeta-mime.xml 4 | xdg-mime install source/azpazeta-text-mime-xml 5 | xdg-mime default Azpazeta.desktop application/x-azpazeta-savefile 6 | xdg-mime default Azpazeta.desktop text/x-azpazeta-savefile 7 | #Librerias 8 | 9 | #cp source/azpazeta-libs.conf /etc/ld.so.conf.d/ 10 | #ldconfig 11 | 12 | -------------------------------------------------------------------------------- /source/VarGlobal.cpp: -------------------------------------------------------------------------------- 1 | #include "VarGlobal.h" 2 | #include "Librerias.h" 3 | int x, y; 4 | int level=0; 5 | int money=2000; 6 | int city=0; 7 | char* name; 8 | wxString newname; 9 | int adrx; 10 | int adry; 11 | int mision=0; 12 | int aux=0; 13 | int droga=0; 14 | int blacklist=0; 15 | int sobornos=0; 16 | int socio=0; 17 | int electro=0; 18 | int food=0; 19 | int textil=0; 20 | int rich=0; 21 | int prima=0; 22 | -------------------------------------------------------------------------------- /source/prueba.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char* argv[]) 4 | { 5 | printf("Sistema de lectura de ShellBang de Unix\n"); 6 | getchar(); 7 | printf("%s muestra lo siguiente\n",argv[1]); 8 | getchar(); 9 | getchar(); 10 | FILE* archivo=fopen(argv[1],"r"); 11 | while(!feof(archivo)){ 12 | char letra=fgetc(archivo); 13 | printf("%c",letra); 14 | 15 | 16 | 17 | 18 | } 19 | return 0; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /source/chr_taskbar.h: -------------------------------------------------------------------------------- 1 | #ifndef CHR_TASKBAR_H 2 | #define CHR_TASKBAR_H 1 3 | 4 | #include "wx/wx.h" 5 | #include "wx/taskbar.h" 6 | #include "wx/menu.h" 7 | #include "wx/icon.h" 8 | 9 | class ChrTaskBarIcon : public wxTaskBarIcon { 10 | public: 11 | ChrTaskBarIcon(); 12 | void OnMenuExit(wxCommandEvent& event); 13 | 14 | virtual wxMenu* CreatePopupMenu(); 15 | 16 | wxIcon* m_ok; 17 | 18 | private: 19 | DECLARE_EVENT_TABLE() 20 | }; 21 | #endif 22 | -------------------------------------------------------------------------------- /source/golf.h: -------------------------------------------------------------------------------- 1 | #ifndef GOLF_H_ 2 | #define GOLF_H_ 3 | #include "Librerias.h" 4 | class Golf : public wxDialog 5 | { 6 | public: 7 | Golf(); 8 | void VenderLujo(wxCommandEvent& event); 9 | void ComprarLujo(wxCommandEvent& event); 10 | void VenderDroga(wxCommandEvent& event); 11 | void Valladolid(wxCommandEvent& event); 12 | 13 | }; 14 | 15 | enum{ 16 | ID_VENDERLUJO, 17 | ID_COMPRARLUJO, 18 | ID_VENDERDROGA, 19 | ID_VALLADOLID 20 | 21 | }; 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /multiplayer/divsock.h: -------------------------------------------------------------------------------- 1 | #ifndef _DIVSOCK_H 2 | #define _DIVSOCK_H 3 | 4 | int Lee_Socket (int fd, char *Datos, int Longitud); 5 | int Escribe_Socket (int fd, char *Datos, int Longitud); 6 | int Abre_Conexion_Unix_Cliente (char *Servicio); 7 | int Abre_Conexion_Inet_Cliente (char *Host_Servidor, char *Servicio); 8 | int Abre_Socket_Inet_Server (char *Servicio); 9 | int Abre_Socket_Unix_Server (char *Servicio); 10 | int Acepta_Conexion_Cliente (int Descriptor); 11 | 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /source/dkey.h: -------------------------------------------------------------------------------- 1 | //Divel Key en Azpazeta 2 | #ifndef DKEY_H_ 3 | #define DKEY_H_ 4 | #include "Librerias.h" 5 | 6 | 7 | class DivelKey : public wxDialog 8 | { 9 | public: 10 | DivelKey(); 11 | void OnQuit(wxCommandEvent& event); 12 | void OnObtener(wxCommandEvent& event); 13 | void OnAceptar(wxCommandEvent& event); 14 | void VerTrucos(wxCommandEvent& event); 15 | 16 | 17 | }; 18 | 19 | enum{ 20 | ID_KEY1 = 1124, 21 | ID_KEY2 = 1125, 22 | ID_KEY3 = 1126, 23 | ID_KEY4 = 1127, 24 | ID_KEY5 = 1128 25 | }; 26 | 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | azpazeta-original (1.0.0.6) precise; urgency=low 2 | 3 | * Actualizar fuentes a GitHub 4 | * Cambiar nombre de paquete a azpazeta-original 5 | 6 | -- Adrian Arroyo Calle (Divel) Mon, 27 Jan 2014 12:00:00 +1200 7 | 8 | azpazeta (1.0.0.5) precise; urgency=low 9 | 10 | * Optimizacion amd64 11 | * Errores de Render 12 | * Formato de archivos en ZIP 13 | * Dependencias actualizadas 14 | 15 | -- Adrian Arroyo Calle (Divel) Wed, 09 Sep 2012 17:04:19 +1200 16 | -------------------------------------------------------------------------------- /source/Instalar MIME.txt: -------------------------------------------------------------------------------- 1 | 1 Documento de instalación: 2 | 3 | 4 | 5 | 6 | Azpazeta Save File 7 | Partidas de Azpazeta 8 | 9 | 10 | 11 | 12 | 2. Instalar con: xdg-mime install azpazeta-mime.xml 13 | 3. Default con: xdg-mime default Azpazeta.desktop application/x-azpazeta-savefile 14 | 15 | -------------------------------------------------------------------------------- /source/chr_taskbar.cpp: -------------------------------------------------------------------------------- 1 | #include "wx/wx.h" 2 | 3 | #include "chr_taskbar.h" 4 | #include "Librerias.h" 5 | 6 | 7 | BEGIN_EVENT_TABLE(ChrTaskBarIcon, wxTaskBarIcon) 8 | EVT_MENU(ID_APAGAR, ChrTaskBarIcon::OnMenuExit) 9 | END_EVENT_TABLE() 10 | 11 | ChrTaskBarIcon::ChrTaskBarIcon() { 12 | m_ok = new wxICON(sample); 13 | } 14 | 15 | void ChrTaskBarIcon::OnMenuExit(wxCommandEvent& event) { 16 | } 17 | 18 | wxMenu* ChrTaskBarIcon::CreatePopupMenu() { 19 | wxMenu* menu = new wxMenu(); 20 | 21 | menu->Append(ID_APAGAR, wxT("E&xit")); 22 | 23 | return menu; 24 | } 25 | -------------------------------------------------------------------------------- /source/police.h: -------------------------------------------------------------------------------- 1 | //Police.h 2 | #ifndef POLICE_H_ 3 | #define POLICE_H_ 4 | #include "Librerias.h" 5 | class Police : public wxDialog 6 | { 7 | public: 8 | Police(); 9 | void OnQuit(wxCommandEvent& event); 10 | void Reportar(wxCommandEvent& event); 11 | void Sobornar(wxCommandEvent& event); 12 | wxStaticText* ultimahora; 13 | wxButton* primero; 14 | 15 | 16 | }; 17 | 18 | enum{ 19 | ID_POLICE1 = 1224, 20 | ID_POLICE2 = 1225, 21 | ID_POLICE3 = 1226, 22 | ID_POLICE4 = 1227, 23 | ID_POLICE5 = 1228 24 | }; 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /source/dialogbox.h: -------------------------------------------------------------------------------- 1 | #ifndef DIAGBOX_H_ 2 | #define DIAGBOX_H_ 3 | #include "Librerias.h" 4 | 5 | class DialogBox : public wxDialog { 6 | public: 7 | DialogBox(); 8 | void Next(wxCommandEvent& event); 9 | wxStaticText* line1; 10 | wxStaticText* line2; 11 | wxStaticText* line3; 12 | wxStaticText* line4; 13 | wxStaticText* line5; 14 | wxStaticText* line6; 15 | wxStaticText* line7; 16 | wxStaticText* line8; 17 | wxStaticText* line9; 18 | wxStaticText* line10; 19 | wxPanel* diagpanel; 20 | }; 21 | 22 | enum{ 23 | ID_NEXT 24 | }; 25 | 26 | 27 | 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /source/azpazeta.h: -------------------------------------------------------------------------------- 1 | #ifndef AZPAZETA_H 2 | #define AZPAZETA_H 3 | #include "Librerias.h" 4 | 5 | 6 | class MyApp : public wxApp 7 | { 8 | public: 9 | // override base class virtuals 10 | // ---------------------------- 11 | 12 | // this one is called on application startup and is a good place for the app 13 | // initialization (doing it here and not in the ctor allows to have an error 14 | // return: if OnInit() returns false, the application terminates) 15 | virtual bool OnInit(); 16 | //virtual void OnRun(); //Hacer comprobaciones 17 | 18 | 19 | 20 | 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /source/gorguez.h: -------------------------------------------------------------------------------- 1 | //gorguez 2 | #ifndef GORGUEZ_H_ 3 | #define GORGUEZ_H_ 4 | #include "Librerias.h" 5 | 6 | class Gorguez : public wxDialog{ 7 | public: 8 | Gorguez(); 9 | void Comprar(wxCommandEvent& event); 10 | void Tour(wxCommandEvent& event); 11 | void Trabajar(wxCommandEvent& event); 12 | void Suscribirse(wxCommandEvent& event); 13 | wxButton* socios; 14 | wxButton* trabajar; 15 | wxButton* tour; 16 | wxButton* comprar; 17 | wxStaticText* info_hiper; 18 | 19 | }; 20 | 21 | enum{ 22 | ID_GOR1, 23 | ID_GOR2, 24 | ID_GOR3, 25 | ID_GOR4, 26 | ID_GOR5, 27 | ID_GOR6 28 | 29 | }; 30 | 31 | 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /source/Azpazeta.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Name=Azpazeta 4 | Comment=Azpazeta, the economic and strategy game. 5 | Comment[es]=Azpazeta, el juego económico y estratégico. 6 | Exec="/opt/extras.ubuntu.com/azpazeta/Azpazeta" %f 7 | Terminal=false 8 | Type=Application 9 | Icon=azpazeta 10 | Categories=GTK;KDE;Games; 11 | MimeType=application/x-azpazeta-savefile 12 | Name[es_ES]=Azpazeta 13 | GenericName=Economic and strategy game 14 | GenericName[es_ES]=Juego de estrategia y economía 15 | 16 | X-Ayatana-Desktop-Shortcuts=AZPServer;Bug; 17 | 18 | [Bug Shortcut Group] 19 | Name=Report a bug 20 | Exec=xdg-open http://bugs.launchpad.net/azpazeta 21 | OnlyShowIn=Unity 22 | 23 | 24 | -------------------------------------------------------------------------------- /source/mercado.h: -------------------------------------------------------------------------------- 1 | //Mercado Central Estándar 2 | #ifndef MERCADO_H_ 3 | #define MERCADO_H_ 4 | #include "Librerias.h" 5 | 6 | class Mercado : public wxDialog{ 7 | public: 8 | Mercado(); 9 | void Comprar(wxCommandEvent& event); 10 | void Vender(wxCommandEvent& event); 11 | void TransformarMateria(wxCommandEvent& event); 12 | void VenderMateria(wxCommandEvent& event); 13 | wxButton* Mcomprar; 14 | wxButton* Mvender; 15 | wxButton* Mtransformarmateria; 16 | wxButton* Mvendermateria; 17 | wxStaticText* info_mercado; 18 | private: 19 | int precioproc[4]; 20 | 21 | 22 | 23 | }; 24 | 25 | enum{ 26 | ID_MERCADO1, 27 | ID_MERCADO2, 28 | ID_MERCADO3, 29 | ID_MERCADO4 30 | 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: azpazeta-original 2 | Section: games 3 | Priority: optional 4 | Maintainer: Adrian Arroyo Calle (Divel) 5 | Build-Depends: debhelper (>= 7), libstdc++6(>= 4.1), libgtk-3-dev, libgdk-pixbuf2.0-0, libcairo2, libcairomm-1.0-1, libpango1.0-0, libpangomm-1.4-1, libx11-6, libsm6, libpango1.0-dev, libgtk2.0-dev, libnotify4, libnotify-bin, libwxbase3.0-0, libwxbase3.0-dev, libwxgtk3.0-0, libwxgtk3.0-dev, wx3.0-headers, wx3.0-i18n, libnotify-dev, libglib2.0-dev, libgdk-pixbuf2.0-dev 6 | Standards-Version: 3.9.2 7 | Homepage: http://sites.google.com/site/divelmedia 8 | 9 | 10 | Architecture: any 11 | Depends:${shlibs:Depends} 12 | Version: 1.0.0.6 13 | Description: Azpazeta 14 | The strategy-economics game. 15 | Package: azpazeta-original 16 | -------------------------------------------------------------------------------- /source/beep.cpp: -------------------------------------------------------------------------------- 1 | /*#include 2 | #include 3 | #include 4 | 5 | int main(){ 6 | printf("\007"); 7 | Beep(587,500); 8 | 9 | return 0; 10 | }*/ 11 | 12 | 13 | #include 14 | #include 15 | #include 16 | #if !(WIN32) 17 | #define beep(x,y) 18 | #endif 19 | 20 | int main() 21 | { 22 | 23 | puts("using winAPI Beep(frequency_hrz, duration_ms)..."); 24 | beep(523,5000); /* 523 hertz (C5) for 500 milliseconds*/ 25 | beep(587,5000); 26 | beep(659,5000); 27 | beep(698,5000); 28 | beep(784,5000); 29 | usleep(500000); 30 | puts("\n\\a makes a beep on the internal speaker too ..."); 31 | usleep(500000); 32 | puts("\a"); 33 | usleep(500000); 34 | puts("\a"); 35 | 36 | getchar(); 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /source/hiper.h: -------------------------------------------------------------------------------- 1 | //Hipermercado 2 | 3 | #ifndef HIPER_H_ 4 | #define HIPER_H_ 5 | #include "Librerias.h" 6 | 7 | class Hiper : public wxDialog{ 8 | public: 9 | Hiper(); 10 | //ComprarDlg(); 11 | void Comprar(wxCommandEvent& event); 12 | void Tour(wxCommandEvent& event); 13 | void Trabajar(wxCommandEvent& event); 14 | void Suscribirse(wxCommandEvent& event); 15 | wxButton* socios; 16 | wxButton* trabajar; 17 | wxButton* tour; 18 | wxButton* comprar; 19 | wxStaticText* info_hiper; 20 | private: 21 | int precioproc[4]; 22 | }; 23 | 24 | enum{ 25 | 26 | ID_HIPER1=1301, 27 | ID_HIPER2=1302, 28 | ID_HIPER3=1303, 29 | ID_HIPER4=1304, 30 | ID_COMPRAR1, 31 | ID_COMPRAR2, 32 | ID_COMPRAR3, 33 | ID_COMPRAR4, 34 | ID_COMPRAR5, 35 | ID_COMPRAR6 36 | 37 | }; 38 | 39 | 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /source/azpazeta.cpp: -------------------------------------------------------------------------------- 1 | #include "Librerias.h" 2 | 3 | IMPLEMENT_APP(MyApp) 4 | 5 | bool MyApp::OnInit() 6 | { 7 | // call the base class initialization method, currently it only parses a 8 | // few common command-line options but it could be do more in the future 9 | if ( !wxApp::OnInit() ) 10 | return false; 11 | SetAppName(wxT("Visual Divel Start")); 12 | SetVendorName(wxT("Adrian Arroyo Calle para Divel")); 13 | 14 | // create the main application window 15 | MyFrame *frame = new MyFrame("Visual Divel Start"); 16 | 17 | // and show it (the frames, unlike simple controls, are not shown when 18 | // created initially) 19 | frame->Show(true); 20 | 21 | 22 | 23 | // success: wxApp::OnRun() will be called which will enter the main message 24 | // loop and the application will run. If we returned false here, the 25 | // application would exit immediately. 26 | return true; 27 | } 28 | -------------------------------------------------------------------------------- /source/libazpupdater.cpp: -------------------------------------------------------------------------------- 1 | #include "azpupdater.h" 2 | #include 3 | #include 4 | 5 | bool AZPUpdater::CheckUpdates() 6 | { 7 | float newversion; 8 | float actualversion=1.0; 9 | wxProgressDialog checkupdates("Azpazeta Updater","Comprobando actualizaciones",5); 10 | //Web de actualizacion https://launchpadlibrarian.net/113495996/AZPUpdater.txt 11 | system("mkdir -p /opt/extras.ubuntu.com/azpazeta/updates"); 12 | checkupdates.Update(1); 13 | system("wget https://launchpadlibrarian.net/113495996/AZPUpdater.txt -o /opt/extras.ubuntu.com/azpazeta/updates/AZPUpdater.txt"); 14 | checkupdates.Update(2); 15 | FILE* fileupdate; 16 | fileupdate=fopen("/opt/extras.ubuntu.com/azpazeta/updates/AZPUpdater.txt","r"); 17 | if(fileupdate){ 18 | checkupdates.Update(3); 19 | fscanf(fileupdate,"AZPUpdaterFile:%f",&newversion); 20 | fclose(fileupdate); 21 | checkupdates.Update(4); 22 | if(newversion<=actualversion){checkupdates.Update(5);wxMessageBox("No hay actualizaciones","AZPUpdater",wxOK|wxICON_INFORMATION);} 23 | if(newversion>actualversion){checkupdates.Update(5);wxMessageBox("Hay actualizaciones disponibles","AZPUpdater",wxOK|wxICON_INFORMATION);} 24 | 25 | 26 | }else{wxMessageBox("Error while AZPUpdater check updates","AZPUpdater",wxOK|wxICON_ERROR);} 27 | } 28 | -------------------------------------------------------------------------------- /source/save.h: -------------------------------------------------------------------------------- 1 | //Sistema de guardado y cargado de archivos 2 | #ifndef SAVE_H_ 3 | #define SAVE_H_ 4 | /*#include "wx/wxprec.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "VarGlobal.h" 12 | #include 13 | #include 14 | #include "Idiomas.h"*/ 15 | #include "inicio.hpp" 16 | using namespace std; 17 | #ifndef WX_PRECOMP 18 | #include "wx/wx.h" 19 | #endif 20 | class SaveDialog : public wxDialog 21 | { 22 | public: 23 | SaveDialog(); 24 | void OnQuit(wxCommandEvent& event); 25 | void OnBotonGuardarStd(wxCommandEvent& event); 26 | void OnBotonCargarStd(wxCommandEvent& event); 27 | void OnBotonGuardarCopy(wxCommandEvent& event); 28 | void OnBotonCargarCopy(wxCommandEvent& event); 29 | void Guardar(wxString archivo); 30 | void Cargar(wxString archivo); 31 | wxStaticText* instrucciones; 32 | wxStaticText* salida; 33 | wxStaticText* precio; 34 | wxStaticText* ciudad1; 35 | wxStaticText* salida1; 36 | wxStaticText* precio1; 37 | wxStaticText* ultimaHora; 38 | wxStaticText* ultimahora; 39 | wxButton* guardar_std; 40 | wxButton* guardar_copy; 41 | wxButton* cargar_copy; 42 | wxButton* cargar_std; 43 | 44 | }; 45 | 46 | enum{ 47 | ID_SAVE1 = 1029, 48 | ID_SAVE2 = 1030, 49 | ID_SAVE3 = 1031, 50 | ID_SAVE4 = 1032, 51 | ID_SAVE5 = 1033 52 | }; 53 | 54 | 55 | #endif 56 | 57 | -------------------------------------------------------------------------------- /source/sample.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *const sample_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 6 1", 5 | " c black", 6 | ". c navy", 7 | "X c red", 8 | "o c yellow", 9 | "O c gray100", 10 | "+ c None", 11 | /* pixels */ 12 | "++++++++++++++++++++++++++++++++", 13 | "++++++++++++++++++++++++++++++++", 14 | "++++++++++++++++++++++++++++++++", 15 | "++++++++++++++++++++++++++++++++", 16 | "++++++++++++++++++++++++++++++++", 17 | "++++++++ ++++++++++", 18 | "++++++++ ............ ++++++++++", 19 | "++++++++ ............ ++++++++++", 20 | "++++++++ .OO......... ++++++++++", 21 | "++++++++ .OO......... ++++++++++", 22 | "++++++++ .OO......... ++++++++++", 23 | "++++++++ .OO...... ", 24 | "++++++++ .OO...... oooooooooooo ", 25 | " .OO...... oooooooooooo ", 26 | " XXXXXXX .OO...... oOOooooooooo ", 27 | " XXXXXXX .OO...... oOOooooooooo ", 28 | " XOOXXXX ......... oOOooooooooo ", 29 | " XOOXXXX ......... oOOooooooooo ", 30 | " XOOXXXX oOOooooooooo ", 31 | " XOOXXXXXXXXX ++++ oOOooooooooo ", 32 | " XOOXXXXXXXXX ++++ oOOooooooooo ", 33 | " XOOXXXXXXXXX ++++ oOOooooooooo ", 34 | " XOOXXXXXXXXX ++++ oooooooooooo ", 35 | " XOOXXXXXXXXX ++++ oooooooooooo ", 36 | " XXXXXXXXXXXX ++++ ", 37 | " XXXXXXXXXXXX ++++++++++++++++++", 38 | " ++++++++++++++++++", 39 | "++++++++++++++++++++++++++++++++", 40 | "++++++++++++++++++++++++++++++++", 41 | "++++++++++++++++++++++++++++++++", 42 | "++++++++++++++++++++++++++++++++", 43 | "++++++++++++++++++++++++++++++++" 44 | }; 45 | -------------------------------------------------------------------------------- /source/tren.h: -------------------------------------------------------------------------------- 1 | #ifndef TREN_H_ 2 | #define TREN_H_ 3 | #include "wx/wxprec.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "VarGlobal.h" 11 | #include 12 | #include 13 | #include "Idiomas.h" 14 | using namespace std; 15 | 16 | #ifdef __BORLANDC__ 17 | #pragma hdrstop 18 | #endif 19 | 20 | // for all others, include the necessary headers (this file is usually all you 21 | // need because it includes almost all "standard" wxWidgets headers) 22 | #ifndef WX_PRECOMP 23 | #include "wx/wx.h" 24 | #endif 25 | 26 | 27 | 28 | 29 | class TrenDialog : public wxDialog 30 | { 31 | public: 32 | TrenDialog(); 33 | void OnQuit(wxCommandEvent& event); 34 | void OnPrimero(wxCommandEvent& event); 35 | void OnSegundo(wxCommandEvent& event); 36 | void OnTercero(wxCommandEvent& event); 37 | void OnCuarto(wxCommandEvent& event); 38 | void OnQuinto(wxCommandEvent& event); 39 | void ProcesarViajes(wxString destino, int precio); 40 | wxStaticText* ciudad; 41 | wxStaticText* salida; 42 | wxStaticText* precio; 43 | wxStaticText* ciudad1; 44 | wxStaticText* salida1; 45 | wxStaticText* precio1; 46 | wxStaticText* ultimaHora; 47 | wxStaticText* ultimahora; 48 | wxButton* primero; 49 | wxButton* segundo; 50 | wxButton* tercero; 51 | wxButton* cuarto; 52 | wxButton* quinto; 53 | wxButton* salir; 54 | wxButton* noHayOtro; 55 | 56 | 57 | }; 58 | 59 | enum{ 60 | ID_TREN1 = 1024, 61 | ID_TREN2 = 1025, 62 | ID_TREN3 = 1026, 63 | ID_TREN4 = 1027, 64 | ID_TREN5 = 1028 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /multiplayer/Cliente.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | main () 6 | { 7 | /* 8 | * Descriptor del socket y buffer para datos 9 | */ 10 | int Socket_Con_Servidor; 11 | char Cadena[2048]; 12 | char ip[2048]; 13 | 14 | /* 15 | * Se abre la conexion con el servidor, pasando el nombre del ordenador 16 | * y el servicio solicitado. 17 | * "localhost" corresponde al nombre del mismo ordenador en el que 18 | * estamos corriendo. Esta dado de alta en /etc/hosts 19 | * "cpp_java" es un servicio dado de alta en /etc/services 20 | */ 21 | printf("Escribe la IP:\n"); 22 | fgets(ip,2048,stdin); 23 | printf("Accediendo a IP: %s",ip); 24 | Socket_Con_Servidor = Abre_Conexion_Inet (ip, "cpp_java"); 25 | if (Socket_Con_Servidor == 1) 26 | { 27 | printf ("No puedo establecer conexion con el servidor\n"); 28 | exit (-1); 29 | } 30 | 31 | /* 32 | * Se prepara una cadena con 5 caracteres y se envia, 4 letras mas 33 | * el \0 que indica fin de cadena en C 34 | */ 35 | Lee_Socket (Socket_Con_Servidor, Cadena, 2048); 36 | printf("%s",Cadena); 37 | printf("Escribe tu nombre\n"); 38 | scanf("%s",Cadena); 39 | //strcpy (Cadena, "Hola"); 40 | Escribe_Socket (Socket_Con_Servidor, Cadena, 2048); 41 | 42 | /* 43 | * Se lee la informacion enviada por el servidor, que se supone es 44 | * una cadena de 6 caracteres. 45 | */ 46 | Lee_Socket (Socket_Con_Servidor, Cadena, 2048); 47 | 48 | /* 49 | * Se escribe en pantalla la informacion recibida del servidor 50 | */ 51 | printf ("El server responde :\n %s\n", Cadena); 52 | 53 | /* 54 | * Se cierra el socket con el servidor 55 | */ 56 | //close (Socket_Con_Servidor); 57 | } 58 | -------------------------------------------------------------------------------- /source/Makefile: -------------------------------------------------------------------------------- 1 | #Makefile de Visual Divel Start 2 | #(C) Adrián Arroyo Calle 2012 3 | # Macros 4 | 5 | CC = g++ 6 | CFLAGS = `wx-config --cppflags` #`pkg-config --cflags glib-2.0 gtk+-2.0` 7 | PRE = -DIDIOMA=ES -DLINUX 8 | SRC = inicio.cpp 9 | OBJ = VarGlobal.o Inicio.o save.o tren.o dkey.o police.o hiper.o golf.o dialogbox.o mercado.o 10 | EXIT = Azpazeta 11 | LIBFLAGS = `wx-config --libs` #`pkg-config --libs glib-2.0 gtk+-2.0` -L. -lnotify #-lmodloader -lazpupdater 12 | 13 | 14 | # Reglas explicitas 15 | 16 | all: $(OBJ) 17 | g++ -o Azpazeta $(OBJ) $(LIBFLAGS) 18 | Inicio.o: 19 | g++ -c inicio.cpp -o Inicio.o $(PRE) $(CFLAGS) 20 | dkey.o: 21 | g++ -c dkey.cpp -o dkey.o $(PRE) $(CFLAGS) 22 | police.o: 23 | g++ -c police.cpp -o police.o $(PRE) $(CFLAGS) 24 | VarGlobal.o: 25 | g++ -c VarGlobal.cpp -o VarGlobal.o $(PRE) $(CFLAGS) 26 | save.o: 27 | g++ -c save.cpp -o save.o $(PRE) $(CFLAGS) 28 | tren.o: 29 | g++ -c tren.cpp -o tren.o $(PRE) $(CFLAGS) 30 | hiper.o: 31 | g++ -c hiper.cpp -o hiper.o $(PRE) $(CFLAGS) 32 | golf.o: 33 | g++ -c golf.cpp -o golf.o $(PRE) $(CFLAGS) 34 | dialogbox.o: 35 | g++ -c dialogbox.cpp -o dialogbox.o $(PRE) $(CFLAGS) 36 | mercado.o: 37 | g++ -c mercado.cpp -o mercado.o $(PRE) $(CFLAGS) 38 | manual: 39 | g++ -c inicio.cpp $(CFLAGS) -DIDIOMA=ES -o inicio.o 40 | g++ -o Azpazeta inicio.o $(LIBFLAGS) 41 | modloader: 42 | g++ -fPIC -c -o libmodloader.o libmodloader.cpp $(CFLAGS) 43 | g++ -shared -fPIC -o libmodloader.so libmodloader.o 44 | sudo cp libmodloader.so /opt/extras.ubuntu.com/azpazeta/lib/ 45 | azpupdater: 46 | g++ -fPIC -c -o libazpupdater.o libazpupdater.cpp $(CFLAGS) 47 | g++ -shared -fPIC -o libazpupdater.so libazpupdater.o 48 | sudo cp libazpupdater.so /opt/extras.ubuntu.com/azpazeta/lib/ 49 | 50 | 51 | 52 | clean: 53 | $(RM) $(OBJ) 54 | 55 | # Reglas implicitas 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /source/Idiomas.h: -------------------------------------------------------------------------------- 1 | //#ifndef IDIOMAS_H 2 | //#define IDIOMAS_H 3 | //Sistema de compilación separada por idiomas 4 | #if IDIOMA == ES 5 | //Español 6 | #define CAP1MIS1TEX1 "Quien eres?\nNo te conozco.\nEres el nuevo?\nPresiona ENTER" 7 | #define GO "Ir" 8 | #define ERROR_101 "El archivo no existe o es corrupto" 9 | #define DKEY_101 "Esta es la tienda de Azpazeta\nAqui podras comprar extras y trucos\nPero para eso necesitas\nrellenar la encuesta y obtener\nla clave Divel Key\nLa encuesta es anonima\ny solo sirve para\nconocer mejor al usuario\n" 10 | #define DKEY_102 "Obtener clave" 11 | #define DKEY_103 "Has desbloqueado la Divel House\nPuedes ver los trucos que tienes activados\n o obtener unos nuevos (futuras actualizaciones)\n" 12 | #define DKEY_104 "Ver trucos" 13 | #define POLICE_101 "Bienvenido a la comisaria.\n Si tienes algo que reportar fuera de la ley, hazlo aqui." 14 | #define POLICE_102 "Informar de producto ilegal" 15 | #define POLICE_103 "Soborno policial" 16 | #define HIPER_101 "Bienvenido a Cadena Inc.\nAqui podras comprar productos y ganar dinero como empleado\nPuedes hacer un tour para ver las ofertas\n o hacerte socio (100 $) para tener mejores ofertas" 17 | #define COMPRAR_101 "Compra aqui los productos en oferta\n No se pueden devolver" 18 | #define GOLF_101 "La riqueza de Azpazeta se reune aqui\nVendeles productos caros" 19 | #define MERCADO_101 "El mercado central de Gorguez\nAqui las tiendas compran su mercancia" 20 | #else 21 | //Inglés 22 | 23 | #define GO "Go" 24 | #define ERROR_101 "The file doesn't exist" 25 | #define DKEY_101 "This is the Azpazeta's store\nYou can buy cheats and extras\nBut for this you need\nto make the poll and get the key\nThe poll is anonymous\n" 26 | #define DKEY_102 "Get Key" 27 | #define DKEY_103 "You can view the cheats or get new cheats (in updates)" 28 | #define DKEY_104 "View cheats" 29 | 30 | //#endif 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This work was packaged for Debian by: 2 | 3 | Adrian Arroyo Calle on Fri, 08 Jun 2012 17:06:42 +-700 4 | 5 | It was downloaded from: 6 | 7 | http://sites.google.com/site/divelmedia 8 | 9 | Upstream Author(s): 10 | 11 | Adrian Arroyo Calle 12 | 13 | Copyright: 14 | 15 | > 16 | 17 | License: 18 | 19 | This program is free software: you can redistribute it and/or modify 20 | it under the terms of the GNU General Public License as published by 21 | the Free Software Foundation, either version 3 of the License, or 22 | (at your option) any later version. 23 | 24 | This package is distributed in the hope that it will be useful, 25 | but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | GNU General Public License for more details. 28 | 29 | You should have received a copy of the GNU General Public License 30 | along with this program. If not, see . 31 | 32 | On Debian systems, the complete text of the GNU General 33 | Public License version 3 can be found in `/usr/share/common-licenses/GPL-3`. 34 | 35 | The Debian packaging is: 36 | 37 | > 38 | 39 | # Please chose a license for your packaging work. If the program you package 40 | # uses a mainstream license, using the same license is the safest choice. 41 | # Please avoid to pick license terms that are more restrictive than the 42 | # packaged work, as it may make Debian`s contributions unacceptable upstream. 43 | # If you just want it to be GPL version 3, leave the following line in. 44 | 45 | and is licensed under the GPL version 3, see above. 46 | 47 | # Please also look if there are files or directories which have a 48 | # different copyright/license attached and list them here. 49 | -------------------------------------------------------------------------------- /source/inicio.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////// 2 | ///AZPAZETA 1.0 3 | ////////////////////////////////////////////////////////// 4 | //Azpazeta es el juego de comerciantes medievales de Divel Games 5 | ///////////////////////////////////////////////////////////// 6 | //Versión en Español 7 | /////////////////////////////////////////////////////////// 8 | //Versión adaptada especialmente para Ubuntu 9 | ///////////////////////////////////////////////////////////// 10 | //Menú de juego 11 | ///////////////////////////////////////////////////////////// 12 | #ifndef INICIO_HPP_ 13 | #define INICIO_HPP_ 14 | #include "wx/wxprec.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include "Icono64.xpm" 23 | #include "tren.h" 24 | #include "VarGlobal.h" 25 | #include "Idiomas.h" 26 | #include 27 | #include "save.h" 28 | #include "Librerias.h" 29 | using namespace std; 30 | 31 | #ifdef __BORLANDC__ 32 | #pragma hdrstop 33 | #endif 34 | 35 | // for all others, include the necessary headers (this file is usually all you 36 | // need because it includes almost all "standard" wxWidgets headers) 37 | #ifndef WX_PRECOMP 38 | #include "wx/wx.h" 39 | #endif 40 | 41 | // ---------------------------------------------------------------------------- 42 | // resources 43 | // ---------------------------------------------------------------------------- 44 | 45 | // the application icon (under Windows and OS/2 it is in resources and even 46 | // though we could still include the XPM here it would be unused) 47 | #if !defined(__WXMSW__) && !defined(__WXPM__) 48 | #include "sample.xpm" 49 | #endif 50 | 51 | // ---------------------------------------------------------------------------- 52 | // private classes 53 | // ---------------------------------------------------------------------------- 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /source/Icono.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * Icono_xpm[] = { 3 | "32 32 39 1", 4 | " c None", 5 | ". c #1AE200", 6 | "+ c #1EFF00", 7 | "@ c #021600", 8 | "# c #000000", 9 | "$ c #031F00", 10 | "% c #1BEC00", 11 | "& c #1CEF00", 12 | "* c #052D00", 13 | "= c #1CF100", 14 | "- c #1DFA00", 15 | "; c #1CF600", 16 | "> c #042800", 17 | ", c #1DFC00", 18 | "' c #053200", 19 | ") c #1DFD00", 20 | "! c #222000", 21 | "~ c #333000", 22 | "{ c #B5AA00", 23 | "] c #FCEE00", 24 | "^ c #FFF000", 25 | "/ c #EAF100", 26 | "( c #53FB00", 27 | "_ c #28FE00", 28 | ": c #B6AB00", 29 | "< c #61FA00", 30 | "[ c #1A1800", 31 | "} c #F5E700", 32 | "| c #99F600", 33 | "1 c #23FE00", 34 | "2 c #373400", 35 | "3 c #B5F400", 36 | "4 c #34FD00", 37 | "5 c #F5E600", 38 | "6 c #FBF000", 39 | "7 c #83F800", 40 | "8 c #FEF000", 41 | "9 c #C8F300", 42 | "0 c #4BFC00", 43 | " .++++.@ ", 44 | " ##$%++++%$ ", 45 | " #####$&++++&* ", 46 | " ######$=++++- ", 47 | " ########$;+++++ ", 48 | " ##########>,+++++ ", 49 | " ############')+++++ ", 50 | " ############# ++++++ ", 51 | " ########### ++++++ ", 52 | " ########### ++++++ ", 53 | " ########## +++++ ", 54 | " ########## +++++ ", 55 | " ######### +++++ ", 56 | " ######## ++++++ ", 57 | " #######! ++++++ ", 58 | " #####~{]^^^^^^^^^^^/(_++++ ", 59 | " #####:^^^^^^^^^^^^^^/<++++ ", 60 | " #####[}^^^^^^^^^^^^^^^|1+++ ", 61 | " #####2]^^^^^^^^^^^^^^^34+++ ", 62 | " ######5^^^^^^^^^^^^^^67++++ ", 63 | " ###### ^^^^^^^^^^^^^890++++ ", 64 | " ###### ++++++ ", 65 | " ###### ++++++ ", 66 | " ###### ++++++ ", 67 | " ###### +++++++ ", 68 | " ###### ++++++ ", 69 | " ###### ++++++ ", 70 | " ###### ++++ ", 71 | " ###### ++ ", 72 | " ###### ", 73 | " #### ", 74 | " "}; 75 | -------------------------------------------------------------------------------- /source/dialogbox.cpp: -------------------------------------------------------------------------------- 1 | //dialogbox.cpp 2 | #include "Librerias.h" 3 | 4 | 5 | extern int mision,money; 6 | int breadypan; 7 | 8 | 9 | 10 | DialogBox::DialogBox() 11 | : wxDialog(NULL, wxID_ANY, wxT("Bread & Pan"), wxPoint(-1,-1), wxSize(400,400)) 12 | { 13 | diagpanel=new wxPanel(this); 14 | if(money>=100000){ 15 | wxMessageBox("Felicidades, has logrado 100.000 $. Has terminado el juego, ahora puedes jugar multijugador, seguir jugando o esperar nuevas actualizaciones (nuevas ciudades, nuevos productos,...)"); 16 | }else 17 | if(mision==16){ 18 | line1=new wxStaticText(diagpanel, wxID_ANY, "-Veo que traes los panes, no es cierto", wxPoint(-1,-1)); 19 | 20 | 21 | 22 | 23 | 24 | } 25 | wxButton* next=new wxButton(diagpanel, ID_NEXT, "Siguiente", wxPoint(175,350)); 26 | Connect(ID_NEXT,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(DialogBox::Next)); 27 | breadypan=1; 28 | 29 | } 30 | 31 | void DialogBox::Next(wxCommandEvent& event) 32 | { 33 | if(mision==16){ 34 | switch(breadypan){ 35 | case 1: line2=new wxStaticText(diagpanel, wxID_ANY, "-Si, traigo los panes que pidio en Azpazeta",wxPoint(-1, 10)); breadypan++;break; 36 | case 2: line3=new wxStaticText(diagpanel, wxID_ANY, "-Vale, te pagare 100 $",wxPoint(-1, 20)); breadypan++; money+=100;break; 37 | case 3: line4=new wxStaticText(diagpanel, wxID_ANY, "Tienes madera de vendededor, querrias serlo",wxPoint(-1, 30)); breadypan++;break; 38 | 39 | case 4: line5=new wxStaticText(diagpanel, wxID_ANY, "-Por supuesto, necesitare casa",wxPoint(-1, 40)); breadypan++;break; 40 | case 5: line6=new wxStaticText(diagpanel, wxID_ANY, "-Te la dare, pero me deberas pagar 100.000 $",wxPoint(-1, 50)); breadypan++;break; 41 | case 6: line7=new wxStaticText(diagpanel, wxID_ANY, "Sal a fuera y consigue los 100.000 $",wxPoint(-1, 60)); breadypan++;break; 42 | case 7: line8=new wxStaticText(diagpanel, wxID_ANY, "Cuando los tengas, vienes y te dare una sorpresa",wxPoint(-1, 70)); breadypan++;break; 43 | case 8: line9=new wxStaticText(diagpanel, wxID_ANY, "-Vale, trato hecho, a conseguir 100.000",wxPoint(-1, 80)); breadypan++;break; 44 | case 9: mision++; this->Destroy(); 45 | 46 | } 47 | 48 | 49 | 50 | 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /multiplayer/Socket_Cliente.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Includes del sistema 3 | */ 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | /* 13 | * Conecta con un servidor Unix, en la misma maquina. 14 | * Devuelve descriptor de socket si todo es correcto, -1 si hay error. 15 | */ 16 | int Abre_Conexion_Unix (char *Servicio) 17 | { 18 | struct sockaddr_un Direccion; 19 | int Descriptor; 20 | 21 | strcpy (Direccion.sun_path, Servicio); 22 | Direccion.sun_family = AF_UNIX; 23 | 24 | Descriptor = socket (AF_UNIX, SOCK_STREAM, 0); 25 | if (Descriptor == -1) 26 | return -1; 27 | 28 | /* 29 | * Devuelve 0 si todo va bien, -1 en caso de error 30 | */ 31 | if (connect ( 32 | Descriptor, 33 | (struct sockaddr *)&Direccion, 34 | strlen (Direccion.sun_path) + sizeof (Direccion.sun_family)) == -1) 35 | { 36 | return -1; 37 | } 38 | else 39 | { 40 | return Descriptor; 41 | } 42 | } 43 | 44 | /* 45 | / Conecta con un servidor remoto a traves de socket INET 46 | */ 47 | int Abre_Conexion_Inet ( 48 | char *Host_Servidor, 49 | char *Servicio) 50 | { 51 | struct sockaddr_in Direccion; 52 | struct servent *Puerto; 53 | struct hostent *Host; 54 | int Descriptor; 55 | 56 | //Puerto = getservbyname ("www", "tcp"); 57 | //Puerto->s_port=6996; 58 | //Puerto->s_name="divelnet"; 59 | //Puerto = getservbyname (Servicio, "tcp"); 60 | //if (Puerto == NULL) 61 | //return -1; 62 | //Puerto->s_port=6996; //Editar esto si procede 63 | //Host = gethostbyname ("localhost"); 64 | //Host->h_addr=Host_Servidor; 65 | //if (Host == NULL) 66 | //return -1; 67 | Direccion.sin_addr.s_addr=inet_addr(Host_Servidor); 68 | 69 | Direccion.sin_family = AF_INET; 70 | //Direccion.sin_addr.s_addr = ((struct in_addr *)(Host->h_addr))->s_addr; //Direccion.sin_addr.s_addr = ((struct in_addr *)(Host->h_addr))->s_addr; 71 | Direccion.sin_port = 6996; //Direccion.sin_port = Puerto->s_port; 72 | 73 | Descriptor = socket (AF_INET, SOCK_STREAM, 0); 74 | if (Descriptor == -1) 75 | return -1; 76 | 77 | if (connect ( 78 | Descriptor, 79 | (struct sockaddr *)&Direccion, 80 | sizeof (Direccion)) == -1) 81 | { 82 | return -1; 83 | } 84 | 85 | return Descriptor; 86 | } 87 | -------------------------------------------------------------------------------- /source/police.cpp: -------------------------------------------------------------------------------- 1 | //Police.cpp 2 | #include "Librerias.h" 3 | #include "police.h" 4 | 5 | extern int sobornos, blacklist, money, droga; 6 | 7 | Police::Police() 8 | : wxDialog(NULL, wxID_ANY, wxT("Police Station"), wxPoint(-1,-1), wxSize(400,400)) 9 | { 10 | //wxInitAllImageHandlers(); 11 | wxPanel* panelPolice=new wxPanel(this); 12 | wxStaticText* info_police=new wxStaticText(panelPolice,wxID_ANY,POLICE_101); 13 | wxButton* reporte=new wxButton(panelPolice, ID_POLICE1,POLICE_102,wxPoint(100,200)); 14 | wxButton* soborno=new wxButton(panelPolice, ID_POLICE2,POLICE_103,wxPoint(100,300)); 15 | //guardar_std=new wxButton(panelSave,ID_SAVE4,wxT("Cargar copia"),wxPoint(100,200)); 16 | 17 | Connect(ID_POLICE1, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Police::Reportar)); 18 | Connect(ID_POLICE2, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Police::Sobornar)); 19 | 20 | } 21 | 22 | void Police::Reportar(wxCommandEvent& event) 23 | { 24 | if(droga>0){ 25 | srand(time(NULL)); 26 | int suerte=rand()%10+1; 27 | switch(suerte){ 28 | case 1: wxMessageBox("La burocracia te aplasta\nTe quedas con ello y sin recibir nada","Policia");break; 29 | case 2: wxMessageBox("Te toca un poli cabreado\nTe pregunta de donde lo has sacado\ny te acusa de complice\nPierdes el objeto, debes pagar 100 $ de fianza y estas en la lista negra","Policia"); money=money-100; droga--; blacklist++;break; 30 | case 3: wxMessageBox("El poli es un primo tuyo\nTe da mas dinero de lo normal (400 $) y te borra de la lista negra","Policia"); money+=400; droga--; blacklist=0;break; 31 | case 4:{ time_t tSac = time(NULL); // instante actual 32 | struct tm* tmP = localtime(&tSac); 33 | int hora=tmP->tm_hour; 34 | int minutos=tmP->tm_min; 35 | int segundos=tmP->tm_sec; 36 | wxMessageBox(wxString::Format("Son las %d:%d:%d, como quieres que esten despiertos unos policias que se hechan la siesta y se comen los donuts",hora,minutos,segundos),"Policia");} 37 | break; 38 | default: wxMessageBox("Recibes la recompensa tan merecida por reportar el contenido ilegal (200 $)");money+=200; droga--;break; 39 | 40 | 41 | 42 | 43 | 44 | }}else{wxMessageBox("Deja de perder el tiempo");} 45 | } 46 | 47 | void Police::Sobornar(wxCommandEvent& event) 48 | { 49 | if(blacklist>0){wxMessageBox("Eres reincidente y pides sobornos, que crees que pasa?\nPagas una multa de 1000 $");money-=1000;}else if(money>1000){wxMessageBox("Has comprado un soborno el jefe policial y has pagado 1000$");money-=1000; sobornos++;} 50 | 51 | } 52 | -------------------------------------------------------------------------------- /source/golf.cpp: -------------------------------------------------------------------------------- 1 | //Golf.cpp 2 | 3 | #include "Librerias.h" 4 | 5 | extern int sobornos, blacklist, money, droga, rich, electro; 6 | static int preciorich[5]={100,200,300,400,500}; 7 | 8 | Golf::Golf() : wxDialog(NULL, wxID_ANY, wxT("Valladolid Golf"), wxPoint(-1,-1), wxSize(400,400)) 9 | { 10 | 11 | wxPanel* golfpanel=new wxPanel(this); 12 | wxStaticText* golftext=new wxStaticText(golfpanel, wxID_ANY, GOLF_101); 13 | wxButton* venderlujo=new wxButton(golfpanel, ID_VENDERLUJO, "Vender lujo", wxPoint(50,200)); 14 | wxButton* comprarlujo=new wxButton(golfpanel, ID_COMPRARLUJO, "Comprar lujo", wxPoint(250, 200)); 15 | wxButton* venderdroga=new wxButton(golfpanel, ID_VENDERDROGA, "Vender otras cosas", wxPoint(50,300)); 16 | wxButton* valladolid=new wxButton(golfpanel, ID_VALLADOLID, "Hablar con ancianos",wxPoint(250,300)); 17 | Connect(ID_VENDERLUJO, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Golf::VenderLujo)); 18 | Connect(ID_COMPRARLUJO, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Golf::ComprarLujo)); 19 | Connect(ID_VENDERDROGA, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Golf::VenderDroga)); 20 | Connect(ID_VALLADOLID, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Golf::Valladolid)); 21 | 22 | 23 | 24 | } 25 | 26 | void Golf::VenderLujo(wxCommandEvent& event) 27 | { 28 | srand(time(NULL)); 29 | int randomgolf=rand()%5; 30 | if(rich>0){wxMessageBox(wxString::Format("Has vendido un producto de lujo por %d",preciorich[randomgolf])); rich--; money+=preciorich[randomgolf];}else{wxMessageBox("No tienes para vender");} 31 | } 32 | 33 | void Golf::ComprarLujo(wxCommandEvent& event) 34 | { 35 | srand(time(NULL)); 36 | int randomgolf=rand()%5; 37 | if(money>preciorich[randomgolf]){wxMessageBox(wxString::Format("Has comprado un producto de lujo por %d",preciorich[randomgolf]));rich++; money-=preciorich[randomgolf];}else{wxMessageBox("No tienes dinero");} 38 | } 39 | 40 | void Golf::VenderDroga(wxCommandEvent& event) 41 | { 42 | srand(time(NULL)); 43 | int randomgolf=rand()%5+1; 44 | if(droga>0){ 45 | switch(randomgolf) 46 | { 47 | case 1: wxMessageBox("Estaba la policia, pierdes la droga"); if(blacklist>0){wxMessageBox("Pagas una gran multa (2000 $)");money-=2000; droga=0;}else{droga=0;blacklist++;}break; 48 | case 2: wxMessageBox("Estaba la policia, pierdes la droga y pagas una multa");droga=0;money-=1000;break; 49 | case 3: if(sobornos>0){wxMessageBox("El policia del soborno no te multa, pero no puedes vender");sobornos--;}else{wxMessageBox(wxString::Format("Vendes la droga a 1000 $"));money+=1000;droga--;}break; 50 | default: wxMessageBox("Vendes la droga a 1000 $"); money+=1000; droga--; 51 | }}else{wxMessageBox("No tienes nada que vender");} 52 | } 53 | void Golf::Valladolid(wxCommandEvent& event) 54 | { 55 | wxMessageBox("\"Descubre Valladolid\" te dicen los ancianos, la tierra del creador del juego"); 56 | wxShell("firefox http://en.wikipedia.org/wiki/Valladolid"); 57 | 58 | } 59 | -------------------------------------------------------------------------------- /source/dkey.cpp: -------------------------------------------------------------------------------- 1 | // 2 | //Implementación de Divel Key en Azpazeta 3 | // 4 | #include "dkey.h" 5 | #include "Librerias.h" 6 | 7 | extern int aux; 8 | 9 | DivelKey::DivelKey() 10 | : wxDialog(NULL, wxID_ANY, wxT("Divel Key"), wxPoint(-1,-1), wxSize(400,400)) 11 | { 12 | wxPanel* dkey=new wxPanel(this); 13 | if(aux==0){ 14 | wxStaticText* key_text1=new wxStaticText(dkey, wxID_ANY,DKEY_101); 15 | wxButton* ObtKey=new wxButton(dkey, ID_KEY1,DKEY_102, wxPoint(100,200));}else{ 16 | wxStaticText* key_text2=new wxStaticText(dkey, wxID_ANY, DKEY_103); 17 | wxButton* visualizar_cheats=new wxButton(dkey, ID_KEY2, DKEY_104, wxPoint(100,200)); 18 | } 19 | Connect(ID_KEY1,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(DivelKey::OnObtener)); 20 | Connect(ID_KEY2, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(DivelKey::VerTrucos)); 21 | 22 | } 23 | void DivelKey::OnObtener(wxCommandEvent& event) 24 | { 25 | #ifdef LINUX 26 | wxShell("firefox http://1.divelapps.appspot.com"); 27 | #endif 28 | #ifdef WINDOWS 29 | wxShell("start http://1.divelapps.appspot.com"); 30 | #endif 31 | wxString mail=wxGetTextFromUser("Introduce tu correo","Divel Key",""); 32 | wxString hex_key=wxGetTextFromUser("Introduce la clave obtenida","Divel Key",""); 33 | //Codigo de pruebas 34 | /*std::string input=hex_key.c_str(); 35 | static const char* const lut = "0123456789ABCDEF"; 36 | size_t len = input.length(); 37 | if (len & 1) throw std::invalid_argument("odd length"); 38 | 39 | std::string output; 40 | output.reserve(len / 2); 41 | for (size_t i = 0; i < len; i += 2) 42 | { 43 | char a = input[i]; 44 | const char* p = std::lower_bound(lut, lut + 16, a); 45 | if (*p != a) throw std::invalid_argument("not a hex digit"); 46 | 47 | char b = input[i + 1]; 48 | const char* q = std::lower_bound(lut, lut + 16, b); 49 | if (*q != b) throw std::invalid_argument("not a hex digit"); 50 | 51 | output.push_back(((p - lut) << 4) | (q - lut)); 52 | }*/ 53 | /*char newmail=mail.mb_str(); 54 | char name[2048]=newmail; 55 | char buffer[2048]=""; 56 | char *pbuffer = buffer; 57 | int len = strlen( name ); 58 | for( int i = 0; i < len ;i++ ) 59 | { 60 | itoa (name[i],pbuffer,16); 61 | pbuffer +=2; 62 | };*/ 63 | /*int a; 64 | std::string newmail="adrian.arroyocalle@gmail.com"; 65 | newmail>>std::hex>>a; 66 | std::cout<Destroy(); 84 | 85 | }else{ 86 | wxMessageBox("Clave incorrecta, vuelve a intentarlo","Divel Key",wxICON_ERROR|wxOK); 87 | this->Destroy(); 88 | } 89 | 90 | 91 | //wxPrintf("%s",buffer); 92 | //wxMessageBox(strtoul(s.c_str(), NULL, 16)); 93 | } 94 | 95 | void DivelKey::VerTrucos(wxCommandEvent& event) 96 | { 97 | wxMessageBox("-Guardar en cualquier momento (ACTIVO)(Tecla ESC)\n-Dinero infinito (DESACTIVADO)\n-Teletransporte (DESACTIVADO)\n","Divel House",wxICON_INFORMATION|wxOK); 98 | } 99 | -------------------------------------------------------------------------------- /multiplayer/Socket.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Javier Abellan, 20 Jun 2000 3 | * 4 | * Funciones de lectura y escritura en sockets 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | 14 | 15 | /* 16 | * Lee datos del socket. Supone que se le pasa un buffer con hueco 17 | * suficiente para los datos. Devuelve el numero de bytes leidos o 18 | * 0 si se cierra fichero o -1 si hay error. 19 | */ 20 | int Lee_Socket (int fd, char *Datos, int Longitud) 21 | { 22 | int Leido = 0; 23 | int Aux = 0; 24 | 25 | /* 26 | * Comprobacion de que los parametros de entrada son correctos 27 | */ 28 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 29 | return -1; 30 | 31 | /* 32 | * Mientras no hayamos leido todos los datos solicitados 33 | */ 34 | while (Leido < Longitud) 35 | { 36 | Aux = read (fd, Datos + Leido, Longitud - Leido); 37 | if (Aux > 0) 38 | { 39 | /* 40 | * Si hemos conseguido leer datos, incrementamos la variable 41 | * que contiene los datos leidos hasta el momento 42 | */ 43 | Leido = Leido + Aux; 44 | } 45 | else 46 | { 47 | /* 48 | * Si read devuelve 0, es que se ha cerrado el socket. Devolvemos 49 | * los caracteres leidos hasta ese momento 50 | */ 51 | if (Aux == 0) 52 | return Leido; 53 | if (Aux == -1) 54 | { 55 | /* 56 | * En caso de error, la variable errno nos indica el tipo 57 | * de error. 58 | * El error EINTR se produce si ha habido alguna 59 | * interrupcion del sistema antes de leer ningun dato. No 60 | * es un error realmente. 61 | * El error EGAIN significa que el socket no esta disponible 62 | * de momento, que lo intentemos dentro de un rato. 63 | * Ambos errores se tratan con una espera de 100 microsegundos 64 | * y se vuelve a intentar. 65 | * El resto de los posibles errores provocan que salgamos de 66 | * la funcion con error. 67 | */ 68 | switch (errno) 69 | { 70 | case EINTR: 71 | case EAGAIN: 72 | usleep (100); 73 | break; 74 | default: 75 | return -1; 76 | } 77 | } 78 | } 79 | } 80 | 81 | /* 82 | * Se devuelve el total de los caracteres leidos 83 | */ 84 | return Leido; 85 | } 86 | 87 | /* 88 | * Escribe dato en el socket cliente. Devuelve numero de bytes escritos, 89 | * o -1 si hay error. 90 | */ 91 | int Escribe_Socket (int fd, char *Datos, int Longitud) 92 | { 93 | int Escrito = 0; 94 | int Aux = 0; 95 | 96 | /* 97 | * Comprobacion de los parametros de entrada 98 | */ 99 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 100 | return -1; 101 | 102 | /* 103 | * Bucle hasta que hayamos escrito todos los caracteres que nos han 104 | * indicado. 105 | */ 106 | while (Escrito < Longitud) 107 | { 108 | Aux = write (fd, Datos + Escrito, Longitud - Escrito); 109 | if (Aux > 0) 110 | { 111 | /* 112 | * Si hemos conseguido escribir caracteres, se actualiza la 113 | * variable Escrito 114 | */ 115 | Escrito = Escrito + Aux; 116 | } 117 | else 118 | { 119 | /* 120 | * Si se ha cerrado el socket, devolvemos el numero de caracteres 121 | * leidos. 122 | * Si ha habido error, devolvemos -1 123 | */ 124 | if (Aux == 0) 125 | return Escrito; 126 | else 127 | return -1; 128 | } 129 | } 130 | 131 | /* 132 | * Devolvemos el total de caracteres leidos 133 | */ 134 | return Escrito; 135 | } 136 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # 5 | # This file was originally written by Joey Hess and Craig Small. 6 | # As a special exception, when this file is copied by dh-make into a 7 | # dh-make output file, you may use that output file without restriction. 8 | # This special exception was added by Craig Small in version 0.37 of dh-make. 9 | # 10 | # Modified to make a template file for a multi-binary package with separated 11 | # build-arch and build-indep targets by Bill Allombert 2001 12 | AZPDIR = ${CURDIR}/debian/azpazeta/usr/src/ 13 | CFLAGS = `wx-config --cppflags` 14 | PRE = -DIDIOMA=ES -DLINUX 15 | OBJ = VarGlobal.o Inicio.o save.o tren.o dkey.o police.o hiper.o golf.o dialogbox.o mercado.o 16 | EXIT = Azpazeta 17 | LIBFLAGS = `wx-config --libs` 18 | 19 | 20 | 21 | 22 | # Uncomment this to turn on verbose mode. 23 | #export DH_VERBOSE=1 24 | 25 | # This has to be exported to make some magic below work. 26 | configure: configure-stamp 27 | configure-stamp: 28 | dh_testdir 29 | # Add here commands to configure the package. 30 | touch configure-stamp 31 | build: build-stamp 32 | build-stamp: configure-stamp 33 | dh_testdir 34 | touch build-stamp 35 | clean: 36 | dh_testdir 37 | dh_testroot 38 | rm -f build-stamp configure-stamp 39 | dh_clean 40 | install: build 41 | dh_testdir 42 | dh_testroot 43 | dh_clean -k 44 | dh_installdirs 45 | # Create directories and copy files 46 | # Build the sctructure 47 | #sudo apt-add-repository ppa:fransschreuder1/usbpicprog-stable -y 48 | mkdir -p ${CURDIR}/debian/azpazeta/opt/extras.ubuntu.com/azpazeta 49 | mkdir -p ${CURDIR}/debian/azpazeta/opt/extras.ubuntu.com/azpazeta/media 50 | mkdir -p ${CURDIR}/debian/azpazeta/opt/extras.ubuntu.com/azpazeta/audio 51 | mkdir -p ${CURDIR}/debian/azpazeta/usr/share/applications 52 | mkdir -p ${CURDIR}/debian/azpazeta/usr/share/pixmaps 53 | 54 | cp source/*.png ${CURDIR}/debian/azpazeta/opt/extras.ubuntu.com/azpazeta/media/ 55 | cp source/Azpazeta.desktop ${CURDIR}/debian/azpazeta/usr/share/applications/extras-Azpazeta.desktop 56 | cp source/azpazeta.svg ${CURDIR}/debian/azpazeta/usr/share/pixmaps/ 57 | 58 | 59 | 60 | g++ -c source/inicio.cpp -o Inicio.o $(PRE) $(CFLAGS) 61 | 62 | g++ -c source/dkey.cpp -o dkey.o $(PRE) $(CFLAGS) 63 | 64 | g++ -c source/police.cpp -o police.o $(PRE) $(CFLAGS) 65 | 66 | g++ -c source/VarGlobal.cpp -o VarGlobal.o $(PRE) $(CFLAGS) 67 | 68 | g++ -c source/save.cpp -o save.o $(PRE) $(CFLAGS) 69 | 70 | g++ -c source/tren.cpp -o tren.o $(PRE) $(CFLAGS) 71 | 72 | g++ -c source/hiper.cpp -o hiper.o $(PRE) $(CFLAGS) 73 | 74 | g++ -c source/golf.cpp -o golf.o $(PRE) $(CFLAGS) 75 | 76 | g++ -c source/dialogbox.cpp -o dialogbox.o $(PRE) $(CFLAGS) 77 | 78 | g++ -c source/mercado.cpp -o mercado.o $(PRE) $(CFLAGS) 79 | g++ -o ${CURDIR}/debian/azpazeta/opt/extras.ubuntu.com/azpazeta/Azpazeta $(OBJ) $(LIBFLAGS) 80 | 81 | # Structure and source files 82 | #mkdir -p ${CURDIR}/debian/agendacorreosdivelso/usr/share/agendacorreosdivelso 83 | ####################################################### 84 | #cp *.py ${CURDIR}/debian/agendacorreosdivelso/usr/share/agendacorreosdivelso/ 85 | # End create directories and copy files 86 | # Create languages directories 87 | # End create languages directories 88 | # Compile languages 89 | # End comile languages 90 | # Build architecture-independent files here. 91 | binary-indep: build install 92 | # We have nothing to do by default. 93 | # Build architecture-dependent files here. 94 | binary-arch: build install 95 | dh_testdir 96 | dh_testroot 97 | dh_installchangelogs 98 | dh_installdocs 99 | dh_installexamples 100 | # dh_install 101 | # dh_installmenu 102 | # dh_installdebconf 103 | # dh_installlogrotate 104 | # dh_installemacsen 105 | # dh_installpam 106 | # dh_installmime 107 | # dh_python 108 | # dh_installinit 109 | # dh_installcron 110 | # dh_installinfo 111 | dh_installman 112 | dh_link 113 | dh_strip 114 | dh_compress 115 | dh_fixperms 116 | # dh_perl 117 | # dh_makeshlibs 118 | dh_installdeb 119 | dh_shlibdeps 120 | dh_gencontrol 121 | dh_md5sums 122 | dh_builddeb 123 | binary: binary-indep binary-arch 124 | .PHONY: build clean binary-indep binary-arch binary install configure 125 | -------------------------------------------------------------------------------- /source/Icono64.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * Icono64_xpm[] = { 3 | "64 64 4 1", 4 | " c #22B14C", 5 | ". c #99D9EA", 6 | "+ c #ED1C24", 7 | "@ c #FFFFFF", 8 | " ............................................................", 9 | " ...........................................................", 10 | " ..........................................................", 11 | " .........................................................", 12 | " ........................................................", 13 | " .......................................................", 14 | " ......................................................", 15 | " + .....................................................", 16 | " ++ ....................................................", 17 | " +++ ...................................................", 18 | " ++++ ..................................................", 19 | " +++++ .................................................", 20 | " ++++++ ................................................", 21 | " +++++++ ...............................................", 22 | " ++++++++ ..............................................", 23 | " +++++++++ .............................................", 24 | " ++++++++++ ............................................", 25 | " +++++++++++ ...........................................", 26 | " ++++++++++++ ..........................................", 27 | " +++++++++++++ .........................................", 28 | " ++++++++++++++ ........................................", 29 | " +++++++++++++++ .......................................", 30 | " ++++++++++++++++ ......................................", 31 | " +++++++++++++++++ .....................................", 32 | " ++++++++++++++++++ ....................................", 33 | " +++++++++++++++++++ ...................................", 34 | " ++++++++++++++++++++ ..................................", 35 | " +++++++++++++++++++++ .................................", 36 | " ++++++++++++++++++++++ ................................", 37 | " +++++++++++++++++++++++ ...............................", 38 | " ++++++++++++++++++++++++ ..............................", 39 | " +++++++++++++++++++++++++ .............................", 40 | " ++++++++++++++++++++++++++ ............................", 41 | " +++++++++++++++++++++++++++ ...........................", 42 | " ++++++++++++++++++++++++++++ ..........................", 43 | " +++++++++++++++++++++++++++++ .........................", 44 | " ++++++++++++++++++++++++++++++ ........................", 45 | " .......................", 46 | " ......................", 47 | " .....................", 48 | " ....................", 49 | " ...................", 50 | " ..................", 51 | " .................", 52 | " ................", 53 | " ...............", 54 | " ++++++++++++++++++++++++++++++++++++++++ ..............", 55 | " +++++++++++++++++++++++++++++++++++++++++ .............", 56 | " ++++++++++++++++++++++++++++++++++++++++++ ............", 57 | " +++++++++++++++++++++++++++++++++++++++++++ ...........", 58 | " ++++++++++++++++++++++++++++++++++++++++++++ ..........", 59 | " +++++++++++++++++++++++++++++++++++++++++++++ .........", 60 | " ++++++++++++++++++++++++++++++++++++++++++++++ ........", 61 | " +++++++++++++++++++++++++++++++++++++++++++++++ .......", 62 | " ++++++++++++++++++++++++++++++++++++++++++++++++ ......", 63 | " +++++++++++++++++++++++++++++++++++++++++++++++++ .....", 64 | " +++++++++++++++++++++++++++++++++++++++++++++++++++ ....", 65 | " +++++++++++++++++++++++++++++++++++++++++++++++++++++ ...", 66 | " ++++++++++++++++++++++++++++++++++++++++++++++++++++++ ..", 67 | " ++++++++++++++++++++++++++++++++++++++++++++++++++++ .", 68 | " ++++++++++++++++++++++++++++++++++++++++++++++++++ ", 69 | " ", 70 | " ", 71 | " @"}; 72 | -------------------------------------------------------------------------------- /source/x-azpazeta-savefile.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * Icono64_xpm[] = { 3 | "64 64 4 1", 4 | " c #22B14C", 5 | ". c #99D9EA", 6 | "+ c #ED1C24", 7 | "@ c #FFFFFF", 8 | " ............................................................", 9 | " ...........................................................", 10 | " ..........................................................", 11 | " .........................................................", 12 | " ........................................................", 13 | " .......................................................", 14 | " ......................................................", 15 | " + .....................................................", 16 | " ++ ....................................................", 17 | " +++ ...................................................", 18 | " ++++ ..................................................", 19 | " +++++ .................................................", 20 | " ++++++ ................................................", 21 | " +++++++ ...............................................", 22 | " ++++++++ ..............................................", 23 | " +++++++++ .............................................", 24 | " ++++++++++ ............................................", 25 | " +++++++++++ ...........................................", 26 | " ++++++++++++ ..........................................", 27 | " +++++++++++++ .........................................", 28 | " ++++++++++++++ ........................................", 29 | " +++++++++++++++ .......................................", 30 | " ++++++++++++++++ ......................................", 31 | " +++++++++++++++++ .....................................", 32 | " ++++++++++++++++++ ....................................", 33 | " +++++++++++++++++++ ...................................", 34 | " ++++++++++++++++++++ ..................................", 35 | " +++++++++++++++++++++ .................................", 36 | " ++++++++++++++++++++++ ................................", 37 | " +++++++++++++++++++++++ ...............................", 38 | " ++++++++++++++++++++++++ ..............................", 39 | " +++++++++++++++++++++++++ .............................", 40 | " ++++++++++++++++++++++++++ ............................", 41 | " +++++++++++++++++++++++++++ ...........................", 42 | " ++++++++++++++++++++++++++++ ..........................", 43 | " +++++++++++++++++++++++++++++ .........................", 44 | " ++++++++++++++++++++++++++++++ ........................", 45 | " .......................", 46 | " ......................", 47 | " .....................", 48 | " ....................", 49 | " ...................", 50 | " ..................", 51 | " .................", 52 | " ................", 53 | " ...............", 54 | " ++++++++++++++++++++++++++++++++++++++++ ..............", 55 | " +++++++++++++++++++++++++++++++++++++++++ .............", 56 | " ++++++++++++++++++++++++++++++++++++++++++ ............", 57 | " +++++++++++++++++++++++++++++++++++++++++++ ...........", 58 | " ++++++++++++++++++++++++++++++++++++++++++++ ..........", 59 | " +++++++++++++++++++++++++++++++++++++++++++++ .........", 60 | " ++++++++++++++++++++++++++++++++++++++++++++++ ........", 61 | " +++++++++++++++++++++++++++++++++++++++++++++++ .......", 62 | " ++++++++++++++++++++++++++++++++++++++++++++++++ ......", 63 | " +++++++++++++++++++++++++++++++++++++++++++++++++ .....", 64 | " +++++++++++++++++++++++++++++++++++++++++++++++++++ ....", 65 | " +++++++++++++++++++++++++++++++++++++++++++++++++++++ ...", 66 | " ++++++++++++++++++++++++++++++++++++++++++++++++++++++ ..", 67 | " ++++++++++++++++++++++++++++++++++++++++++++++++++++ .", 68 | " ++++++++++++++++++++++++++++++++++++++++++++++++++ ", 69 | " ", 70 | " ", 71 | " @"}; 72 | -------------------------------------------------------------------------------- /multiplayer/Socket_Servidor.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Javier Abellan, 20 Jun 2000 3 | * 4 | * Funciones para la apertura de un socket servidor y la conexion con sus 5 | * clientes 6 | */ 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | /* 16 | * Abre socket servidor UNIX. Se le pasa el servicio que se desea atender y 17 | * que debe estar dado de alta en /etc/services. Deja el socket preparado 18 | * para aceptar conexiones de clientes. 19 | * Devuelve el descritor del socket servidor, que se debera pasar 20 | * a la funcion Acepta_Conexion_Cliente(). Devuelve -1 en caso de error 21 | */ 22 | int Abre_Socket_Unix (char *Servicio) 23 | { 24 | struct sockaddr_un Direccion; 25 | int Descriptor; 26 | 27 | /* 28 | * Se abre el socket 29 | */ 30 | Descriptor = socket (AF_UNIX, SOCK_STREAM, 0); 31 | if (Descriptor == -1) 32 | return -1; 33 | 34 | /* 35 | * Se rellenan en la estructura Direccion los datos necesarios para 36 | * poder llamar a la funcion bind() 37 | */ 38 | strcpy (Direccion.sun_path, Servicio); 39 | Direccion.sun_family = AF_UNIX; 40 | 41 | if (bind ( 42 | Descriptor, 43 | (struct sockaddr *)&Direccion, 44 | strlen (Direccion.sun_path) + sizeof (Direccion.sun_family)) == -1) 45 | { 46 | /* 47 | * En caso de error cerramos el socket y devolvemos error 48 | */ 49 | close (Descriptor); 50 | return -1; 51 | } 52 | 53 | /* 54 | * Avisamos al sistema que comience a atender peticiones de clientes. 55 | */ 56 | if (listen (Descriptor, 1) == -1) 57 | { 58 | close (Descriptor); 59 | return -1; 60 | } 61 | 62 | /* 63 | * Se devuelve el descriptor del socket servidor 64 | */ 65 | return Descriptor; 66 | } 67 | 68 | /* 69 | * Se le pasa un socket de servidor y acepta en el una conexion de cliente. 70 | * devuelve el descriptor del socket del cliente o -1 si hay problemas. 71 | * Esta funcion vale para socket AF_INET o AF_UNIX. 72 | */ 73 | int Acepta_Conexion_Cliente (int Descriptor) 74 | { 75 | socklen_t Longitud_Cliente; 76 | struct sockaddr Cliente; 77 | int Hijo; 78 | 79 | /* 80 | * La llamada a la funcion accept requiere que el parametro 81 | * Longitud_Cliente contenga inicialmente el tamano de la 82 | * estructura Cliente que se le pase. A la vuelta de la 83 | * funcion, esta variable contiene la longitud de la informacion 84 | * util devuelta en Cliente 85 | */ 86 | Longitud_Cliente = sizeof (Cliente); 87 | Hijo = accept (Descriptor, &Cliente, &Longitud_Cliente); 88 | if (Hijo == -1) 89 | return -1; 90 | 91 | /* 92 | * Se devuelve el descriptor en el que esta "enchufado" el cliente. 93 | */ 94 | return Hijo; 95 | } 96 | 97 | /* 98 | * Abre un socket servidor de tipo AF_INET. Devuelve el descriptor 99 | * del socket o -1 si hay probleamas 100 | * Se pasa como parametro el nombre del servicio. Debe estar dado 101 | * de alta en el fichero /etc/services 102 | */ 103 | int Abre_Socket_Inet (char *Servicio) 104 | { 105 | struct sockaddr_in Direccion; 106 | struct sockaddr Cliente; 107 | socklen_t Longitud_Cliente; 108 | struct servent *Puerto; 109 | int Descriptor; 110 | //printf("Variables inicializadas"); 111 | /* 112 | * se abre el socket 113 | */ 114 | Descriptor = socket (AF_INET, SOCK_STREAM, 0); 115 | if (Descriptor == -1) 116 | return -1; 117 | //printf("Socket abierto"); 118 | /* 119 | * Se obtiene el servicio del fichero /etc/services 120 | */ 121 | /*Puerto = getservbyname ("www", "tcp"); 122 | Puerto->s_name="divelnet"; 123 | Puerto->s_port=6996;*/ 124 | //{"Divel Server Net";NULL;6996;"tcp";} 125 | 126 | //Puerto->s_port=6996; 127 | //Puerto==6996; //Cambiar para tener puertos variables 128 | //if (Puerto == NULL) 129 | //return -1; 130 | //printf("Servicio obtenido"); 131 | /* 132 | * Se rellenan los campos de la estructura Direccion, necesaria 133 | * para la llamada a la funcion bind() 134 | */ 135 | Direccion.sin_family = AF_INET; 136 | Direccion.sin_port = 6996;//6996;//Puerto->s_port; 137 | Direccion.sin_addr.s_addr =INADDR_ANY; 138 | //printf("Estrucura completa"); 139 | if (bind ( 140 | Descriptor, 141 | (struct sockaddr *)&Direccion, 142 | sizeof (Direccion)) == -1) 143 | { 144 | close (Descriptor); 145 | return -1; 146 | } 147 | //printf("Visible"); 148 | /* 149 | * Se avisa al sistema que comience a atender llamadas de clientes 150 | */ 151 | if (listen (Descriptor, 1) == -1) 152 | { 153 | close (Descriptor); 154 | return -1; 155 | } 156 | //printf("Empezando a atender llamadas de clientes\n"); 157 | /* 158 | * Se devuelve el descriptor del socket servidor 159 | */ 160 | return Descriptor; 161 | } 162 | -------------------------------------------------------------------------------- /source/azpazeta.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 42 | 44 | 45 | 47 | image/svg+xml 48 | 50 | 51 | 52 | 53 | 54 | 58 | 65 | 83 | 101 | 119 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /source/tren.cpp: -------------------------------------------------------------------------------- 1 | #ifndef TREN_H_ 2 | #define TREN_H_ 3 | #include "wx/wxprec.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "VarGlobal.h" 11 | #include 12 | #include 13 | #include "Idiomas.h" 14 | using namespace std; 15 | 16 | #ifdef __BORLANDC__ 17 | #pragma hdrstop 18 | #endif 19 | 20 | // for all others, include the necessary headers (this file is usually all you 21 | // need because it includes almost all "standard" wxWidgets headers) 22 | #ifndef WX_PRECOMP 23 | #include "wx/wx.h" 24 | #endif 25 | 26 | static wxString viajarcity[5]={"Gorguez","Centralia","Obscura","Wellville","Orlan\t"}; 27 | static int viajarprecio[5]={300,40,1000,500,120}; 28 | int bucle=0; 29 | wxString linea1[5]; 30 | int anterior; 31 | int viajarint; 32 | int viajarintprecio; 33 | wxString ciudadOrden[5]; 34 | int CiudadOrden=0; 35 | int precioOrden[5]; 36 | int PrecioOrden=0; 37 | extern int money, city; 38 | 39 | class TrenDialog : public wxDialog 40 | { 41 | public: 42 | TrenDialog(); 43 | void OnQuit(wxCommandEvent& event); 44 | void OnPrimero(wxCommandEvent& event); 45 | void OnSegundo(wxCommandEvent& event); 46 | void OnTercero(wxCommandEvent& event); 47 | void OnCuarto(wxCommandEvent& event); 48 | void OnQuinto(wxCommandEvent& event); 49 | void ProcesarViajes(wxString destino, int precio); 50 | wxStaticText* ciudad; 51 | wxStaticText* salida; 52 | wxStaticText* precio; 53 | wxStaticText* ciudad1; 54 | wxStaticText* salida1; 55 | wxStaticText* precio1; 56 | wxStaticText* ultimaHora; 57 | wxStaticText* ultimahora; 58 | wxButton* primero; 59 | wxButton* segundo; 60 | wxButton* tercero; 61 | wxButton* cuarto; 62 | wxButton* quinto; 63 | wxButton* salir; 64 | wxButton* noHayOtro; 65 | 66 | 67 | }; 68 | enum{ 69 | ID_TREN1 = 1024, 70 | ID_TREN2 = 1025, 71 | ID_TREN3 = 1026, 72 | ID_TREN4 = 1027, 73 | ID_TREN5 = 1028 74 | }; 75 | 76 | TrenDialog::TrenDialog() 77 | : wxDialog(NULL, wxID_ANY, wxT("Estacion de trenes central"), wxPoint(-1,-1), wxSize(400,400)) 78 | { 79 | wxProgressDialog randomizar("Brinnwell Transport","Espera mientras se cargan los viajes",5); 80 | wxPrintf("Empieza el problema"); 81 | while(bucle<5){ 82 | wxPrintf("No es igual a 5"); 83 | srand(time(NULL)); 84 | viajarint=rand()%5; 85 | //wxPrintf("Todavia no violado"); 86 | //srand(time(NULL)); 87 | //viajarintprecio=rand()%5; 88 | if(anterior!=viajarint){ 89 | wxPrintf("Todavia no violado"); 90 | linea1[bucle]=wxString::Format("%s\t\t\tInmediato\t\t\t%d",viajarcity[viajarintprecio],viajarprecio[viajarint]); 91 | ciudadOrden[CiudadOrden]=viajarcity[viajarintprecio]; 92 | precioOrden[PrecioOrden]=viajarprecio[viajarint]; 93 | CiudadOrden++; 94 | PrecioOrden++; 95 | //wxMessageBox(linea1[bucle]); 96 | bucle++; 97 | randomizar.Update(bucle); 98 | viajarintprecio++; 99 | anterior=viajarint; 100 | wxPrintf("Todavia no violado"); 101 | }else{wxPrintf("Es igual a 5");} 102 | } 103 | wxPrintf("Cargado"); 104 | wxPanel* panelTren=new wxPanel(this); 105 | wxPrintf("Final"); 106 | wxInitAllImageHandlers(); 107 | wxBitmap estacion("/opt/extras.ubuntu.com/azpazeta/media/tren.png",wxBITMAP_TYPE_PNG); 108 | wxStaticBitmap* fondo_estacion=new wxStaticBitmap(panelTren, wxID_ANY, estacion, wxPoint(-1,-1)); 109 | wxStaticText* cuantomoney=new wxStaticText(panelTren, wxID_ANY, wxString::Format(wxT("Dinero actual: %d"),money)); 110 | ciudad=new wxStaticText(panelTren, wxID_ANY, wxT("Destino\t\t\tHora salida\t\t\tPrecio"),wxPoint(2, 100)); 111 | 112 | ciudad1=new wxStaticText(panelTren, wxID_ANY, linea1[0],wxPoint(2, 150)); 113 | salida1=new wxStaticText(panelTren, wxID_ANY, linea1[1],wxPoint(2, 175)); 114 | precio1=new wxStaticText(panelTren, wxID_ANY, linea1[2],wxPoint(2, 200)); 115 | ultimaHora=new wxStaticText(panelTren, wxID_ANY, linea1[3],wxPoint(2, 225)); 116 | ultimahora=new wxStaticText(panelTren, wxID_ANY, linea1[4],wxPoint(2, 250)); 117 | primero=new wxButton(panelTren, ID_TREN1, GO, wxPoint(300, 150)); 118 | segundo=new wxButton(panelTren, ID_TREN2, GO, wxPoint(300, 175)); 119 | tercero=new wxButton(panelTren, ID_TREN3, GO, wxPoint(300, 200)); 120 | cuarto=new wxButton(panelTren, ID_TREN4, GO, wxPoint(300, 225)); 121 | quinto=new wxButton(panelTren, ID_TREN5, GO, wxPoint(300, 250)); 122 | 123 | Connect(ID_TREN1, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(TrenDialog::OnPrimero)); 124 | Connect(ID_TREN2, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(TrenDialog::OnSegundo)); 125 | Connect(ID_TREN3, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(TrenDialog::OnTercero)); 126 | Connect(ID_TREN4, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(TrenDialog::OnCuarto)); 127 | Connect(ID_TREN5, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(TrenDialog::OnQuinto)); 128 | 129 | 130 | } 131 | void TrenDialog::OnQuit(wxCommandEvent& event) 132 | { 133 | this->Destroy(); 134 | } 135 | void TrenDialog::OnPrimero(wxCommandEvent& event) 136 | { 137 | ProcesarViajes(ciudadOrden[0],precioOrden[0]); 138 | } 139 | void TrenDialog::OnSegundo(wxCommandEvent& event) 140 | { 141 | ProcesarViajes(ciudadOrden[1],precioOrden[1]); 142 | } 143 | void TrenDialog::OnTercero(wxCommandEvent& event) 144 | { 145 | ProcesarViajes(ciudadOrden[2],precioOrden[2]); 146 | } 147 | void TrenDialog::OnCuarto(wxCommandEvent& event) 148 | { 149 | ProcesarViajes(ciudadOrden[3],precioOrden[3]); 150 | } 151 | void TrenDialog::OnQuinto(wxCommandEvent& event) 152 | { 153 | ProcesarViajes(ciudadOrden[4],precioOrden[4]); 154 | } 155 | void TrenDialog::ProcesarViajes(wxString destino, int precio) 156 | { 157 | int realdestino; 158 | if(destino=="Gorguez"){city=11;money=money-precio;} 159 | if(destino=="Centralia"){city=12;money=money-precio;} 160 | if(destino=="Obscura"){wxMessageBox("No está disponible el tren");} 161 | if(destino=="Wellville"){wxMessageBox("No está disponible el tren");} 162 | if(destino=="Orlan\t"){wxMessageBox("No está disponible el tren");} 163 | 164 | this->Destroy(); 165 | 166 | } 167 | #endif 168 | -------------------------------------------------------------------------------- /source/hiper.cpp: -------------------------------------------------------------------------------- 1 | //Hiper.cpp 2 | #include "hiper.h" 3 | #include 4 | extern int socio, money, electro, food, textil, droga, blacklist, rich; 5 | int estadoHiper=0; 6 | static int precioshiper[4]={100,200,300,50}; 7 | 8 | Hiper::Hiper() : wxDialog(NULL, wxID_ANY, wxT("Cadena Inc."), wxPoint(-1,-1), wxSize(400,400)) 9 | { 10 | wxPanel* hiperpanel=new wxPanel(this); 11 | info_hiper=new wxStaticText(hiperpanel, wxID_ANY, HIPER_101); 12 | comprar=new wxButton(hiperpanel, ID_HIPER1, "Comprar por catalogo", wxPoint(50,200)); 13 | tour=new wxButton(hiperpanel, ID_HIPER2, "Tour completo", wxPoint(250, 200)); 14 | trabajar=new wxButton(hiperpanel, ID_HIPER3, "Trabajar (2 min)", wxPoint(50, 300)); 15 | socios=new wxButton(hiperpanel, ID_HIPER4, "Hacerse socio", wxPoint(250, 300)); 16 | 17 | 18 | Connect(ID_HIPER1,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Hiper::Comprar)); 19 | Connect(ID_HIPER2,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Hiper::Tour)); 20 | Connect(ID_HIPER3,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Hiper::Trabajar)); 21 | Connect(ID_HIPER4,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Hiper::Suscribirse)); 22 | } 23 | void Hiper::Comprar(wxCommandEvent& event) 24 | { 25 | 26 | if(estadoHiper==0){ 27 | info_hiper->SetLabel("Compra lo que desees al precio indicado (o no)"); 28 | wxProgressDialog esperar("Cadena Inc.","Buscando ofertas...",4); 29 | 30 | srand(time(NULL)); 31 | precioproc[0]=rand()%4+1; 32 | comprar->SetLabel(wxString::Format("Android %d", precioshiper[precioproc[0]])); 33 | esperar.Update(1); 34 | precioproc[1]=rand()%4+1; 35 | tour->SetLabel(wxString::Format("Paella %d", precioshiper[precioproc[1]])); 36 | esperar.Update(2); 37 | precioproc[2]=rand()%4+1; 38 | trabajar->SetLabel(wxString::Format("Traje %d", precioshiper[precioproc[2]])); 39 | esperar.Update(3); 40 | precioproc[3]=rand()%4+1; 41 | socios->SetLabel(wxString::Format("... %d",precioshiper[precioproc[3]])); 42 | esperar.Update(4);estadoHiper=1;}else{ 43 | //Comprar Android 44 | srand(time(NULL)); 45 | int lazar=rand()%10+1; 46 | switch(lazar){ 47 | case 1:wxMessageBox("En la caja no habia un movil, habia droga, creo que es ilegal...");money-=precioshiper[precioproc[0]]; droga++;break; 48 | case 2:{if(droga!=0){wxMessageBox("Tenias droga y la policía te ha visto. Pierdes la droga y debes pagar 2000 $");money-=2000;droga=0;}}break; 49 | default:wxMessageBox("Felicidades, comprado correctamente");money-=precioshiper[precioproc[0]]; electro++; 50 | } 51 | //Poner viejos botones 52 | comprar->SetLabel("Comprar por catalogo"); 53 | tour->SetLabel("Tour completo"); 54 | trabajar->SetLabel("Trabajar (2 min)"); 55 | socios->SetLabel("Hacerse socio"); 56 | estadoHiper=0;} 57 | 58 | } 59 | void Hiper::Tour(wxCommandEvent& event) 60 | { 61 | if(estadoHiper==0){ 62 | time_t tSac = time(NULL); // instante actual 63 | struct tm* tmP = localtime(&tSac); 64 | int hora=tmP->tm_hour; 65 | int minutos=tmP->tm_min; 66 | int segundos=tmP->tm_sec; 67 | wxMessageBox(wxString::Format("Son las %d:%d:%d!! Como quieres que esten despiertos",hora,minutos,segundos));}else{ 68 | 69 | srand(time(NULL)); 70 | int lazar=rand()%10+1; 71 | switch(lazar){ 72 | case 1:wxMessageBox("La paella sabe extrana, hay droga, creo que es ilegal...");money-=precioshiper[precioproc[0]]; droga++;break; 73 | case 2:{if(droga!=0){wxMessageBox("Tenias droga y la policía te ha visto. Pierdes la droga y debes pagar 2000 $");money-=2000;droga=0;}}break; 74 | default:wxMessageBox("Felicidades, comprado correctamente");money-=precioshiper[precioproc[0]]; food++; 75 | } 76 | //Poner viejos botones 77 | comprar->SetLabel("Comprar por catalogo"); 78 | tour->SetLabel("Tour completo"); 79 | trabajar->SetLabel("Trabajar (2 min)"); 80 | socios->SetLabel("Hacerse socio"); 81 | estadoHiper=0; 82 | 83 | 84 | 85 | } 86 | } 87 | void Hiper::Trabajar(wxCommandEvent& event) 88 | { 89 | if(estadoHiper==0){ 90 | wxProgressDialog trabajando("Cadena Inc.","Trabajando durante 2 minutos por 200 $",4); 91 | int trabajo; 92 | for(trabajo=0;trabajo!=4;trabajo++){ 93 | trabajando.Update(trabajo); 94 | sleep(30); 95 | } 96 | money+=200; 97 | 98 | }else{ 99 | srand(time(NULL)); 100 | int lazar=rand()%10+1; 101 | switch(lazar){ 102 | case 1:wxMessageBox("En los bolsillos hay algo extrano, hay droga, creo que es ilegal...");money-=precioshiper[precioproc[0]]; droga++;break; 103 | case 2:{if(droga!=0){wxMessageBox("Tenias droga y la policía te ha visto. Pierdes la droga y debes pagar 2000 $");money-=2000;droga=0;}}break; 104 | default:wxMessageBox("Felicidades, comprado correctamente");money-=precioshiper[precioproc[0]]; textil++; 105 | } 106 | //Poner viejos botones 107 | comprar->SetLabel("Comprar por catalogo"); 108 | tour->SetLabel("Tour completo"); 109 | trabajar->SetLabel("Trabajar (2 min)"); 110 | socios->SetLabel("Hacerse socio"); 111 | estadoHiper=0; 112 | 113 | 114 | 115 | 116 | } 117 | } 118 | void Hiper::Suscribirse(wxCommandEvent& event) 119 | { 120 | if(estadoHiper==0 && socio==1){ 121 | int dalalai=wxMessageBox("Quieres hacerte socio por 300 $","Cadena Inc.",wxYES_NO|wxICON_QUESTION); 122 | if(dalalai==wxYES){ 123 | socio=1;money-=300; 124 | } 125 | }else{ 126 | srand(time(NULL)); 127 | int lazar=rand()%10+1; 128 | switch(lazar){ 129 | case 1:wxMessageBox("Te dan una caja extrana, hay droga, creo que es ilegal...");money-=precioshiper[precioproc[0]]; droga++;break; 130 | case 2:{if(droga!=0){wxMessageBox("Tenias droga y la policía te ha visto. Pierdes la droga y debes pagar 2000 $");money-=2000;droga=0;}}break; 131 | case 3:wxMessageBox("Te ha tocado ropa de moda");money-=precioshiper[precioproc[0]]; textil++;break; 132 | case 4:wxMessageBox("Te ha tocado un movil Android");money-=precioshiper[precioproc[0]]; electro++;break; 133 | case 5:wxMessageBox("Te ha tocado una gran paella");money-=precioshiper[precioproc[0]]; food++;break; 134 | default:wxMessageBox("Te ha tocado un producto lujoso, pero inutil");money-=precioshiper[precioproc[0]]; rich++; 135 | } 136 | //Poner viejos botones 137 | comprar->SetLabel("Comprar por catalogo"); 138 | tour->SetLabel("Tour completo"); 139 | trabajar->SetLabel("Trabajar (2 min)"); 140 | socios->SetLabel("Hacerse socio"); 141 | estadoHiper=0; 142 | 143 | 144 | 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /source/Librerias.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBRERIAS_H 2 | #define LIBRERIAS_H 3 | #include "wx/wxprec.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | //#include "libmodloader.h" 10 | #include 11 | //#include "gortren.h" 12 | #include 13 | #include "tren.h" 14 | #include "VarGlobal.h" 15 | #include "Idiomas.h" 16 | #include 17 | #include "save.h" 18 | #include 19 | #include "chr_taskbar.h" 20 | #include 21 | #include 22 | #include 23 | #include "dkey.h" 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include "police.h" 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include "hiper.h" 52 | #include 53 | //#include "azpupdater.h" 54 | #include "golf.h" 55 | #include "dialogbox.h" 56 | #include 57 | #include "mercado.h" 58 | using namespace std; 59 | 60 | #ifdef __BORLANDC__ 61 | #pragma hdrstop 62 | #endif 63 | 64 | // for all others, include the necessary headers (this file is usually all you 65 | // need because it includes almost all "standard" wxWidgets headers) 66 | #ifndef WX_PRECOMP 67 | #include "wx/wx.h" 68 | #endif 69 | 70 | // ---------------------------------------------------------------------------- 71 | // resources 72 | // ---------------------------------------------------------------------------- 73 | 74 | // the application icon (under Windows and OS/2 it is in resources and even 75 | // though we could still include the XPM here it would be unused) 76 | 77 | // ---------------------------------------------------------------------------- 78 | // private classes 79 | // ---------------------------------------------------------------------------- 80 | 81 | 82 | // Define a new application type, each program should derive a class from wxApp 83 | class MyApp : public wxApp 84 | { 85 | public: 86 | // override base class virtuals 87 | // ---------------------------- 88 | 89 | // this one is called on application startup and is a good place for the app 90 | // initialization (doing it here and not in the ctor allows to have an error 91 | // return: if OnInit() returns false, the application terminates) 92 | virtual bool OnInit(); 93 | //virtual void OnRun(); //Hacer comprobaciones 94 | virtual void OnInitCmdLine(wxCmdLineParser& parser); 95 | virtual bool OnCmdLineParsed(wxCmdLineParser& parser); 96 | 97 | 98 | 99 | }; 100 | 101 | static const wxCmdLineEntryDesc g_cmdLineDesc [] = 102 | { 103 | { wxCMD_LINE_SWITCH, "h", "help", "displays help on the command line parameters"}, 104 | {wxCMD_LINE_PARAM, NULL, NULL,"save file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL}, 105 | 106 | { wxCMD_LINE_NONE } 107 | }; 108 | 109 | // Define a new frame type: this is going to be our main frame 110 | class MyFrame : public wxFrame 111 | { 112 | public: 113 | // ctor(s) 114 | MyFrame(const wxString& title); 115 | 116 | // event handlers (these functions should _not_ be virtual) 117 | void OnQuit(wxCommandEvent& event); 118 | void OnAbout(wxCommandEvent& event); 119 | void OnNet(wxCommandEvent& event); 120 | void OnInstrucciones(wxCommandEvent& event); 121 | void OnActualizar(wxCommandEvent& event); 122 | void OnJugar(); 123 | void OnBorrar(wxCommandEvent& event); 124 | void OnTaskKiller(wxCommandEvent& event); 125 | void OnCorreos(wxCommandEvent& event); 126 | void OnUpdater(wxCommandEvent& event); 127 | void OnTecla(wxKeyEvent& event); 128 | void AZPCliente(wxCommandEvent& event); 129 | void Stage1(); 130 | void Stage2(); 131 | void Stage3(); 132 | void Stage4(); 133 | void Stage5(); 134 | void Stage6(); 135 | void Stage7(); 136 | void Stage11(); 137 | void Stage12(); 138 | void Load(); 139 | void CheckearMods(wxCommandEvent& event); 140 | void ComprobarMulti(wxTimerEvent& event); 141 | void NewGame(wxCommandEvent& event); 142 | int Lee_Socket (int fd, char *Datos, int Longitud); 143 | int Escribe_Socket (int fd, char *Datos, int Longitud); 144 | void Paint(); 145 | void RenderDown(wxDC& dc); 146 | void RenderUp(wxDC& dc); 147 | void RenderRight(wxDC& dc); 148 | void RenderLeft(wxDC& dc); 149 | wxImage Play; 150 | wxButton* jugar; 151 | wxButton* actualizar; 152 | wxButton* instrucciones; 153 | wxStaticBitmap* Portada; 154 | wxStaticBitmap* Adrix; 155 | wxStaticBitmap* Bocadillo; 156 | wxStaticText* cap1mis1; 157 | wxPanel* panel; 158 | wxMenuBar* menuBar; 159 | wxMenu *fileMenu; 160 | wxMenu *helpMenu; 161 | wxPanel* dcpanel; 162 | 163 | private: 164 | // any class wishing to process wxWidgets events must use this macro 165 | DECLARE_EVENT_TABLE() 166 | private: 167 | //Añadir botones 168 | 169 | }; 170 | // ---------------------------------------------------------------------------- 171 | // constants 172 | // ---------------------------------------------------------------------------- 173 | 174 | // IDs for the controls and the menu commands 175 | enum 176 | { 177 | // menu items 178 | Minimal_Quit = wxID_EXIT, 179 | ID_ACTUALIZAR = 1001, 180 | ID_NET = 1002, 181 | ID_INSTRUCCIONES = 1003, 182 | ID_WRITE = 1004, 183 | ID_TASKKILLER = 1005, 184 | ID_OPCIONES = 1006, 185 | ID_JUGAR = 1007, 186 | ID_INSTALADOS = 1008, 187 | ID_ARCHIVOS = 1009, 188 | ID_CERRAR = 1010, 189 | ID_APAGAR = 1011, 190 | ID_USER = 1012, 191 | ID_WINUNIX = 1013, 192 | ID_UPDATER = 1014, 193 | ID_PLAY = 1015, 194 | ID_EXECUTE = 1016, 195 | ID_COMPRIMIR = 1017, 196 | ID_DIBUJO = 1018, 197 | ID_TEXT = 1019, 198 | ID_TECLA = 1020, 199 | ID_VIAJAR = 1021, 200 | ID_OFERTAS = 1022, 201 | ID_REGALOS = 1023, 202 | ID_AZPCLIENTE = 1024, 203 | TIMER_ID, 204 | ID_NEWGAME, 205 | ID_MODS, 206 | 207 | // it is important for the id corresponding to the "About" command to have 208 | // this standard value as otherwise it won't be handled properly under Mac 209 | // (where it is special and put into the "Apple" menu) 210 | Minimal_About = wxID_ABOUT 211 | }; 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | #endif 222 | -------------------------------------------------------------------------------- /multiplayer/Cliente.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Javier Abellan, 20 Jun 2000 3 | * 4 | * Programa Cliente de un socket INET, como ejemplo de utilizacion 5 | * de las funciones de sockets 6 | */ 7 | //#include 8 | //#include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | int Lee_Socket (int fd, char *Datos, int Longitud); 24 | int Escribe_Socket (int fd, char *Datos, int Longitud); 25 | int Abre_Socket_Unix (char *Servicio); 26 | int Abre_Conexion_Inet (char *Host_Servidor, char *Servicio); 27 | 28 | int main () 29 | { 30 | /* 31 | * Descriptor del socket y buffer para datos 32 | */ 33 | int Socket_Con_Servidor; 34 | char Cadena[2048]; 35 | char ip[2048]; 36 | 37 | /* 38 | * Se abre la conexion con el servidor, pasando el nombre del ordenador 39 | * y el servicio solicitado. 40 | * "localhost" corresponde al nombre del mismo ordenador en el que 41 | * estamos corriendo. Esta dado de alta en /etc/hosts 42 | * "cpp_java" es un servicio dado de alta en /etc/services 43 | */ 44 | printf("Escribe la IP:\n"); 45 | fgets(ip,2048,stdin); 46 | printf("Accediendo a IP: %s",ip); 47 | Socket_Con_Servidor = Abre_Conexion_Inet (ip, "cpp_java"); 48 | if (Socket_Con_Servidor == 1) 49 | { 50 | printf ("No puedo establecer conexion con el servidor\n"); 51 | exit (-1); 52 | } 53 | 54 | /* 55 | * Se prepara una cadena con 5 caracteres y se envia, 4 letras mas 56 | * el \0 que indica fin de cadena en C 57 | */ 58 | Lee_Socket (Socket_Con_Servidor, Cadena, 2048); 59 | printf("%s",Cadena); 60 | printf("Escribe tu nombre\n"); 61 | scanf("%s",Cadena); 62 | //strcpy (Cadena, "Hola"); 63 | Escribe_Socket (Socket_Con_Servidor, Cadena, 2048); 64 | 65 | /* 66 | * Se lee la informacion enviada por el servidor, que se supone es 67 | * una cadena de 6 caracteres. 68 | */ 69 | Lee_Socket (Socket_Con_Servidor, Cadena, 2048); 70 | 71 | /* 72 | * Se escribe en pantalla la informacion recibida del servidor 73 | */ 74 | printf ("El otro jugador se llama :\n %s\n", Cadena); 75 | 76 | /* 77 | * Se cierra el socket con el servidor 78 | */ 79 | close (Socket_Con_Servidor); 80 | } 81 | 82 | int Lee_Socket (int fd, char *Datos, int Longitud) 83 | { 84 | int Leido = 0; 85 | int Aux = 0; 86 | 87 | /* 88 | * Comprobacion de que los parametros de entrada son correctos 89 | */ 90 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 91 | return -1; 92 | 93 | /* 94 | * Mientras no hayamos leido todos los datos solicitados 95 | */ 96 | while (Leido < Longitud) 97 | { 98 | Aux = read (fd, Datos + Leido, Longitud - Leido); 99 | if (Aux > 0) 100 | { 101 | /* 102 | * Si hemos conseguido leer datos, incrementamos la variable 103 | * que contiene los datos leidos hasta el momento 104 | */ 105 | Leido = Leido + Aux; 106 | } 107 | else 108 | { 109 | /* 110 | * Si read devuelve 0, es que se ha cerrado el socket. Devolvemos 111 | * los caracteres leidos hasta ese momento 112 | */ 113 | if (Aux == 0) 114 | return Leido; 115 | if (Aux == -1) 116 | { 117 | /* 118 | * En caso de error, la variable errno nos indica el tipo 119 | * de error. 120 | * El error EINTR se produce si ha habido alguna 121 | * interrupcion del sistema antes de leer ningun dato. No 122 | * es un error realmente. 123 | * El error EGAIN significa que el socket no esta disponible 124 | * de momento, que lo intentemos dentro de un rato. 125 | * Ambos errores se tratan con una espera de 100 microsegundos 126 | * y se vuelve a intentar. 127 | * El resto de los posibles errores provocan que salgamos de 128 | * la funcion con error. 129 | */ 130 | switch (errno) 131 | { 132 | case EINTR: 133 | case EAGAIN: 134 | usleep (100); 135 | break; 136 | default: 137 | return -1; 138 | } 139 | } 140 | } 141 | } 142 | 143 | /* 144 | * Se devuelve el total de los caracteres leidos 145 | */ 146 | return Leido; 147 | } 148 | 149 | /* 150 | * Escribe dato en el socket cliente. Devuelve numero de bytes escritos, 151 | * o -1 si hay error. 152 | */ 153 | int Escribe_Socket (int fd, char *Datos, int Longitud) 154 | { 155 | int Escrito = 0; 156 | int Aux = 0; 157 | 158 | /* 159 | * Comprobacion de los parametros de entrada 160 | */ 161 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 162 | return -1; 163 | 164 | /* 165 | * Bucle hasta que hayamos escrito todos los caracteres que nos han 166 | * indicado. 167 | */ 168 | while (Escrito < Longitud) 169 | { 170 | Aux = write (fd, Datos + Escrito, Longitud - Escrito); 171 | if (Aux > 0) 172 | { 173 | /* 174 | * Si hemos conseguido escribir caracteres, se actualiza la 175 | * variable Escrito 176 | */ 177 | Escrito = Escrito + Aux; 178 | } 179 | else 180 | { 181 | /* 182 | * Si se ha cerrado el socket, devolvemos el numero de caracteres 183 | * leidos. 184 | * Si ha habido error, devolvemos -1 185 | */ 186 | if (Aux == 0) 187 | return Escrito; 188 | else 189 | return -1; 190 | } 191 | } 192 | 193 | /* 194 | * Devolvemos el total de caracteres leidos 195 | */ 196 | return Escrito; 197 | } 198 | int Abre_Conexion_Unix (char *Servicio) 199 | { 200 | struct sockaddr_un Direccion; 201 | int Descriptor; 202 | 203 | strcpy (Direccion.sun_path, Servicio); 204 | Direccion.sun_family = AF_UNIX; 205 | 206 | Descriptor = socket (AF_UNIX, SOCK_STREAM, 0); 207 | if (Descriptor == -1) 208 | return -1; 209 | 210 | /* 211 | * Devuelve 0 si todo va bien, -1 en caso de error 212 | */ 213 | if (connect ( 214 | Descriptor, 215 | (struct sockaddr *)&Direccion, 216 | strlen (Direccion.sun_path) + sizeof (Direccion.sun_family)) == -1) 217 | { 218 | return -1; 219 | } 220 | else 221 | { 222 | return Descriptor; 223 | } 224 | } 225 | 226 | /* 227 | / Conecta con un servidor remoto a traves de socket INET 228 | */ 229 | int Abre_Conexion_Inet ( 230 | char *Host_Servidor, 231 | char *Servicio) 232 | { 233 | struct sockaddr_in Direccion; 234 | struct servent *Puerto; 235 | struct hostent *Host; 236 | int Descriptor; 237 | 238 | //Puerto = getservbyname ("www", "tcp"); 239 | //Puerto->s_port=6996; 240 | //Puerto->s_name="divelnet"; 241 | //Puerto = getservbyname (Servicio, "tcp"); 242 | //if (Puerto == NULL) 243 | //return -1; 244 | //Puerto->s_port=6996; //Editar esto si procede 245 | //Host = gethostbyname ("localhost"); 246 | //Host->h_addr=Host_Servidor; 247 | //if (Host == NULL) 248 | //return -1; 249 | Direccion.sin_addr.s_addr=inet_addr(Host_Servidor); 250 | 251 | Direccion.sin_family = AF_INET; 252 | //Direccion.sin_addr.s_addr = ((struct in_addr *)(Host->h_addr))->s_addr; //Direccion.sin_addr.s_addr = ((struct in_addr *)(Host->h_addr))->s_addr; 253 | Direccion.sin_port = 6996; //Direccion.sin_port = Puerto->s_port; 254 | 255 | Descriptor = socket (AF_INET, SOCK_STREAM, 0); 256 | if (Descriptor == -1) 257 | return -1; 258 | 259 | if (connect ( 260 | Descriptor, 261 | (struct sockaddr *)&Direccion, 262 | sizeof (Direccion)) == -1) 263 | { 264 | return -1; 265 | } 266 | 267 | return Descriptor; 268 | } 269 | -------------------------------------------------------------------------------- /source/azpserver.cpp: -------------------------------------------------------------------------------- 1 | //Azpazeta Information Server 2 | //Obtiene información de partidas en línea y tiene chat 3 | ///////////////////////////////// 4 | #include "azpserver.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | int Lee_Socket (int fd, char *Datos, int Longitud); 19 | 20 | int Escribe_Socket (int fd, char *Datos, int Longitud); 21 | typedef struct AZPServerData{int level;int money;int city;char* name;int mision;int aux; int droga;int blacklist;int sobornos;int socio;int electro;int food;int textil;int rich;} AZPServerData; 22 | typedef struct MyEstado{bool bien;int moneyotro;} MyEstado; 23 | int main() 24 | { 25 | AZPServerData datos1; 26 | AZPServerData datos2; 27 | MyEstado myestado1; 28 | MyEstado myestado2; 29 | int tipoip; 30 | int AZPServer; 31 | int socketCliente[2]; 32 | printf("Select the type of IP:\n1. IPv4\n2. IPv6\n"); 33 | scanf("%d",&tipoip); 34 | if(tipoip==1){ 35 | 36 | int maximo=2; 37 | fd_set descriptoresLectura; 38 | int numeroClientes; 39 | char Cadena[2048]; 40 | char nombreCliente1[1024]; 41 | char nombreCliente2[1024]; 42 | struct sockaddr_in Direccion; 43 | struct sockaddr Cliente; 44 | socklen_t Longitud_Cliente; 45 | struct servent *Puerto; 46 | 47 | AZPServer=socket (AF_INET, SOCK_STREAM, 0); 48 | Direccion.sin_family = AF_INET; 49 | Direccion.sin_port = 6996; 50 | Direccion.sin_addr.s_addr =INADDR_ANY; 51 | bind (AZPServer, (struct sockaddr *)&Direccion, sizeof (Direccion)); 52 | listen (AZPServer, 1); 53 | Longitud_Cliente = sizeof (Cliente); 54 | socketCliente[0] = accept (AZPServer, &Cliente, &Longitud_Cliente); 55 | socketCliente[1] = accept(AZPServer, &Cliente, &Longitud_Cliente); 56 | printf("2 clientes conectados"); 57 | //Les informamos 58 | Escribe_Socket(socketCliente[0], "2 clientes conectados\nEmpezando juego\n", 1024); 59 | Escribe_Socket(socketCliente[1], "2 clientes conectados\nEmpezando juego\n", 1024); 60 | //Recibimos sus nombres 61 | Lee_Socket (socketCliente[0], nombreCliente1, 1024); 62 | Lee_Socket (socketCliente[1], nombreCliente2, 1024); 63 | //Le mostramos el nombre del otro 64 | Escribe_Socket(socketCliente[0], nombreCliente2, 1024); 65 | Escribe_Socket(socketCliente[1], nombreCliente1, 1024); 66 | 67 | //Cerramos la comunicación 68 | }else{ 69 | //IPv6 70 | int maximo=2; 71 | fd_set descriptoresLectura; 72 | 73 | int numeroClientes; 74 | 75 | char Cadena[2048]; 76 | char nombreCliente1[1024]; 77 | char nombreCliente2[1024]; 78 | struct sockaddr_in6 Direccion; 79 | struct sockaddr Cliente; 80 | socklen_t Longitud_Cliente; 81 | struct servent *Puerto; 82 | //Direccion.sin6_len = sizeof(Direccion); 83 | AZPServer=socket (AF_INET6, SOCK_STREAM, 0); 84 | Direccion.sin6_family = AF_INET6; 85 | Direccion.sin6_port = 6996; 86 | //Direccion.sin6_addr.s6_addr =INADDR_ANY; 87 | Direccion.sin6_addr= in6addr_any; 88 | bind (AZPServer, (struct sockaddr *)&Direccion, sizeof (Direccion)); 89 | listen (AZPServer, 1); 90 | Longitud_Cliente = sizeof (Cliente); 91 | socketCliente[0] = accept (AZPServer, &Cliente, &Longitud_Cliente); 92 | socketCliente[1] = accept(AZPServer, &Cliente, &Longitud_Cliente); 93 | printf("2 clientes conectados"); 94 | //Les informamos 95 | Escribe_Socket(socketCliente[0], "2 clientes conectados\nEmpezando juego\n", 1024); 96 | Escribe_Socket(socketCliente[1], "2 clientes conectados\nEmpezando juego\n", 1024); 97 | //Recibimos sus nombres 98 | Lee_Socket (socketCliente[0], nombreCliente1, 1024); 99 | Lee_Socket (socketCliente[1], nombreCliente2, 1024); 100 | //Le mostramos el nombre del otro 101 | Escribe_Socket(socketCliente[0], nombreCliente2, 1024); 102 | Escribe_Socket(socketCliente[1], nombreCliente1, 1024); 103 | //Cerramos la comunicación 104 | 105 | 106 | 107 | 108 | } 109 | 110 | 111 | read(socketCliente[0],&datos1, sizeof(datos1)); 112 | read(socketCliente[1],&datos2, sizeof(datos2)); 113 | if(datos1.money>datos2.money){ 114 | myestado1.bien=true; 115 | myestado2.bien=false; 116 | myestado1.moneyotro=datos2.money; 117 | myestado2.moneyotro=datos1.money; 118 | 119 | }else{ 120 | myestado1.bien=false; 121 | myestado2.bien=true; 122 | myestado1.moneyotro=datos2.money; 123 | myestado2.moneyotro=datos1.money;} 124 | write(socketCliente[0],&myestado1, sizeof(myestado1)); 125 | write(socketCliente[1],&myestado2, sizeof(myestado2)); 126 | 127 | //Bucle infinito 128 | int infinito=0; 129 | while(infinito==0){ 130 | read(socketCliente[0],&datos1, sizeof(datos1)); 131 | read(socketCliente[1],&datos2, sizeof(datos2)); 132 | if(datos1.money>datos2.money){ 133 | myestado1.bien=true; 134 | myestado2.bien=false; 135 | myestado1.moneyotro=datos2.money; 136 | myestado2.moneyotro=datos1.money; 137 | 138 | }else{ 139 | myestado1.bien=false; 140 | myestado2.bien=true; 141 | myestado1.moneyotro=datos2.money; 142 | myestado2.moneyotro=datos1.money;} 143 | write(socketCliente[0],&myestado1, sizeof(myestado1)); 144 | write(socketCliente[1],&myestado2, sizeof(myestado2)); 145 | } 146 | 147 | close (socketCliente[0]); 148 | close(socketCliente[1]); 149 | close(AZPServer); 150 | 151 | } 152 | 153 | int Lee_Socket (int fd, char *Datos, int Longitud) 154 | { 155 | int Leido = 0; 156 | int Aux = 0; 157 | 158 | /* 159 | * Comprobacion de que los parametros de entrada son correctos 160 | */ 161 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 162 | return -1; 163 | 164 | /* 165 | * Mientras no hayamos leido todos los datos solicitados 166 | */ 167 | while (Leido < Longitud) 168 | { 169 | Aux = read (fd, Datos + Leido, Longitud - Leido); 170 | if (Aux > 0) 171 | { 172 | /* 173 | * Si hemos conseguido leer datos, incrementamos la variable 174 | * que contiene los datos leidos hasta el momento 175 | */ 176 | Leido = Leido + Aux; 177 | } 178 | else 179 | { 180 | /* 181 | * Si read devuelve 0, es que se ha cerrado el socket. Devolvemos 182 | * los caracteres leidos hasta ese momento 183 | */ 184 | if (Aux == 0) 185 | return Leido; 186 | if (Aux == -1) 187 | { 188 | /* 189 | * En caso de error, la variable errno nos indica el tipo 190 | * de error. 191 | * El error EINTR se produce si ha habido alguna 192 | * interrupcion del sistema antes de leer ningun dato. No 193 | * es un error realmente. 194 | * El error EGAIN significa que el socket no esta disponible 195 | * de momento, que lo intentemos dentro de un rato. 196 | * Ambos errores se tratan con una espera de 100 microsegundos 197 | * y se vuelve a intentar. 198 | * El resto de los posibles errores provocan que salgamos de 199 | * la funcion con error. 200 | */ 201 | switch (errno) 202 | { 203 | case EINTR: 204 | case EAGAIN: 205 | usleep (100); 206 | break; 207 | default: 208 | return -1; 209 | } 210 | } 211 | } 212 | } 213 | 214 | /* 215 | * Se devuelve el total de los caracteres leidos 216 | */ 217 | return Leido; 218 | } 219 | int Escribe_Socket (int fd, char *Datos, int Longitud) 220 | { 221 | int Escrito = 0; 222 | int Aux = 0; 223 | 224 | /* 225 | * Comprobacion de los parametros de entrada 226 | */ 227 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 228 | return -1; 229 | 230 | /* 231 | * Bucle hasta que hayamos escrito todos los caracteres que nos han 232 | * indicado. 233 | */ 234 | while (Escrito < Longitud) 235 | { 236 | Aux = write (fd, Datos + Escrito, Longitud - Escrito); 237 | if (Aux > 0) 238 | { 239 | /* 240 | * Si hemos conseguido escribir caracteres, se actualiza la 241 | * variable Escrito 242 | */ 243 | Escrito = Escrito + Aux; 244 | } 245 | else 246 | { 247 | /* 248 | * Si se ha cerrado el socket, devolvemos el numero de caracteres 249 | * leidos. 250 | * Si ha habido error, devolvemos -1 251 | */ 252 | if (Aux == 0) 253 | return Escrito; 254 | else 255 | return -1; 256 | } 257 | } 258 | 259 | /* 260 | * Devolvemos el total de caracteres leidos 261 | */ 262 | return Escrito; 263 | } 264 | -------------------------------------------------------------------------------- /source/mercado.cpp: -------------------------------------------------------------------------------- 1 | //Mercado.cpp 2 | 3 | #include "mercado.h" 4 | 5 | extern int socio, money, electro, food, textil, droga, blacklist, rich,prima; 6 | int estadoMercado=0; 7 | 8 | static int precioshiper[4]={100,200,300,50}; 9 | 10 | Mercado::Mercado() : wxDialog(NULL, wxID_ANY, wxT("Cadena Inc."), wxPoint(-1,-1), wxSize(400,400)) 11 | { 12 | wxPanel* Mpanel=new wxPanel(this); 13 | info_mercado=new wxStaticText(Mpanel, wxID_ANY, MERCADO_101); 14 | Mcomprar=new wxButton(Mpanel, ID_MERCADO1, "Comprar productos", wxPoint(50,200)); 15 | Mvender=new wxButton(Mpanel, ID_MERCADO2, "Vender productos", wxPoint(250, 200)); 16 | Mtransformarmateria=new wxButton(Mpanel, ID_MERCADO3, "Transformar m.prima", wxPoint(50, 300)); 17 | Mvendermateria=new wxButton(Mpanel, ID_MERCADO4, "Vender m.prima", wxPoint(250, 300)); 18 | 19 | 20 | Connect(ID_MERCADO1,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Mercado::Comprar)); 21 | Connect(ID_MERCADO2,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Mercado::Vender)); 22 | Connect(ID_MERCADO3,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Mercado::TransformarMateria)); 23 | Connect(ID_MERCADO4,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(Mercado::VenderMateria)); 24 | } 25 | 26 | void Mercado::Comprar(wxCommandEvent& event) 27 | { 28 | 29 | if(estadoMercado==0){ 30 | info_mercado->SetLabel("Compra lo que desees al precio indicado (o no)"); 31 | wxProgressDialog esperar("Mercado Central de Gorguez","Buscando ofertas...",4); 32 | 33 | srand(time(NULL)); 34 | precioproc[0]=rand()%4+1; 35 | Mcomprar->SetLabel(wxString::Format("Android %d", precioshiper[precioproc[0]])); 36 | esperar.Update(1); 37 | precioproc[1]=rand()%4+1; 38 | Mvender->SetLabel(wxString::Format("Paella %d", precioshiper[precioproc[1]])); 39 | esperar.Update(2); 40 | precioproc[2]=rand()%4+1; 41 | Mtransformarmateria->SetLabel(wxString::Format("Traje %d", precioshiper[precioproc[2]])); 42 | esperar.Update(3); 43 | precioproc[3]=rand()%4+1; 44 | Mvendermateria->SetLabel(wxString::Format("... %d",precioshiper[precioproc[3]])); 45 | esperar.Update(4);estadoMercado=1;}else if(estadoMercado==1){ 46 | //Comprar Android 47 | srand(time(NULL)); 48 | int lazar=rand()%10+1; 49 | switch(lazar){ 50 | case 1:wxMessageBox("En la caja no habia un movil, habia droga, creo que es ilegal...");money-=precioshiper[precioproc[0]]; droga++;break; 51 | case 2:{if(droga!=0){wxMessageBox("Tenias droga y la policía te ha visto. Pierdes la droga y debes pagar 2000 $");money-=2000;droga=0;}}break; 52 | default:wxMessageBox("Felicidades, comprado correctamente");money-=precioshiper[precioproc[0]]; electro++; 53 | } 54 | //Poner viejos botones 55 | Mcomprar->SetLabel("Comprar productos"); 56 | Mvender->SetLabel("Vender productos"); 57 | Mtransformarmateria->SetLabel("Transformar m.prima"); 58 | Mvendermateria->SetLabel("Vender m.prima"); 59 | estadoMercado=0;}else{ 60 | if(electro>0){wxMessageBox("Has vendido correctamente"); money+=precioshiper[precioproc[0]]; electro--;} 61 | Mcomprar->SetLabel("Comprar productos"); 62 | Mvender->SetLabel("Vender productos"); 63 | Mtransformarmateria->SetLabel("Transformar m.prima"); 64 | Mvendermateria->SetLabel("Vender m.prima"); 65 | estadoMercado=0; 66 | 67 | 68 | 69 | 70 | } 71 | 72 | } 73 | void Mercado::Vender(wxCommandEvent& event) 74 | { 75 | if(estadoMercado==0){ 76 | info_mercado->SetLabel("Vende lo que desees al precio indicado (o no)"); 77 | wxProgressDialog esperar("Mercado Central de Gorguez","Buscando ofertas...",4); 78 | 79 | srand(time(NULL)); 80 | precioproc[0]=rand()%4+1; 81 | Mcomprar->SetLabel(wxString::Format("Android %d", precioshiper[precioproc[0]])); 82 | esperar.Update(1); 83 | precioproc[1]=rand()%4+1; 84 | Mvender->SetLabel(wxString::Format("Paella %d", precioshiper[precioproc[1]])); 85 | esperar.Update(2); 86 | precioproc[2]=rand()%4+1; 87 | Mtransformarmateria->SetLabel(wxString::Format("Traje %d", precioshiper[precioproc[2]])); 88 | esperar.Update(3); 89 | precioproc[3]=rand()%4+1; 90 | Mvendermateria->SetLabel(wxString::Format("... %d",precioshiper[precioproc[3]])); 91 | esperar.Update(4);estadoMercado=2; 92 | 93 | }else if(estadoMercado==1){ 94 | srand(time(NULL)); 95 | int lazar=rand()%10+1; 96 | switch(lazar){ 97 | case 1:wxMessageBox("La paella sabe extrana, hay droga, creo que es ilegal...");money-=precioshiper[precioproc[0]]; droga++;break; 98 | case 2:{if(droga!=0){wxMessageBox("Tenias droga y la policía te ha visto. Pierdes la droga y debes pagar 2000 $");money-=2000;droga=0;}}break; 99 | default:wxMessageBox("Felicidades, comprado correctamente");money-=precioshiper[precioproc[0]]; food++; 100 | } 101 | //Poner viejos botones 102 | Mcomprar->SetLabel("Comprar productos"); 103 | Mvender->SetLabel("Vender productos"); 104 | Mtransformarmateria->SetLabel("Transformar m.prima"); 105 | Mvendermateria->SetLabel("Vender m.prima"); 106 | estadoMercado=0;}else{ 107 | if(food>0){wxMessageBox("Has vendido correctamente"); money+=precioshiper[precioproc[0]]; food--;} 108 | Mcomprar->SetLabel("Comprar productos"); 109 | Mvender->SetLabel("Vender productos"); 110 | Mtransformarmateria->SetLabel("Transformar m.prima"); 111 | Mvendermateria->SetLabel("Vender m.prima"); 112 | estadoMercado=0; 113 | 114 | } 115 | } 116 | 117 | void Mercado::TransformarMateria(wxCommandEvent& event) 118 | { 119 | if(estadoMercado==0){ 120 | if(prima>0){ 121 | srand(time(NULL)); 122 | int lazar=rand()%4+1; 123 | switch(lazar){ 124 | case 1: wxMessageBox("Se ha convertido en un movil Android por 400 $"); prima--; money-=400; electro++;break; 125 | case 2: wxMessageBox("Se ha convertido en comida por 400 $"); prima--; money-=400; food++;break; 126 | case 3: wxMessageBox("Se ha convertido en ropa por 400 $"); prima--; money-=400; textil++; break; 127 | case 4: wxMessageBox("La materia prima no ha dado nada, lo pierdes y pagas 400 $"); prima--;money-=400; break; 128 | 129 | 130 | } 131 | 132 | 133 | }else{wxMessageBox("No tienes Materia prima. debes de ir a una granja o mina");} 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | }else if(estadoMercado==1){ 142 | srand(time(NULL)); 143 | int lazar=rand()%10+1; 144 | switch(lazar){ 145 | case 1:wxMessageBox("La ropa tiene algo, es droga, creo que es ilegal...");money-=precioshiper[precioproc[0]]; droga++;break; 146 | case 2:{if(droga!=0){wxMessageBox("Tenias droga y la policía te ha visto. Pierdes la droga y debes pagar 2000 $");money-=2000;droga=0;}}break; 147 | default:wxMessageBox("Felicidades, comprado correctamente");money-=precioshiper[precioproc[0]]; textil++; 148 | } 149 | //Poner viejos botones 150 | Mcomprar->SetLabel("Comprar productos"); 151 | Mvender->SetLabel("Vender productos"); 152 | Mtransformarmateria->SetLabel("Transformar m.prima"); 153 | Mvendermateria->SetLabel("Vender m.prima"); 154 | estadoMercado=0;}else{ 155 | if(textil>0){wxMessageBox("Has vendido correctamente"); money+=precioshiper[precioproc[0]]; textil--;} 156 | Mcomprar->SetLabel("Comprar productos"); 157 | Mvender->SetLabel("Vender productos"); 158 | Mtransformarmateria->SetLabel("Transformar m.prima"); 159 | Mvendermateria->SetLabel("Vender m.prima"); 160 | estadoMercado=0; 161 | 162 | } 163 | } 164 | void Mercado::VenderMateria(wxCommandEvent& event) 165 | { 166 | if(estadoMercado==0){ 167 | if(prima>0){ 168 | srand(time(NULL)); 169 | int lazar=rand()%4+1; 170 | switch(lazar){ 171 | case 1: wxMessageBox("Te han dado 400 $"); prima--; money+=400;break; 172 | case 2: wxMessageBox("Te han dado 200 $"); prima--; money+=200;break; 173 | case 3: wxMessageBox("Te han dado 50 $"); prima--; money+=50;break; 174 | case 4: wxMessageBox("La materia prima no tenia valor, la pierdes y no recibes nada"); prima--;break; 175 | 176 | }}else{wxMessageBox("No tienes materia prima");} 177 | 178 | 179 | 180 | 181 | 182 | }else if(estadoMercado==1){ 183 | srand(time(NULL)); 184 | int lazar=rand()%10+1; 185 | switch(lazar){ 186 | case 1:wxMessageBox("Te dan una caja extrana, hay droga, creo que es ilegal...");money-=precioshiper[precioproc[0]]; droga++;break; 187 | case 2:{if(droga!=0){wxMessageBox("Tenias droga y la policía te ha visto. Pierdes la droga y debes pagar 2000 $");money-=2000;droga=0;}}break; 188 | case 3:wxMessageBox("Te ha tocado ropa de moda");money-=precioshiper[precioproc[0]]; textil++;break; 189 | case 4:wxMessageBox("Te ha tocado un movil Android");money-=precioshiper[precioproc[0]]; electro++;break; 190 | case 5:wxMessageBox("Te ha tocado una gran paella");money-=precioshiper[precioproc[0]]; food++;break; 191 | default:wxMessageBox("Te ha tocado un producto lujoso, pero inutil");money-=precioshiper[precioproc[0]]; rich++; 192 | 193 | } Mcomprar->SetLabel("Comprar productos"); 194 | Mvender->SetLabel("Vender productos"); 195 | Mtransformarmateria->SetLabel("Transformar m.prima"); 196 | Mvendermateria->SetLabel("Vender m.prima"); 197 | estadoMercado=0;}else{ 198 | 199 | if(droga>0){wxMessageBox("Has vendido droga correctamente"); money+=precioshiper[precioproc[0]]; droga--;} 200 | Mcomprar->SetLabel("Comprar productos"); 201 | Mvender->SetLabel("Vender productos"); 202 | Mtransformarmateria->SetLabel("Transformar m.prima"); 203 | Mvendermateria->SetLabel("Vender m.prima"); 204 | estadoMercado=0; 205 | 206 | 207 | 208 | 209 | 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /multiplayer/divsock.cpp: -------------------------------------------------------------------------------- 1 | //Divsock.cpp 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "divsock.h" 10 | #include 11 | #include 12 | #include 13 | 14 | int Lee_Socket (int fd, char *Datos, int Longitud) 15 | { 16 | int Leido = 0; 17 | int Aux = 0; 18 | 19 | /* 20 | * Comprobacion de que los parametros de entrada son correctos 21 | */ 22 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 23 | return -1; 24 | 25 | /* 26 | * Mientras no hayamos leido todos los datos solicitados 27 | */ 28 | while (Leido < Longitud) 29 | { 30 | Aux = read (fd, Datos + Leido, Longitud - Leido); 31 | if (Aux > 0) 32 | { 33 | /* 34 | * Si hemos conseguido leer datos, incrementamos la variable 35 | * que contiene los datos leidos hasta el momento 36 | */ 37 | Leido = Leido + Aux; 38 | } 39 | else 40 | { 41 | /* 42 | * Si read devuelve 0, es que se ha cerrado el socket. Devolvemos 43 | * los caracteres leidos hasta ese momento 44 | */ 45 | if (Aux == 0) 46 | return Leido; 47 | if (Aux == -1) 48 | { 49 | /* 50 | * En caso de error, la variable errno nos indica el tipo 51 | * de error. 52 | * El error EINTR se produce si ha habido alguna 53 | * interrupcion del sistema antes de leer ningun dato. No 54 | * es un error realmente. 55 | * El error EGAIN significa que el socket no esta disponible 56 | * de momento, que lo intentemos dentro de un rato. 57 | * Ambos errores se tratan con una espera de 100 microsegundos 58 | * y se vuelve a intentar. 59 | * El resto de los posibles errores provocan que salgamos de 60 | * la funcion con error. 61 | */ 62 | switch (errno) 63 | { 64 | case EINTR: 65 | case EAGAIN: 66 | usleep (100); 67 | break; 68 | default: 69 | return -1; 70 | } 71 | } 72 | } 73 | } 74 | 75 | /* 76 | * Se devuelve el total de los caracteres leidos 77 | */ 78 | return Leido; 79 | } 80 | 81 | /* 82 | * Escribe dato en el socket cliente. Devuelve numero de bytes escritos, 83 | * o -1 si hay error. 84 | */ 85 | int Escribe_Socket (int fd, char *Datos, int Longitud) 86 | { 87 | int Escrito = 0; 88 | int Aux = 0; 89 | 90 | /* 91 | * Comprobacion de los parametros de entrada 92 | */ 93 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 94 | return -1; 95 | 96 | /* 97 | * Bucle hasta que hayamos escrito todos los caracteres que nos han 98 | * indicado. 99 | */ 100 | while (Escrito < Longitud) 101 | { 102 | Aux = write (fd, Datos + Escrito, Longitud - Escrito); 103 | if (Aux > 0) 104 | { 105 | /* 106 | * Si hemos conseguido escribir caracteres, se actualiza la 107 | * variable Escrito 108 | */ 109 | Escrito = Escrito + Aux; 110 | } 111 | else 112 | { 113 | /* 114 | * Si se ha cerrado el socket, devolvemos el numero de caracteres 115 | * leidos. 116 | * Si ha habido error, devolvemos -1 117 | */ 118 | if (Aux == 0) 119 | return Escrito; 120 | else 121 | return -1; 122 | } 123 | } 124 | 125 | /* 126 | * Devolvemos el total de caracteres leidos 127 | */ 128 | return Escrito; 129 | } 130 | int Abre_Socket_Unix_Server (char *Servicio) 131 | { 132 | struct sockaddr_un Direccion; 133 | int Descriptor; 134 | 135 | /* 136 | * Se abre el socket 137 | */ 138 | Descriptor = socket (AF_UNIX, SOCK_STREAM, 0); 139 | if (Descriptor == -1) 140 | return -1; 141 | 142 | /* 143 | * Se rellenan en la estructura Direccion los datos necesarios para 144 | * poder llamar a la funcion bind() 145 | */ 146 | strcpy (Direccion.sun_path, Servicio); 147 | Direccion.sun_family = AF_UNIX; 148 | 149 | if (bind ( 150 | Descriptor, 151 | (struct sockaddr *)&Direccion, 152 | strlen (Direccion.sun_path) + sizeof (Direccion.sun_family)) == -1) 153 | { 154 | /* 155 | * En caso de error cerramos el socket y devolvemos error 156 | */ 157 | close (Descriptor); 158 | return -1; 159 | } 160 | 161 | /* 162 | * Avisamos al sistema que comience a atender peticiones de clientes. 163 | */ 164 | if (listen (Descriptor, 1) == -1) 165 | { 166 | close (Descriptor); 167 | return -1; 168 | } 169 | 170 | /* 171 | * Se devuelve el descriptor del socket servidor 172 | */ 173 | return Descriptor; 174 | } 175 | 176 | /* 177 | * Se le pasa un socket de servidor y acepta en el una conexion de cliente. 178 | * devuelve el descriptor del socket del cliente o -1 si hay problemas. 179 | * Esta funcion vale para socket AF_INET o AF_UNIX. 180 | */ 181 | int Acepta_Conexion_Cliente (int Descriptor) 182 | { 183 | socklen_t Longitud_Cliente; 184 | struct sockaddr Cliente; 185 | int Hijo; 186 | 187 | /* 188 | * La llamada a la funcion accept requiere que el parametro 189 | * Longitud_Cliente contenga inicialmente el tamano de la 190 | * estructura Cliente que se le pase. A la vuelta de la 191 | * funcion, esta variable contiene la longitud de la informacion 192 | * util devuelta en Cliente 193 | */ 194 | Longitud_Cliente = sizeof (Cliente); 195 | Hijo = accept (Descriptor, &Cliente, &Longitud_Cliente); 196 | if (Hijo == -1) 197 | return -1; 198 | 199 | /* 200 | * Se devuelve el descriptor en el que esta "enchufado" el cliente. 201 | */ 202 | return Hijo; 203 | } 204 | 205 | /* 206 | * Abre un socket servidor de tipo AF_INET. Devuelve el descriptor 207 | * del socket o -1 si hay probleamas 208 | * Se pasa como parametro el nombre del servicio. Debe estar dado 209 | * de alta en el fichero /etc/services 210 | */ 211 | int Abre_Socket_Inet_Server (char *Servicio) 212 | { 213 | struct sockaddr_in Direccion; 214 | struct sockaddr Cliente; 215 | socklen_t Longitud_Cliente; 216 | struct servent *Puerto; 217 | int Descriptor; 218 | //printf("Variables inicializadas"); 219 | /* 220 | * se abre el socket 221 | */ 222 | Descriptor = socket (AF_INET, SOCK_STREAM, 0); 223 | if (Descriptor == -1) 224 | return -1; 225 | //printf("Socket abierto"); 226 | /* 227 | * Se obtiene el servicio del fichero /etc/services 228 | */ 229 | /*Puerto = getservbyname ("www", "tcp"); 230 | Puerto->s_name="divelnet"; 231 | Puerto->s_port=6996;*/ 232 | //{"Divel Server Net";NULL;6996;"tcp";} 233 | 234 | //Puerto->s_port=6996; 235 | //Puerto==6996; //Cambiar para tener puertos variables 236 | //if (Puerto == NULL) 237 | //return -1; 238 | //printf("Servicio obtenido"); 239 | /* 240 | * Se rellenan los campos de la estructura Direccion, necesaria 241 | * para la llamada a la funcion bind() 242 | */ 243 | Direccion.sin_family = AF_INET; 244 | Direccion.sin_port = 6996;//6996;//Puerto->s_port; 245 | Direccion.sin_addr.s_addr =INADDR_ANY; 246 | //printf("Estrucura completa"); 247 | if (bind ( 248 | Descriptor, 249 | (struct sockaddr *)&Direccion, 250 | sizeof (Direccion)) == -1) 251 | { 252 | close (Descriptor); 253 | return -1; 254 | } 255 | //printf("Visible"); 256 | /* 257 | * Se avisa al sistema que comience a atender llamadas de clientes 258 | */ 259 | if (listen (Descriptor, 1) == -1) 260 | { 261 | close (Descriptor); 262 | return -1; 263 | } 264 | //printf("Empezando a atender llamadas de clientes\n"); 265 | /* 266 | * Se devuelve el descriptor del socket servidor 267 | */ 268 | return Descriptor; 269 | } 270 | int Abre_Conexion_Unix_Cliente (char *Servicio) 271 | { 272 | struct sockaddr_un Direccion; 273 | int Descriptor; 274 | 275 | strcpy (Direccion.sun_path, Servicio); 276 | Direccion.sun_family = AF_UNIX; 277 | 278 | Descriptor = socket (AF_UNIX, SOCK_STREAM, 0); 279 | if (Descriptor == -1) 280 | return -1; 281 | 282 | /* 283 | * Devuelve 0 si todo va bien, -1 en caso de error 284 | */ 285 | if (connect ( 286 | Descriptor, 287 | (struct sockaddr *)&Direccion, 288 | strlen (Direccion.sun_path) + sizeof (Direccion.sun_family)) == -1) 289 | { 290 | return -1; 291 | } 292 | else 293 | { 294 | return Descriptor; 295 | } 296 | } 297 | 298 | /* 299 | / Conecta con un servidor remoto a traves de socket INET 300 | */ 301 | int Abre_Conexion_Inet_Cliente ( 302 | char *Host_Servidor, 303 | char *Servicio) 304 | { 305 | struct sockaddr_in Direccion; 306 | struct servent *Puerto; 307 | struct hostent *Host; 308 | int Descriptor; 309 | 310 | //Puerto = getservbyname ("www", "tcp"); 311 | //Puerto->s_port=6996; 312 | //Puerto->s_name="divelnet"; 313 | //Puerto = getservbyname (Servicio, "tcp"); 314 | //if (Puerto == NULL) 315 | //return -1; 316 | //Puerto->s_port=6996; //Editar esto si procede 317 | //Host = gethostbyname ("localhost"); 318 | //Host->h_addr=Host_Servidor; 319 | //if (Host == NULL) 320 | //return -1; 321 | Direccion.sin_addr.s_addr=inet_addr(Host_Servidor); 322 | 323 | Direccion.sin_family = AF_INET; 324 | //Direccion.sin_addr.s_addr = ((struct in_addr *)(Host->h_addr))->s_addr; //Direccion.sin_addr.s_addr = ((struct in_addr *)(Host->h_addr))->s_addr; 325 | Direccion.sin_port = 6996; //Direccion.sin_port = Puerto->s_port; 326 | 327 | Descriptor = socket (AF_INET, SOCK_STREAM, 0); 328 | if (Descriptor == -1) 329 | return -1; 330 | 331 | if (connect ( 332 | Descriptor, 333 | (struct sockaddr *)&Direccion, 334 | sizeof (Direccion)) == -1) 335 | { 336 | return -1; 337 | } 338 | 339 | return Descriptor; 340 | } 341 | -------------------------------------------------------------------------------- /source/save.cpp: -------------------------------------------------------------------------------- 1 | #include "save.h" 2 | //#include "inicio.hpp" 3 | #include "Librerias.h" 4 | 5 | extern int money, city, aux, mision, sobornos, blacklist, droga, socio, electro, food, textil,rich,prima; 6 | extern char name; 7 | 8 | SaveDialog::SaveDialog() 9 | : wxDialog(NULL, wxID_ANY, wxT("Casa"), wxPoint(-1,-1), wxSize(400,400)) 10 | { 11 | wxInitAllImageHandlers(); 12 | wxPanel* panelSave=new wxPanel(this); 13 | wxBitmap estacion("/opt/extras.ubuntu.com/azpazeta/media/save.png",wxBITMAP_TYPE_PNG); 14 | wxStaticBitmap* fondo_estacion=new wxStaticBitmap(panelSave, wxID_ANY, estacion, wxPoint(-1,-1)); 15 | guardar_std=new wxButton(panelSave,ID_SAVE1,wxT("Guardar"),wxPoint(100,50)); 16 | cargar_std=new wxButton(panelSave,ID_SAVE2,wxT("Cargar"),wxPoint(100,100)); 17 | guardar_copy=new wxButton(panelSave,ID_SAVE3,wxT("Guardar copia"),wxPoint(100,150)); 18 | guardar_std=new wxButton(panelSave,ID_SAVE4,wxT("Cargar copia"),wxPoint(100,200)); 19 | 20 | Connect(ID_SAVE1, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(SaveDialog::OnBotonGuardarStd)); 21 | Connect(ID_SAVE2, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(SaveDialog::OnBotonCargarStd)); 22 | Connect(ID_SAVE3, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(SaveDialog::OnBotonGuardarCopy)); 23 | Connect(ID_SAVE4, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(SaveDialog::OnBotonCargarCopy)); 24 | 25 | 26 | } 27 | 28 | 29 | void SaveDialog::OnBotonGuardarStd(wxCommandEvent& event) 30 | { 31 | //FILE* partida_guardar; 32 | //partida_guardar=fopen("/usr/share/Azpazeta/save/save.azp","w"); 33 | /*fprintf(partida_guardar,"Azpazeta_Save_File_v.1.0:MONEY=%d:CITY=%d:MISION=%d:AUX=%d:DROGA=%d:SOBORNO=%d:BLACKLIST=%d:\n",money, city, mision, aux, droga, sobornos, blacklist); 34 | fclose(partida_guardar);*/ 35 | //Nuevo sistema de partidas 36 | char *home; 37 | home=getenv("HOME"); 38 | wxString pathgeneral=wxString::Format("mkdir -p %s/.azpazeta",home); 39 | system(pathgeneral.c_str()); 40 | wxString pathguardar=wxString::Format("%s/.azpazeta/save.azp",home); 41 | 42 | wxFFileOutputStream out(pathguardar); 43 | wxZipOutputStream zip(out); 44 | wxTextOutputStream txt(zip); 45 | wxString sep(wxFileName::GetPathSeparator()); 46 | char datosparaguardar[2048]; 47 | zip.PutNextEntry(wxT("AZPGeneral.txt")); 48 | sprintf(datosparaguardar,"Azpazeta_Save_File_v.1.0:MONEY=%d:CITY=%d:MISION=%d:AUX=%d:DROGA=%d:SOBORNO=%d:BLACKLIST=%d:SOCIO=%d:ELECTRO=%d:FOOD=%d:TEXTIL=%d:RICH=%d:PRIMA=%d:\n",money, city, mision, aux, droga, sobornos, blacklist, socio, electro, food, textil,rich,prima); 49 | txt << datosparaguardar; 50 | zip.PutNextEntry(wxT("SERVER-DATA")+ sep+ wxT("lastservers.txt")); 51 | zip.PutNextEntry(wxT("META-DATA") + sep + wxT("INFO.txt")); 52 | txt << wxT("Hi, this is the user information\n"); 53 | 54 | 55 | 56 | this->Destroy(); 57 | } 58 | void SaveDialog::OnBotonCargarStd(wxCommandEvent& event) 59 | { 60 | //FILE* partida_cargar; 61 | //partida_cargar=fopen("/usr/share/Azpazeta/save/save.azp","r"); 62 | /*fscanf(partida_cargar,"Azpazeta_Save_File_v.1.0:MONEY=%d:CITY=%d:MISION=%d:AUX=%d:DROGA=%d:SOBORNO=%d:BLACKLIST=%d:\n",&money, &city, &mision, &aux, &droga, &sobornos, &blacklist); 63 | fclose(partida_cargar);*/ 64 | //Nuevo sistema de partidas 65 | char *home; 66 | home=getenv("HOME"); 67 | wxString pathgeneral=wxString::Format("mkdir -p %s/.azpazeta",home); 68 | system(pathgeneral.c_str()); 69 | wxString pathguardar=wxString::Format("%s/.azpazeta/save.azp",home); 70 | char mybuffer[2048]; 71 | std::auto_ptr entry; 72 | wxFFileInputStream in(pathguardar); 73 | wxZipInputStream zip(in); 74 | int archivo=1; 75 | 76 | while (entry.reset(zip.GetNextEntry()), entry.get() != NULL) { 77 | while (!zip.Eof()) { 78 | zip.Read(mybuffer, 2048); 79 | if(archivo==1){ 80 | sscanf(mybuffer,"Azpazeta_Save_File_v.1.0:MONEY=%d:CITY=%d:MISION=%d:AUX=%d:DROGA=%d:SOBORNO=%d:BLACKLIST=%d:SOCIO=%d:ELECTRO=%d:FOOD=%d:TEXTIL=%d:RICH=%d:PRIMA=%d:\n",&money, &city, &mision, &aux, &droga, &sobornos, &blacklist, &socio, &electro, &food, &textil,&rich,&prima);//Los datos importantes de juego están aquí 81 | 82 | } 83 | archivo++; 84 | if (zip.LastRead() > 0) { 85 | // do something with read data here, buffer contains zip.LastRead() valid bytes 86 | } 87 | } 88 | } 89 | 90 | 91 | 92 | 93 | 94 | 95 | this->Destroy(); 96 | } 97 | void SaveDialog::OnBotonGuardarCopy(wxCommandEvent& event) 98 | { 99 | wxFileDialog* openfile = new wxFileDialog(this,wxT("Guardar partida"),wxT(""),wxT(""),wxT("Azpazeta Save Files|*.azp"),wxFD_SAVE); 100 | 101 | openfile->ShowModal(); 102 | // the user changed idea... 103 | 104 | // save the current contents in the file; 105 | // this can be done with e.g. wxWidgets output streams: 106 | /*FILE* partida_guardar; 107 | partida_guardar=fopen(openfile->GetPath().c_str(),"w"); 108 | fprintf(partida_guardar,"Azpazeta_Save_File_v.1.0:MONEY=%d:CITY=%d:MISION=%d:AUX=%d:DROGA=%d:SOBORNO=%d:BLACKLIST=%d:\n",money, city, mision, aux, droga, sobornos, blacklist); 109 | fclose(partida_guardar);*/ 110 | //wxFileSystem::AddHandler(new wxZipFSHandler); 111 | wxFFileOutputStream out(openfile->GetPath()+".azp"); 112 | wxZipOutputStream zip(out); 113 | wxTextOutputStream txt(zip); 114 | wxString sep(wxFileName::GetPathSeparator()); 115 | char datosparaguardar[2048]; 116 | zip.PutNextEntry(wxT("AZPGeneral.txt")); 117 | sprintf(datosparaguardar,"Azpazeta_Save_File_v.1.0:MONEY=%d:CITY=%d:MISION=%d:AUX=%d:DROGA=%d:SOBORNO=%d:BLACKLIST=%d:SOCIO=%d:ELECTRO=%d:FOOD=%d:TEXTIL=%d:RICH=%d:PRIMA=%d:\n",money, city, mision, aux, droga, sobornos, blacklist, socio, electro, food, textil,rich,prima); 118 | txt << datosparaguardar; 119 | zip.PutNextEntry(wxT("SERVER-DATA")+ sep+ wxT("lastservers.txt")); 120 | zip.PutNextEntry(wxT("META-DATA") + sep + wxT("INFO.txt")); 121 | txt << wxT("Hi, this is the user information\n"); 122 | this->Destroy(); 123 | } 124 | void SaveDialog::OnBotonCargarCopy(wxCommandEvent& event) 125 | { 126 | wxFileDialog* openfile = new wxFileDialog(this,wxT("Cargar partida"),wxT(""),wxT(""),wxT("Azpazeta Save Files|*.azp"),wxFD_OPEN); 127 | openfile->ShowModal(); 128 | /*FILE* partida_cargar; 129 | partida_cargar=fopen(openfile->GetPath().c_str(),"r"); 130 | fscanf(partida_cargar,"Azpazeta_Save_File_v.1.0:MONEY=%d:CITY=%d:MISION=%d:AUX=%d:DROGA=%d:SOBORNO=%d:BLACKLIST=%d:\n",&money, &city, &mision, &aux, &droga, &sobornos, &blacklist); 131 | fclose(partida_cargar); 132 | this->Destroy();*/ 133 | char mybuffer[2048]; 134 | std::auto_ptr entry; 135 | wxFFileInputStream in(openfile->GetPath()); 136 | wxZipInputStream zip(in); 137 | int archivo=1; 138 | 139 | while (entry.reset(zip.GetNextEntry()), entry.get() != NULL) { 140 | while (!zip.Eof()) { 141 | zip.Read(mybuffer, 2048); 142 | if(archivo==1){ 143 | sscanf(mybuffer,"Azpazeta_Save_File_v.1.0:MONEY=%d:CITY=%d:MISION=%d:AUX=%d:DROGA=%d:SOBORNO=%d:BLACKLIST=%d:SOCIO=%d:ELECTRO=%d:FOOD=%d:TEXTIL=%d:RICH=%d:PRIMA=%d:\n",&money, &city, &mision, &aux, &droga, &sobornos, &blacklist, &socio, &electro, &food, &textil,&rich,&prima);//Los datos importantes de juego están aquí 144 | 145 | } 146 | archivo++; 147 | if (zip.LastRead() > 0) { 148 | // do something with read data here, buffer contains zip.LastRead() valid bytes 149 | } 150 | } 151 | } 152 | 153 | /*while (entry.reset(zip.GetNextEntry()), entry.get() != NULL) 154 | { 155 | // access meta-data 156 | wxString zipname = wxT("AZPGeneral.txt"); 157 | //if (entry->IsDir()) 158 | // { 159 | //int perm = entry->GetMode(); 160 | //wxFileName::Mkdir(name, perm, wxPATH_MKDIR_FULL); 161 | //} 162 | //else // it is a file 163 | //{ 164 | zip.OpenEntry(*entry.get()); 165 | if (!zip.CanRead()) 166 | { 167 | wxLogError("Can not read zip entry"); 168 | break; 169 | } 170 | wxFileOutputStream file(zipname); 171 | if (!file) 172 | { 173 | wxLogError("Can not create file "); 174 | 175 | } 176 | wxPrintf("Good"); 177 | zip.Read(file); 178 | wxMessageBox(file); 179 | wxPrintf("Good"); 180 | // read 'zip' to access the entry's data 181 | //} 182 | }zip.CloseEntry(); 183 | */ 184 | } 185 | void SaveDialog::Guardar(wxString archivo) 186 | { 187 | 188 | } 189 | void SaveDialog::Cargar(wxString archivo) 190 | { 191 | wxPrintf("Cargando %s ...",archivo); 192 | wxProgressDialog cargando("Azpazeta","Cargando partida...",3); 193 | //FILE* partida_cargar; 194 | //partida_cargar=fopen(archivo.c_str(),"r"); 195 | cargando.Update(1); 196 | //fscanf(partida_cargar,"Azpazeta_Save_File_v.1.0:MONEY=%d:CITY=%d:MISION=%d:AUX=%d:DROGA=%d:SOBORNO=%d:BLACKLIST=%d:\n",&money, &city, &mision, &aux, &droga, &sobornos, &blacklist); 197 | cargando.Update(2); 198 | //fclose(partida_cargar); 199 | cargando.Update(3); 200 | 201 | char mybuffer[2048]; 202 | std::auto_ptr entry; 203 | wxFFileInputStream in(archivo); 204 | wxZipInputStream zip(in); 205 | int leer=1; 206 | 207 | while (entry.reset(zip.GetNextEntry()), entry.get() != NULL) { 208 | while (!zip.Eof()) { 209 | zip.Read(mybuffer, 2048); 210 | if(leer==1){ 211 | sscanf(mybuffer,"Azpazeta_Save_File_v.1.0:MONEY=%d:CITY=%d:MISION=%d:AUX=%d:DROGA=%d:SOBORNO=%d:BLACKLIST=%d:SOCIO=%d:ELECTRO=%d:FOOD=%d:TEXTIL=%d:RICH=%d:PRIMA=%d:\n",&money, &city, &mision, &aux, &droga, &sobornos, &blacklist, &socio, &electro, &food, &textil,&rich,&prima);//Los datos importantes de juego están aquí 212 | 213 | } 214 | leer++; 215 | if (zip.LastRead() > 0) { 216 | // do something with read data here, buffer contains zip.LastRead() valid bytes 217 | } 218 | } 219 | } 220 | 221 | 222 | 223 | 224 | } 225 | -------------------------------------------------------------------------------- /multiplayer/Servidor.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Javier Abellan, 20 Jun 2000 3 | * 4 | * Programa Servidor de socket INET, como ejemplo de utilizacion de las 5 | * funciones de sockets. 6 | */ 7 | //#include 8 | //#include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | int Lee_Socket (int fd, char *Datos, int Longitud); 23 | int Escribe_Socket (int fd, char *Datos, int Longitud); 24 | int Abre_Socket_Unix (char *Servicio); 25 | int Abre_Socket_Inet (char *Servicio); 26 | int Acepta_Conexion_Cliente (int Descriptor); 27 | 28 | 29 | 30 | int main(){ 31 | 32 | int maximo=10; 33 | fd_set descriptoresLectura; 34 | int socketCliente[10]; 35 | int numeroClientes; 36 | int Socket_Servidor; 37 | int Socket_Cliente; 38 | char Cadena[2048]; 39 | char nombreCliente1[1024]; 40 | char nombreCliente2[1024]; 41 | 42 | /* 43 | * Descriptores de socket servidor y de socket con el cliente 44 | */ 45 | 46 | printf("Cargando."); 47 | /* 48 | * Se abre el socket servidor, con el servicio "cpp_java" dado de 49 | * alta en /etc/services. 50 | */ 51 | Socket_Servidor = Abre_Socket_Inet ("cpp_java"); 52 | if (Socket_Servidor == -1) 53 | { 54 | printf ("No se puede abrir socket servidor\n"); 55 | exit (-1); 56 | } 57 | printf("."); 58 | /* 59 | * Se espera un cliente que quiera conectarse 60 | */ 61 | socketCliente[0] = Acepta_Conexion_Cliente (Socket_Servidor); 62 | if (Socket_Cliente == -1) 63 | { 64 | printf ("No se puede abrir socket de cliente\n"); 65 | exit (-1); 66 | } 67 | socketCliente[1] = Acepta_Conexion_Cliente (Socket_Servidor); 68 | if (Socket_Cliente == -1) 69 | { 70 | printf("No se puede abrir socket de cliente\n"); 71 | exit(-1); 72 | } 73 | printf("2 clientes conectados"); 74 | Escribe_Socket(socketCliente[0], "2 clientes conectados\nEmpezando juego\n", 2048); 75 | Escribe_Socket(socketCliente[1], "2 clientes conectados\nEmpezando juego\n", 2048); 76 | int correcto=1; 77 | int correcto2=1; 78 | while(correcto==1 || correcto2==1){ 79 | correcto=Lee_Socket (socketCliente[0], nombreCliente1, 1024); 80 | correcto2=Lee_Socket (socketCliente[1], nombreCliente2, 1024);} 81 | printf(".\n"); 82 | /* 83 | * Se escribe en pantalla la informacion que se ha recibido del 84 | * cliente 85 | */ 86 | printf ("Jugador 1: %s\n", nombreCliente1); 87 | printf ("Jugador 2: %s\n", nombreCliente2); 88 | 89 | Escribe_Socket(socketCliente[0], nombreCliente2, 1024); 90 | Escribe_Socket(socketCliente[1], nombreCliente1, 1024); 91 | 92 | /* 93 | * Se prepara una cadena de texto para enviar al cliente. La longitud 94 | * de la cadena es 5 letras + \0 al final de la cadena = 6 caracteres 95 | */ 96 | 97 | printf("Cerrando comunicacion\n"); 98 | /* 99 | * Se cierran los sockets 100 | */ 101 | //close (Socket_Cliente); Pasado a OnQuit 102 | //close (Socket_Servidor); 103 | 104 | close (socketCliente[0]); 105 | close(socketCliente[1]); 106 | close(Socket_Servidor); 107 | } 108 | 109 | int Lee_Socket (int fd, char *Datos, int Longitud) 110 | { 111 | int Leido = 0; 112 | int Aux = 0; 113 | 114 | /* 115 | * Comprobacion de que los parametros de entrada son correctos 116 | */ 117 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 118 | return -1; 119 | 120 | /* 121 | * Mientras no hayamos leido todos los datos solicitados 122 | */ 123 | while (Leido < Longitud) 124 | { 125 | Aux = read (fd, Datos + Leido, Longitud - Leido); 126 | if (Aux > 0) 127 | { 128 | /* 129 | * Si hemos conseguido leer datos, incrementamos la variable 130 | * que contiene los datos leidos hasta el momento 131 | */ 132 | Leido = Leido + Aux; 133 | } 134 | else 135 | { 136 | /* 137 | * Si read devuelve 0, es que se ha cerrado el socket. Devolvemos 138 | * los caracteres leidos hasta ese momento 139 | */ 140 | if (Aux == 0) 141 | return Leido; 142 | if (Aux == -1) 143 | { 144 | /* 145 | * En caso de error, la variable errno nos indica el tipo 146 | * de error. 147 | * El error EINTR se produce si ha habido alguna 148 | * interrupcion del sistema antes de leer ningun dato. No 149 | * es un error realmente. 150 | * El error EGAIN significa que el socket no esta disponible 151 | * de momento, que lo intentemos dentro de un rato. 152 | * Ambos errores se tratan con una espera de 100 microsegundos 153 | * y se vuelve a intentar. 154 | * El resto de los posibles errores provocan que salgamos de 155 | * la funcion con error. 156 | */ 157 | switch (errno) 158 | { 159 | case EINTR: 160 | case EAGAIN: 161 | usleep (100); 162 | break; 163 | default: 164 | return -1; 165 | } 166 | } 167 | } 168 | } 169 | 170 | /* 171 | * Se devuelve el total de los caracteres leidos 172 | */ 173 | return Leido; 174 | } 175 | 176 | /* 177 | * Escribe dato en el socket cliente. Devuelve numero de bytes escritos, 178 | * o -1 si hay error. 179 | */ 180 | int Escribe_Socket (int fd, char *Datos, int Longitud) 181 | { 182 | int Escrito = 0; 183 | int Aux = 0; 184 | 185 | /* 186 | * Comprobacion de los parametros de entrada 187 | */ 188 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 189 | return -1; 190 | 191 | /* 192 | * Bucle hasta que hayamos escrito todos los caracteres que nos han 193 | * indicado. 194 | */ 195 | while (Escrito < Longitud) 196 | { 197 | Aux = write (fd, Datos + Escrito, Longitud - Escrito); 198 | if (Aux > 0) 199 | { 200 | /* 201 | * Si hemos conseguido escribir caracteres, se actualiza la 202 | * variable Escrito 203 | */ 204 | Escrito = Escrito + Aux; 205 | } 206 | else 207 | { 208 | /* 209 | * Si se ha cerrado el socket, devolvemos el numero de caracteres 210 | * leidos. 211 | * Si ha habido error, devolvemos -1 212 | */ 213 | if (Aux == 0) 214 | return Escrito; 215 | else 216 | return -1; 217 | } 218 | } 219 | 220 | /* 221 | * Devolvemos el total de caracteres leidos 222 | */ 223 | return Escrito; 224 | } 225 | int Abre_Socket_Unix (char *Servicio) 226 | { 227 | struct sockaddr_un Direccion; 228 | int Descriptor; 229 | 230 | /* 231 | * Se abre el socket 232 | */ 233 | Descriptor = socket (AF_UNIX, SOCK_STREAM, 0); 234 | if (Descriptor == -1) 235 | return -1; 236 | 237 | /* 238 | * Se rellenan en la estructura Direccion los datos necesarios para 239 | * poder llamar a la funcion bind() 240 | */ 241 | strcpy (Direccion.sun_path, Servicio); 242 | Direccion.sun_family = AF_UNIX; 243 | 244 | if (bind ( 245 | Descriptor, 246 | (struct sockaddr *)&Direccion, 247 | strlen (Direccion.sun_path) + sizeof (Direccion.sun_family)) == -1) 248 | { 249 | /* 250 | * En caso de error cerramos el socket y devolvemos error 251 | */ 252 | close (Descriptor); 253 | return -1; 254 | } 255 | 256 | /* 257 | * Avisamos al sistema que comience a atender peticiones de clientes. 258 | */ 259 | if (listen (Descriptor, 1) == -1) 260 | { 261 | close (Descriptor); 262 | return -1; 263 | } 264 | 265 | /* 266 | * Se devuelve el descriptor del socket servidor 267 | */ 268 | return Descriptor; 269 | } 270 | 271 | /* 272 | * Se le pasa un socket de servidor y acepta en el una conexion de cliente. 273 | * devuelve el descriptor del socket del cliente o -1 si hay problemas. 274 | * Esta funcion vale para socket AF_INET o AF_UNIX. 275 | */ 276 | int Acepta_Conexion_Cliente (int Descriptor) 277 | { 278 | socklen_t Longitud_Cliente; 279 | struct sockaddr Cliente; 280 | int Hijo; 281 | 282 | /* 283 | * La llamada a la funcion accept requiere que el parametro 284 | * Longitud_Cliente contenga inicialmente el tamano de la 285 | * estructura Cliente que se le pase. A la vuelta de la 286 | * funcion, esta variable contiene la longitud de la informacion 287 | * util devuelta en Cliente 288 | */ 289 | Longitud_Cliente = sizeof (Cliente); 290 | Hijo = accept (Descriptor, &Cliente, &Longitud_Cliente); 291 | if (Hijo == -1) 292 | return -1; 293 | 294 | /* 295 | * Se devuelve el descriptor en el que esta "enchufado" el cliente. 296 | */ 297 | return Hijo; 298 | } 299 | 300 | /* 301 | * Abre un socket servidor de tipo AF_INET. Devuelve el descriptor 302 | * del socket o -1 si hay probleamas 303 | * Se pasa como parametro el nombre del servicio. Debe estar dado 304 | * de alta en el fichero /etc/services 305 | */ 306 | int Abre_Socket_Inet (char *Servicio) 307 | { 308 | struct sockaddr_in Direccion; 309 | struct sockaddr Cliente; 310 | socklen_t Longitud_Cliente; 311 | struct servent *Puerto; 312 | int Descriptor; 313 | //printf("Variables inicializadas"); 314 | /* 315 | * se abre el socket 316 | */ 317 | Descriptor = socket (AF_INET, SOCK_STREAM, 0); 318 | if (Descriptor == -1) 319 | return -1; 320 | //printf("Socket abierto"); 321 | /* 322 | * Se obtiene el servicio del fichero /etc/services 323 | */ 324 | /*Puerto = getservbyname ("www", "tcp"); 325 | Puerto->s_name="divelnet"; 326 | Puerto->s_port=6996;*/ 327 | //{"Divel Server Net";NULL;6996;"tcp";} 328 | 329 | //Puerto->s_port=6996; 330 | //Puerto==6996; //Cambiar para tener puertos variables 331 | //if (Puerto == NULL) 332 | //return -1; 333 | //printf("Servicio obtenido"); 334 | /* 335 | * Se rellenan los campos de la estructura Direccion, necesaria 336 | * para la llamada a la funcion bind() 337 | */ 338 | Direccion.sin_family = AF_INET; 339 | Direccion.sin_port = 6996;//6996;//Puerto->s_port; 340 | Direccion.sin_addr.s_addr =INADDR_ANY; 341 | //printf("Estrucura completa"); 342 | if (bind ( 343 | Descriptor, 344 | (struct sockaddr *)&Direccion, 345 | sizeof (Direccion)) == -1) 346 | { 347 | close (Descriptor); 348 | return -1; 349 | } 350 | //printf("Visible"); 351 | /* 352 | * Se avisa al sistema que comience a atender llamadas de clientes 353 | */ 354 | if (listen (Descriptor, 1) == -1) 355 | { 356 | close (Descriptor); 357 | return -1; 358 | } 359 | //printf("Empezando a atender llamadas de clientes\n"); 360 | /* 361 | * Se devuelve el descriptor del socket servidor 362 | */ 363 | return Descriptor; 364 | } 365 | -------------------------------------------------------------------------------- /source/DUP.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * DUP_xpm[] = { 3 | "64 64 117 2", 4 | " c None", 5 | ". c #2762E8", 6 | "+ c #9CB7F4", 7 | "@ c #BDCFF8", 8 | "# c #DEE7FB", 9 | "$ c #EEF2FD", 10 | "% c #F6F8FE", 11 | "& c #FAFBFE", 12 | "* c #E1E9FB", 13 | "= c #C3D3F8", 14 | "- c #A5BDF5", 15 | "; c #87A8F2", 16 | "> c #4D7DEC", 17 | ", c #FFFFFF", 18 | "' c #BCCEF7", 19 | ") c #DDE6FB", 20 | "! c #EDF2FD", 21 | "~ c #F5F8FE", 22 | "{ c #FCFDFE", 23 | "] c #D7E2FA", 24 | "^ c #C0D1F8", 25 | "/ c #A6BEF5", 26 | "( c #5986ED", 27 | "_ c #FDFDFE", 28 | ": c #B1C6F6", 29 | "< c #4276EA", 30 | "[ c #D8E3FA", 31 | "} c #7298F0", 32 | "| c #A0BAF4", 33 | "1 c #FEFEFE", 34 | "2 c #759BF0", 35 | "3 c #336BE9", 36 | "4 c #2C65E8", 37 | "5 c #2863E8", 38 | "6 c #3B70EA", 39 | "7 c #5886ED", 40 | "8 c #769BF0", 41 | "9 c #A4BDF5", 42 | "0 c #8AAAF2", 43 | "a c #376EE9", 44 | "b c #3169E9", 45 | "c c #2963E8", 46 | "d c #2E67E8", 47 | "e c #3D72EA", 48 | "f c #5885ED", 49 | "g c #94B1F3", 50 | "h c #E5ECFC", 51 | "i c #4779EB", 52 | "j c #5382EC", 53 | "k c #376DE9", 54 | "l c #CCDAF9", 55 | "m c #A3BCF5", 56 | "n c #BED0F8", 57 | "o c #E0E8FB", 58 | "p c #3068E8", 59 | "q c #628DEE", 60 | "r c #D1DDFA", 61 | "s c #3E73EA", 62 | "t c #F3F6FD", 63 | "u c #366DE9", 64 | "v c #95B2F3", 65 | "w c #89A9F2", 66 | "x c #648EEE", 67 | "y c #CDDBF9", 68 | "z c #6D95EF", 69 | "A c #386EE9", 70 | "B c #CFDCF9", 71 | "C c #9DB8F4", 72 | "D c #497BEB", 73 | "E c #D8E2FA", 74 | "F c #356CE9", 75 | "G c #4175EA", 76 | "H c #5F8BEE", 77 | "I c #99B5F4", 78 | "J c #E7EDFC", 79 | "K c #5C88ED", 80 | "L c #2F68E8", 81 | "M c #7A9EF0", 82 | "N c #789DF0", 83 | "O c #6C94EF", 84 | "P c #2D66E8", 85 | "Q c #FBFCFE", 86 | "R c #EBF0FC", 87 | "S c #C6D5F8", 88 | "T c #A7BFF5", 89 | "U c #5A87ED", 90 | "V c #4678EB", 91 | "W c #487AEB", 92 | "X c #D0DDFA", 93 | "Y c #618CEE", 94 | "Z c #638EEE", 95 | "` c #CEDBF9", 96 | " . c #B2C7F6", 97 | ".. c #B5C9F7", 98 | "+. c #AFC5F6", 99 | "@. c #4578EB", 100 | "#. c #7399F0", 101 | "$. c #6F96EF", 102 | "%. c #2B65E8", 103 | "&. c #3A70EA", 104 | "*. c #F9FBFE", 105 | "=. c #8CABF2", 106 | "-. c #92B0F3", 107 | ";. c #4F7FEC", 108 | ">. c #8FADF3", 109 | ",. c #D4E0FA", 110 | "'. c #5E8AED", 111 | "). c #B3C8F6", 112 | "!. c #E2EAFB", 113 | "~. c #5180EC", 114 | "{. c #EEF3FD", 115 | "]. c #F7F9FE", 116 | "^. c #C4D4F8", 117 | "/. c #88A8F2", 118 | "(. c #4D7EEC", 119 | "_. c #326AE9", 120 | ":. c #85A6F2", 121 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 122 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 123 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 124 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 125 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 126 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 127 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 128 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 129 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 130 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 131 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 132 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 133 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 134 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 135 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 136 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 137 | ". . . + @ # $ % & * = - ; > . . . . . . . . . . . , , , . . . . . . . . . , , , . . . . . . + ' ) ! ~ { ! ] ^ / ( . . . . . . . ", 138 | ". . . , , , , , , , , , , _ : < . . . . . . . . . , , , . . . . . . . . . , , , . . . . . . , , , , , , , , , , , [ } . . . . . ", 139 | ". . . , , , , , , , , , , , , & | . . . . . . . . , , , . . . . . . . . . , , , . . . . . . , , , , , , , , , , , , 1 2 . . . . ", 140 | ". . . , , , 3 4 5 6 7 8 9 & , , , 0 . . . . . . . , , , . . . . . . . . . , , , . . . . . . , , , a b c d e f g h , , & ( . . . ", 141 | ". . . , , , . . . . . . . i ^ , , & j . . . . . . , , , . . . . . . . . . , , , . . . . . . , , , . . . . . . . k l , , m . . . ", 142 | ". . . , , , . . . . . . . . . n , , o p . . . . . , , , . . . . . . . . . , , , . . . . . . , , , . . . . . . . . q , , r . . . ", 143 | ". . . , , , . . . . . . . . . s t , , q . . . . . , , , . . . . . . . . . , , , . . . . . . , , , . . . . . . . . u , , t . . . ", 144 | ". . . , , , . . . . . . . . . . v , , w . . . . . , , , . . . . . . . . . , , , . . . . . . , , , . . . . . . . . x , , y . . . ", 145 | ". . . , , , . . . . . . . . . . z , , : . . . . . , , , . . . . . . . . . , , , . . . . . . , , , . . . . . . . A B , , C . . . ", 146 | ". . . , , , . . . . . . . . . . D , , E . . . . . , , , . . . . . . . . . , , , . . . . . . , , , . . c F G H I J , , _ K . . . ", 147 | ". . . , , , . . . . . . . . . . L , , ~ . . . . . , , , . . . . . . . . . , , , . . . . . . , , , , , , , , , , , , 1 M . . . . ", 148 | ". . . , , , . . . . . . . . . . D , , E . . . . . , , , . . . . . . . . . , , , . . . . . . , , , , , , , , , , , * N . . . . . ", 149 | ". . . , , , . . . . . . . . . . O , , : . . . . . , , , P . . . . . . . P , , , . . . . . . , , , , , Q R [ S T U . . . . . . . ", 150 | ". . . , , , . . . . . . . . . . v , , w . . . . . $ , , V . . . . . . . W , , ! . . . . . . , , , . . . . . . . . . . . . . . . ", 151 | ". . . , , , . . . . . . . . . e t , , q . . . . . X , , Y . . . . . . . Z , , ` . . . . . . , , , . . . . . . . . . . . . . . . ", 152 | ". . . , , , . . . . . . . . . ' , , o p . . . . . ., , .. . . . . . . .., , +.. . . . . . , , , . . . . . . . . . . . . . . . ", 153 | ". . . , , , . . . . . . . @.@ , , & j . . . . . . #., , 1 U . . . . . U 1 , , $.. . . . . . , , , . . . . . . . . . . . . . . . ", 154 | ". . . , , , 3 %.. &.f 2 m *., , , =.. . . . . . . 5 [ , , & -.;.p > >.*., , ,.. . . . . . . , , , . . . . . . . . . . . . . . . ", 155 | ". . . , , , , , , , , , , , , Q m 5 . . . . . . . . Y & , , , , , , , , , *.'.. . . . . . . , , , . . . . . . . . . . . . . . . ", 156 | ". . . , , , , , , , , , , 1 ).@.. . . . . . . . . . . j !., , , , , , , # ~.. . . . . . . . , , , . . . . . . . . . . . . . . . ", 157 | ". . . C n # {.].& !.^./ /.(.. . . . . . . . . . . . . . _.:.+.E ~ E +.:.b . . . . . . . . . , , , . . . . . . . . . . . . . . . ", 158 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 159 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 160 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 161 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 162 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 163 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 164 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 165 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 166 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 167 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 168 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 169 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 170 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 171 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 172 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 173 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 174 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 175 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 176 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 177 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 178 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 179 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 180 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 181 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 182 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 183 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", 184 | ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "}; 185 | -------------------------------------------------------------------------------- /source/inicio.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////// 2 | ///AZPAZETA 1.0 3 | ////////////////////////////////////////////////////////// 4 | //Azpazeta es el juego de comerciantes medievales de Divel Games 5 | ///////////////////////////////////////////////////////////// 6 | //Versión en Español 7 | /////////////////////////////////////////////////////////// 8 | //Versión adaptada especialmente para Ubuntu 9 | ///////////////////////////////////////////////////////////// 10 | //Menú de juego 11 | ///////////////////////////////////////////////////////////// 12 | // 13 | // 14 | static char *Id="$Id$"; 15 | static char *Author="$Author$"; 16 | int AZPServer; 17 | extern int money, level, city, mision, aux, droga, blacklist, sobornos, socio, electro, food, textil,rich, prima; 18 | typedef struct AZPServerData{int level;int money;int city;char* name;int mision;int aux; int droga;int blacklist;int sobornos;int socio;int electro;int food;int textil;int rich;} AZPServerData; 19 | typedef struct MyEstado{bool bien;int moneyotro;} MyEstado; 20 | #include "inicio.hpp" 21 | 22 | 23 | 24 | #define ARRIBA 1 25 | #define ABAJO 2 26 | #define DERECHA 3 27 | #define IZQUIERDA 4 28 | #define GOLEFT adrx-=5;RenderLeft(dc); 29 | #define GORIGHT adrx+=5;RenderRight(dc); 30 | #define GOUP adry-=5;RenderUp(dc); 31 | #define GODOWN adry+=5;RenderDown(dc); 32 | // ---------------------------------------------------------------------------- 33 | // event tables and other macros for wxWidgets 34 | // ---------------------------------------------------------------------------- 35 | // the event tables connect the wxWidgets events with the functions (event 36 | // handlers) which process them. It can be also done at run-time, but for the 37 | // simple menu events like this the static method is much simpler. 38 | BEGIN_EVENT_TABLE(MyFrame, wxFrame) 39 | EVT_MENU(Minimal_Quit, MyFrame::OnQuit) 40 | EVT_MENU(Minimal_About, MyFrame::OnAbout) 41 | EVT_MENU(ID_ACTUALIZAR, MyFrame::OnActualizar) 42 | EVT_MENU(ID_NET, MyFrame::OnNet) 43 | EVT_MENU(ID_AZPCLIENTE, MyFrame::AZPCliente) 44 | EVT_MENU(ID_INSTRUCCIONES, MyFrame::OnInstrucciones) 45 | EVT_MENU(ID_NEWGAME, MyFrame::NewGame) 46 | EVT_MENU(ID_MODS, MyFrame::CheckearMods) 47 | EVT_KEY_DOWN(MyFrame::OnTecla) 48 | EVT_TIMER(TIMER_ID, MyFrame::ComprobarMulti) 49 | END_EVENT_TABLE() 50 | 51 | // Create a new application object: this macro will allow wxWidgets to create 52 | // the application object during program execution (it's better than using a 53 | // static object for many reasons) and also implements the accessor function 54 | // wxGetApp() which will return the reference of the right type (i.e. MyApp and 55 | // not wxApp) 56 | IMPLEMENT_APP(MyApp) 57 | 58 | // ============================================================================ 59 | // implementation 60 | // ============================================================================ 61 | 62 | // ---------------------------------------------------------------------------- 63 | // the application class 64 | // ---------------------------------------------------------------------------- 65 | extern int x, y, adrx, adry, mision, city,aux; 66 | extern char name; 67 | extern wxString newname; 68 | int fachada, menu; 69 | // 'Main program' equivalent: the program execution "starts" here 70 | bool MyApp::OnInit() 71 | { 72 | wxInitAllImageHandlers(); 73 | wxBitmap splashbitmap; 74 | if (splashbitmap.LoadFile("/opt/extras.ubuntu.com/azpazeta/media/splash.png", wxBITMAP_TYPE_PNG)) 75 | { 76 | wxSplashScreen* splash = new wxSplashScreen(splashbitmap, 77 | wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 78 | 6000, NULL, -1, wxDefaultPosition, wxSize(400,400), 79 | wxSIMPLE_BORDER|wxSTAY_ON_TOP); 80 | } 81 | wxYield(); 82 | //ChrTaskBarIcon* icon = new ChrTaskBarIcon(); 83 | // call the base class initialization method, currently it only parses a 84 | // few common command-line options but it could be do more in the future 85 | if ( !wxApp::OnInit() ) 86 | return false; 87 | SetAppName(wxT("Azpazeta")); 88 | SetVendorName(wxT("Adrian Arroyo Calle para Divel")); 89 | if(wxApp::argc>=2){ 90 | fachada=1; 91 | wxString archivo=wxApp::argv[1].mb_str(); 92 | //int* newsavedlg=new SaveDialog::Cargar(wxString archivo); 93 | SaveDialog* newsavedlg=new SaveDialog(); 94 | newsavedlg->Cargar(archivo); 95 | newsavedlg->Destroy(); 96 | MyFrame *frame = new MyFrame("Azpazeta"); 97 | frame->Show(true); 98 | frame->Load(); 99 | frame->Paint(); 100 | //if(city==4){MyFrame::Stage4();} 101 | 102 | 103 | }else{ MyFrame *frame = new MyFrame("Azpazeta"); 104 | frame->Show(true); 105 | frame->OnJugar(); 106 | frame->Paint();} 107 | 108 | 109 | // create the main application window 110 | 111 | // and show it (the frames, unlike simple controls, are not shown when 112 | // created initially) 113 | 114 | 115 | 116 | 117 | // success: wxApp::OnRun() will be called which will enter the main message 118 | // loop and the application will run. If we returned false here, the 119 | // application would exit immediately. 120 | return true; 121 | } 122 | 123 | // ---------------------------------------------------------------------------- 124 | // main frame 125 | // ---------------------------------------------------------------------------- 126 | 127 | // frame constructor 128 | MyFrame::MyFrame(const wxString& title) 129 | : wxFrame(NULL, wxID_ANY, title) 130 | { 131 | // set the frame icon 132 | SetIcon(wxICON(Icono64)); 133 | /*FILE* PointMash; 134 | PointMash=fopen("/usr/share/Azpazeta/Res.cfg","r"); 135 | if(PointMash){ 136 | fscanf(PointMash,"RES=%d:%d",&x,&y); 137 | SetSize(x,y); 138 | adrx=x/2; 139 | adry=y/2; 140 | fclose(PointMash); 141 | }else{wxMessageBox(wxT("No se ha encontrado archivo de resolución PointMash en: /usr/share/Azpazeta/Res.cfg"),wxT("Error 201"),wxICON_ERROR|wxOK);SetSize(800,600); x=800; y=600;}*/ 142 | SetSize(800, 600); x=800; y=600; 143 | dcpanel=new wxPanel(this,-1,-1,800,600); 144 | wxInitAllImageHandlers(); 145 | /*wxImage portada("/usr/share/Azpazeta/media/Portada.png", wxBITMAP_TYPE_PNG); 146 | wxImage portadaSize; 147 | portadaSize=portada.Scale(x/2,y/2); 148 | portadaSize.SaveFile("/usr/share/Azpazeta/media/newres/Portada.png",wxBITMAP_TYPE_PNG); 149 | wxBitmap portadaBMP("/usr/share/Azpazeta/media/newres/Portada.png", wxBITMAP_TYPE_PNG);*/ 150 | /*wxBitmap portadaBMP("/opt/extras.ubuntu.com/azpazeta/media/inicio.png", wxBITMAP_TYPE_PNG); 151 | Portada = new wxStaticBitmap(panel, ID_DIBUJO, portadaBMP, wxPoint(-1,-1)); 152 | if(fachada!=1){ 153 | actualizar=new wxButton(panel, ID_ACTUALIZAR, wxT("Actualizar juego"), wxPoint(100,500)); 154 | jugar=new wxButton(panel, ID_JUGAR, wxT("Cargar partida"), wxPoint(250,500)); 155 | instrucciones=new wxButton(panel, ID_INSTRUCCIONES, wxT("Instrucciones"), wxPoint(400,500));} 156 | 157 | Connect(ID_JUGAR, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MyFrame::OnJugar)); 158 | Connect(ID_USER, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MyFrame::OnInstrucciones)); 159 | Connect(ID_ACTUALIZAR, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MyFrame::OnActualizar));*/ 160 | //dcpanel->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MyFrame::OnTecla),NULL, this); 161 | //dcpanel->Connect(wxEVT_CHAR, wxKeyEventHandler(MyFrame::OnTecla),NULL, this); 162 | 163 | #if wxUSE_MENUS 164 | // create a menu bar 165 | fileMenu = new wxMenu; 166 | 167 | // the "About" item should be in the help menu 168 | helpMenu = new wxMenu; 169 | helpMenu->Append(ID_INSTRUCCIONES, "&Instrucciones", "Instrucciones sobre Azpazeta"); 170 | helpMenu->Append(Minimal_About, "A&cerca\tF1", "Acerca de Azpazeta"); 171 | fileMenu->Append(ID_AZPCLIENTE, "&Conectar con server", "Jugar multijugador"); 172 | fileMenu->Append(ID_NEWGAME, "&Nuevo juego","Nueva partida"); 173 | fileMenu->Append(ID_MODS, "C&heckear mods","Comprueba los mods instalados"); 174 | fileMenu->Append(ID_ACTUALIZAR, "A&ctualizar", "Actualizar Azpazeta"); 175 | fileMenu->Append(ID_NET, "&Mas productos de Divel", "Mas productos de Divel"); 176 | fileMenu->Append(Minimal_Quit, "&Salir\tAlt-X", "Salir sin guardar"); 177 | 178 | // now append the freshly created menu to the menu bar... 179 | menuBar = new wxMenuBar(); 180 | menuBar->Append(fileMenu, "&Archivo"); 181 | menuBar->Append(helpMenu, "A&yuda"); 182 | 183 | // ... and attach this menu bar to the frame 184 | //SetMenuBar(menuBar); //Hacer funcionar con tecla ALT-Estilo Windows 7 185 | #endif // wxUSE_MENUS 186 | 187 | #if wxUSE_STATUSBAR 188 | // create a status bar just for fun (by default with 1 pane only) 189 | CreateStatusBar(2); 190 | SetStatusText("Azpazeta 1.0 Sin comprobar actualizaciones"); 191 | //Pantalla Completa, implementar en futuras versiones//ShowFullScreen(true, wxFULLSCREEN_ALL); 192 | #endif // wxUSE_STATUSBAR 193 | 194 | } 195 | 196 | 197 | // event handlers 198 | 199 | 200 | 201 | void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) 202 | { 203 | // true is to force the frame to close 204 | Close(true); 205 | } 206 | 207 | void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) 208 | { 209 | /*wxMessageBox(wxString::Format 210 | ( 211 | "Bienvenido a Azpazeta!\n" 212 | "\n" 213 | "El juego de estrategia comercial\n" 214 | "funcionando sobre %s.\n\n" 215 | "Para mas juegos y productos visite:\n sites.google.com/site/divelmedia\n" 216 | "Este juego ha sido disenado por Adrian Arroyo Calle", 217 | wxGetOsDescription() 218 | ), 219 | "Acerca de Azpazeta", 220 | wxOK | wxICON_INFORMATION, 221 | this);*/ 222 | wxAboutDialogInfo aboutInfo; 223 | aboutInfo.SetName("Azpazeta"); 224 | aboutInfo.SetVersion("1.0"); 225 | aboutInfo.SetDescription(_("The game of strategy and economics by Divel")); 226 | aboutInfo.SetCopyright("(C) 2012"); 227 | aboutInfo.SetWebSite("http://sites.google.com/site/divelmedia"); 228 | aboutInfo.AddDeveloper("Adrián Arroyo Calle"); 229 | aboutInfo.AddTranslator("Adrián Arroyo Calle and Google Translate"); 230 | aboutInfo.AddArtist("Adrián Arroyo Calle and GIMP"); 231 | 232 | wxAboutBox(aboutInfo); 233 | } 234 | 235 | void MyFrame::OnNet(wxCommandEvent& WXUNUSED(event)) 236 | { 237 | //DEBUG MODE 238 | wxShell("firefox http://sites.google.com/site/divelstore"); 239 | } 240 | void MyFrame::OnActualizar(wxCommandEvent& WXUNUSED(event)) 241 | { 242 | wxShell("update-manager -d");//Solo Ubuntu 243 | /* 244 | AZPUpdater* azpupdater; 245 | azpupdater=new AZPUpdater(); 246 | azpupdater->CheckUpdates();*/ 247 | } 248 | void MyFrame::OnInstrucciones(wxCommandEvent& WXUNUSED(event)) 249 | { 250 | wxShell("firefox http://sites.google.com/site/divelmedia"); //meter un pdf 251 | } 252 | void MyFrame::OnJugar() 253 | { 254 | SetMenuBar(menuBar); 255 | srand(time(NULL)); 256 | int tip=rand()%5+1; 257 | switch(tip){ 258 | case 1: wxMessageBox(/*"Do you know that you can press ALT and access to the menus?"*/"Sabes que puedes acceder a los menus presionando ALT?","Today's tip", wxICON_INFORMATION|wxOK);break; 259 | case 2: wxMessageBox(/*"Do you know that you can access to a Azpazeta Server and play with one friend?"*/"Sabes que puedes acceder a un server de Azpazeta y jugar con un amigo?","Today's tip", wxICON_INFORMATION|wxOK);break; 260 | case 3: wxMessageBox(/*"Do you know that you can execute AZPServer and you have a Azpazeta Server?"*/"Sabes que si ejecutas AZPServer.exe, tienes un server de Azpazeta?","Today's tip", wxICON_INFORMATION|wxOK);break; 261 | case 4: wxMessageBox(/*"Do you know that you can play also in Windows"*/"Sabes que puedes jugar tambien en Linux?","Today's tip", wxICON_INFORMATION|wxOK);break; 262 | case 5: wxMessageBox(/*"Do you know that you can colaborate in launchpad.net/azpazeta"*/"Sabes que puedes colaborar en launchpad.net/azpazeta","Today's tip", wxICON_INFORMATION|wxOK);break; 263 | } 264 | //wxSound("/usr/share/Azpazeta/audio/Hip-hop.wav").Play(wxSOUND_ASYNC|wxSOUND_LOOP); 265 | /*FILE* partida; 266 | wxString archivo=wxT("/usr/share/Azpazeta/save/save.azp"); 267 | partida=fopen("/usr/share/Azpazeta/save/save.azp","r"); 268 | if(partida){ 269 | fclose(partida);*/ 270 | char *home; 271 | home=getenv("HOME"); 272 | wxString pathgeneral=wxString::Format("mkdir -p %s/.azpazeta",home); 273 | system(pathgeneral.c_str()); 274 | wxString pathguardar=wxString::Format("%s/.azpazeta/save.azp",home); 275 | FILE* partida; 276 | partida=fopen(pathguardar.c_str(),"r"); 277 | if(partida){ 278 | fclose(partida); 279 | SaveDialog* extrasavedlg=new SaveDialog(); 280 | extrasavedlg->Cargar(pathguardar); 281 | extrasavedlg->Destroy(); 282 | Load(); 283 | }else if(city!=0){ 284 | }else{ 285 | wxMessageBox(wxT("Empezando nueva partida"), wxT("Azpazeta"),wxICON_INFORMATION|wxOK); 286 | newname=wxGetTextFromUser(wxT("Introduce tu nombre para la partida"),wxT("Azpazeta"),wxT("")); 287 | city=1; 288 | MyFrame::Stage1(); 289 | } 290 | } 291 | 292 | void MyFrame::OnTecla(wxKeyEvent& event) 293 | { 294 | int ascii = event.GetKeyCode(); 295 | /*wxBitmap adrixdown("/opt/extras.ubuntu.com/azpazeta/media/Adrix.png", wxBITMAP_TYPE_PNG); 296 | wxBitmap adrixup("/opt/extras.ubuntu.com/azpazeta/media/AdrixUp.png", wxBITMAP_TYPE_PNG); 297 | wxBitmap adrixleft("/opt/extras.ubuntu.com/azpazeta/media/AdrixLeft.png", wxBITMAP_TYPE_PNG); 298 | wxBitmap adrixright("/opt/extras.ubuntu.com/azpazeta/media/AdrixRight.png", wxBITMAP_TYPE_PNG);*/ 299 | wxClientDC dc(dcpanel); 300 | switch(city){ 301 | case 1:{ 302 | switch(ascii) 303 | { 304 | //El primer edificio está a 26 pix-------333pix y 27 piy--------------330 piy 305 | 306 | case WXK_LEFT: //Left 307 | if(adry< 390 && adrx<330){}else{ 308 | adrx-=5; 309 | RenderLeft(dc); 310 | if(adrx<=1 && mision>=6){Stage2();} 311 | } 312 | break; 313 | case WXK_UP: //UP 314 | if(adry< 390 && adrx<330){}else{ 315 | adry-=5; 316 | RenderUp(dc);} 317 | break; 318 | case WXK_RIGHT: //Right 319 | //if(){}else{ 320 | adrx+=5; 321 | RenderRight(dc); 322 | break; 323 | case WXK_DOWN: //Down 324 | //if(/*adry< 330 && adrx<334*/){}else{ 325 | adry+=5; 326 | RenderDown(dc); 327 | break; 328 | case WXK_RETURN: 329 | if(adry<=400 && adrx<180) 330 | {if(adrx>=140){ 331 | switch(mision){ 332 | case 0:{ 333 | RenderUp(dc); 334 | dc.DrawText("Quien eres?\nNo te conozco.\nEres el nuevo?\nPresiona ENTER", wxPoint(625, 470)); 335 | mision++; 336 | break;} 337 | case 1: 338 | RenderUp(dc); 339 | dc.DrawText("Bueno, me presento\nSoy Alfredo\nEl alcalde de Azpazeta\nPresiona ENTER",wxPoint(625,470)); 340 | mision++; 341 | break; 342 | case 2:{ 343 | RenderUp(dc); 344 | wxString completo=wxT("Como te llamas?\n")+newname+wxT("\nBonito nombre\nPresiona ENTER"); 345 | dc.DrawText(completo,wxPoint(625,470)); 346 | mision++; 347 | break;} 348 | case 3: 349 | RenderUp(dc); 350 | dc.DrawText("Te has perdido?\nSupongo que querras casa\nPero no va ser gratis\nPresiona ENTER",wxPoint(625,470)); 351 | mision++; 352 | break; 353 | case 4: 354 | RenderUp(dc); 355 | dc.DrawText("Necesitaras un trabajo\nNo se de que\nEso lo dejo a tu eleccion\nPresiona ENTER",wxPoint(625,470)); 356 | mision++; 357 | break; 358 | case 5: 359 | RenderUp(dc); 360 | dc.DrawText("[Objetivo anadido:\nEncontrar trabajo]\nPista: El pueblo esta a la izquierda",wxPoint(625,470)); 361 | mision++; 362 | break; 363 | }}} 364 | break; 365 | case WXK_ESCAPE: 366 | if(aux==1){SaveDialog* savedlg;savedlg=new SaveDialog();savedlg->ShowModal();savedlg->Destroy();Adrix->Destroy();Load();} 367 | break; 368 | case WXK_TAB: 369 | wxMessageBox(wxT("TAB")); 370 | break; 371 | case WXK_SHIFT:{ 372 | wxString cheat=wxGetTextFromUser(wxT("Introduce el Cheat Code"), wxT("Debug Mode"),wxT("")); 373 | if(cheat==wxT("2")){Stage1();Stage2();}} 374 | break; 375 | case WXK_ALT: 376 | SetMenuBar(menuBar); 377 | break; 378 | }break;} 379 | case 2: 380 | switch(ascii) 381 | { 382 | //El primer edificio está a 26 pix-------333pix y 27 piy--------------330 piy 383 | case WXK_LEFT: 384 | if(adry< 470){}else{ 385 | adrx-=5; 386 | RenderLeft(dc); 387 | if(adrx<=1 && mision==15){Stage3();} 388 | } 389 | break; 390 | case WXK_UP: 391 | if(adry< 470){}else{ 392 | adry-=5; 393 | RenderUp(dc);} 394 | break; 395 | case WXK_RIGHT: 396 | //if(){}else{ 397 | adrx+=5; 398 | RenderRight(dc);//} 399 | break; 400 | case WXK_DOWN: 401 | //if(/*adry< 330 && adrx<334*/){}else{ 402 | adry+=5; 403 | RenderDown(dc); 404 | //} 405 | break; 406 | case WXK_RETURN: 407 | if(adry<=480) 408 | {if(adrx>=108 && adrx<=170){ 409 | switch(mision){ 410 | case 6: 411 | RenderUp(dc); 412 | dc.DrawText("\"El INEM\nSeguro que aqui habra trabajo\nVoy a ver\"\nPresiona ENTER",wxPoint(625,470)); 413 | mision++; 414 | break; 415 | case 7: 416 | RenderUp(dc); 417 | dc.DrawText("Siguiente...\n-Venia a por trabajo\n-Tenemos en la panificadora\nPresiona ENTER",wxPoint(625,470)); 418 | mision++; 419 | break; 420 | case 8: 421 | RenderUp(dc); 422 | dc.DrawText("-Creo que me valdra\n-Siguiente...\n\nPresiona ENTER",wxPoint(625,470)); 423 | mision++; 424 | break; 425 | case 9: 426 | RenderUp(dc); 427 | dc.DrawText("[Objetivo anadido:\nIr a la panificadora]",wxPoint(625,470)); 428 | mision++; 429 | break; 430 | default: 431 | RenderUp(dc); 432 | dc.DrawText("Otra vez tu\nAnda vete para fuera\n",wxPoint(625,470)); 433 | }} 434 | if(adrx>=474 && adrx<=542){ 435 | switch(mision){ 436 | case 10: 437 | RenderUp(dc); 438 | dc.DrawText("(Ruidos)\nPUES SI, IMPORTA\nAnda, vete a...\nPresiona ENTER",wxPoint(625,470)); 439 | mision++; 440 | break; 441 | case 11: 442 | RenderUp(dc); 443 | dc.DrawText("-Y tu quien eres?\n-Vengo por el puesto\n-Ah, sí.\nPresiona ENTER",wxPoint(625,470)); 444 | mision++; 445 | break; 446 | case 12: 447 | RenderUp(dc); 448 | dc.DrawText("Trabajaras de comerciante\nambulante.\nIras por los pueblos\nPresiona ENTER",wxPoint(625,470)); 449 | mision++; 450 | break; 451 | case 13: 452 | RenderUp(dc); 453 | dc.DrawText("Vamos a ver como lo haces\nVe a la plaza de Gorguez\nLleva estos panes\nPresiona ENTER",wxPoint(625,470)); 454 | mision++; 455 | break; 456 | case 14: 457 | RenderUp(dc); 458 | dc.DrawText("[Objetivo anadido:\nVender los panes en Gorguez]\nPista: La estacion de tren\ntiene trenes locales",wxPoint(625,470)); 459 | mision++; 460 | break; 461 | default: 462 | RenderUp(dc); 463 | dc.DrawText("(Esta cerrado)",wxPoint(625,470)); 464 | break; 465 | }}} 466 | 467 | break; 468 | case WXK_ESCAPE: 469 | if(aux==1){SaveDialog* savedlg;savedlg=new SaveDialog();savedlg->ShowModal();savedlg->Destroy();Load();} 470 | break; 471 | case WXK_TAB: 472 | SetMenuBar(menuBar); 473 | break; 474 | case WXK_SHIFT:{ 475 | wxString cheat=wxGetTextFromUser(wxT("Introduce el Cheat Code"), wxT("Debug Mode"),wxT("")); 476 | if(cheat==wxT("2")){Stage1();Stage2();}} 477 | break; 478 | case WXK_ALT: 479 | SetMenuBar(menuBar); 480 | break; 481 | }break; 482 | case 3: 483 | switch(ascii) 484 | { 485 | //El primer edificio está a 26 pix-------333pix y 27 piy--------------330 piy 486 | case WXK_LEFT: 487 | if((adry<156 && adrx<307) || ((adry<383 && adry>200) && adrx<307) || (adry<383 && adrx>503)){if(adrx==504){adrx--; RenderLeft(dc); }}else{ 488 | if(adrx<=1){Stage4();}else{ 489 | GOLEFT} 490 | //if(adrx==1 && mision>=6){Stage2();} 491 | } 492 | break; 493 | case WXK_UP: 494 | if((adry<156 && adrx<307) || ((adry<383 && adry>200) && adrx<307) || (adry<383 && adrx>503)){printf("Valor X=%d Y=%d",adrx, adry);if(adry==199){adry--; RenderUp(dc);}}else{ 495 | if(adry<=5){Stage7();} 496 | GOUP} 497 | break; 498 | case WXK_RIGHT: 499 | if((adry<156 && adrx<307) || ((adry<383 && adry>200) && adrx<307) || (adry<383 && adrx>503)){if(adrx==306){adrx++; RenderRight(dc); }}else{ 500 | if(adrx>=746){Stage2();} 501 | GORIGHT} 502 | break; 503 | case WXK_DOWN: 504 | if((adry<156 && adrx<307) || ((adry<383 && adry>200) && adrx<307) || (adry<383 && adrx>503)){if(adry==382 || adry==155){adry++; RenderDown(dc);}}else{ 505 | GODOWN} 506 | break; 507 | case WXK_RETURN: 508 | //Trenes 509 | if(adry<=427 && (adrx>=633 && adrx<=670)){ 510 | switch(mision){ 511 | case 15: 512 | RenderUp(dc); 513 | dc.DrawText("-Supongo que es la estacion\nVamos a ver como es\nGorguez\nPresiona ENTER",wxPoint(625,470)); 514 | mision++; 515 | break; 516 | default: 517 | wxPrintf("Cargando..."); 518 | TrenDialog* trendlg=new TrenDialog(); 519 | wxPrintf("Mostrando..."); 520 | trendlg->ShowModal(); 521 | trendlg->Destroy(); 522 | Load(); 523 | break; 524 | }} 525 | //Piso franco 526 | if(adry<=196 && (adrx>=156 && adrx<=182)){ 527 | SaveDialog* savedlg; 528 | savedlg=new SaveDialog(); 529 | savedlg->ShowModal(); 530 | savedlg->Destroy(); 531 | Load(); 532 | } 533 | break; 534 | case WXK_ESCAPE: 535 | if(aux==1){SaveDialog* savedlg;savedlg=new SaveDialog();savedlg->ShowModal();savedlg->Destroy();Load();} 536 | break; 537 | case WXK_TAB: 538 | wxMessageBox(wxT("TAB")); 539 | break; 540 | case WXK_SHIFT: 541 | break; 542 | case WXK_ALT: 543 | SetMenuBar(menuBar); 544 | break; 545 | }break; 546 | case 4: 547 | switch(ascii) 548 | { 549 | //366-222 550 | case WXK_LEFT: 551 | if(adrx<=283){}else{ 552 | GOLEFT} 553 | break; 554 | case WXK_UP: 555 | if(adry<=204 && adrx>=474){}else{ 556 | if(adry<=10){Stage5();} 557 | GOUP} 558 | break; 559 | case WXK_RIGHT: 560 | if((adry<=204 && adrx>=475) || (adry>=366 && adrx>=474)){}else{ 561 | if(adrx>=746){Stage3();} 562 | GORIGHT} 563 | break; 564 | case WXK_DOWN: 565 | if(adry>=366 && adrx>=474){}else{ 566 | GODOWN} 567 | break; 568 | case WXK_RETURN: 569 | if((adrx>=616 || adrx<=688) && adry>=360){ 570 | DivelKey* keydlg=new DivelKey(); 571 | keydlg->ShowModal(); 572 | keydlg->Destroy();} 573 | break; 574 | case WXK_ESCAPE: 575 | if(aux==1){SaveDialog* savedlg;savedlg=new SaveDialog();savedlg->ShowModal();savedlg->Destroy();Load();} 576 | break; 577 | case WXK_TAB: 578 | 579 | break; 580 | case WXK_SHIFT: 581 | 582 | break; 583 | case WXK_ALT: 584 | SetMenuBar(menuBar); 585 | break; 586 | }break; 587 | case 5: 588 | switch(ascii) 589 | { 590 | //366-222 591 | case WXK_LEFT: 592 | if(adrx<=362 && (adry<=226 || adry>=399)){}else{ 593 | GOLEFT 594 | 595 | } 596 | break; 597 | case WXK_UP: 598 | if(adrx<=362 && adry<=226){}else{ 599 | if(adry<=5){Stage6();} 600 | GOUP 601 | } //226-362 602 | break; 603 | case WXK_RIGHT: 604 | if(adrx>=545){}else{ 605 | GORIGHT 606 | } 607 | break; 608 | case WXK_DOWN: 609 | if(adrx<=362 && adry>=399){}else{ 610 | if(adry>=540){Stage4();} 611 | GODOWN 612 | }//399-362 613 | break; 614 | case WXK_RETURN: 615 | if((adrx>=154 && adrx<=222) && adry<=230){ 616 | switch(mision){ 617 | default: Police* poldlg=new Police(); 618 | poldlg->ShowModal(); 619 | poldlg->Destroy(); 620 | } 621 | } 622 | break; 623 | case WXK_ESCAPE: 624 | if(aux==1){SaveDialog* savedlg;savedlg=new SaveDialog();savedlg->ShowModal();savedlg->Destroy();Load();} 625 | break; 626 | case WXK_TAB: 627 | 628 | break; 629 | case WXK_SHIFT: 630 | 631 | break; 632 | case WXK_ALT: 633 | SetMenuBar(menuBar); 634 | break; 635 | }break; 636 | case 6: 637 | switch(ascii) 638 | { 639 | //366-222 640 | case WXK_LEFT: 641 | GOLEFT 642 | break; 643 | case WXK_UP: 644 | if(adry<=300){}else{ 645 | GOUP 646 | } 647 | break; 648 | case WXK_RIGHT: 649 | GORIGHT 650 | break; 651 | case WXK_DOWN: 652 | if(adry>=540){ Stage5();} 653 | GODOWN 654 | break; 655 | case WXK_RETURN: 656 | //Entrar en Hipermercado 657 | if(adry<=320 && (adrx>=407 && adrx<=470)){Hiper* hiperdlg; hiperdlg=new Hiper(); hiperdlg->ShowModal();hiperdlg->Destroy();} 658 | break; 659 | case WXK_ESCAPE: 660 | if(aux==1){SaveDialog* savedlg;savedlg=new SaveDialog();savedlg->ShowModal();savedlg->Destroy();Load();} 661 | break; 662 | case WXK_TAB: 663 | 664 | break; 665 | case WXK_SHIFT: 666 | 667 | break; 668 | case WXK_ALT: 669 | SetMenuBar(menuBar); 670 | break; 671 | }break; 672 | case 7: 673 | switch(ascii) 674 | { 675 | //366-222 676 | case WXK_LEFT: 677 | GOLEFT 678 | break; 679 | case WXK_UP: 680 | if(adry<=300){}else{ 681 | GOUP 682 | } 683 | break; 684 | case WXK_RIGHT: 685 | GORIGHT 686 | break; 687 | case WXK_DOWN: 688 | if(adry>=540){Stage3();} 689 | GODOWN 690 | break; 691 | case WXK_RETURN: 692 | if(adry<=302 && (adrx>=382 && adrx<=440)){Golf* golfdlg; golfdlg=new Golf();golfdlg->ShowModal();golfdlg->Destroy();} 693 | break; 694 | case WXK_ESCAPE: 695 | if(aux==1){SaveDialog* savedlg;savedlg=new SaveDialog();savedlg->ShowModal();savedlg->Destroy();Load();} 696 | break; 697 | case WXK_TAB: 698 | 699 | break; 700 | case WXK_SHIFT: 701 | 702 | break; 703 | case WXK_ALT: 704 | SetMenuBar(menuBar); 705 | break; 706 | }break; 707 | case 11: 708 | switch(ascii) 709 | { 710 | //366-222 711 | case WXK_LEFT: 712 | if((adrx<=405 && adry>=405) || (adrx<=150 && adry<=130)){}else{ 713 | GOLEFT 714 | } 715 | break; 716 | case WXK_UP: 717 | if((adrx<=150 && adry<=130) || (adrx>=555 && adry<=340)){}else{ 718 | GOUP 719 | } 720 | break; 721 | case WXK_RIGHT: 722 | if(adrx>=555 && (adry<=340 || adry>=505)){}else{ 723 | GORIGHT 724 | } 725 | break; 726 | case WXK_DOWN: 727 | if((adrx<=405 && adry>=405) || (adrx>=555 && adry>=505)){}else{ 728 | GODOWN 729 | } 730 | break; 731 | case WXK_RETURN: 732 | //Bread&Pan 733 | if(adrx<=102 && adry<=152){ 734 | DialogBox* dlgbox; 735 | dlgbox=new DialogBox(); 736 | dlgbox->ShowModal(); 737 | dlgbox->Destroy(); 738 | } 739 | //Mercado 740 | if((adrx>=665 && adrx<=732) && adry<=358){ 741 | Mercado* merdlg; 742 | merdlg=new Mercado(); 743 | merdlg->ShowModal(); 744 | merdlg->Destroy(); 745 | } 746 | //Estacion de Tren 747 | if((adrx>=665 && adrx<=732) && adry>=498){ 748 | int iraazpazeta=wxMessageBox("Deseas ir a Azpazeta por 50 $?","Train Station",wxYES_NO|wxICON_QUESTION); 749 | if(iraazpazeta==wxYES){ 750 | money-=50; 751 | city=3; 752 | Load(); 753 | } 754 | } 755 | break; 756 | case WXK_ESCAPE: 757 | if(aux==1){SaveDialog* savedlg;savedlg=new SaveDialog();savedlg->ShowModal();savedlg->Destroy();Load();} 758 | break; 759 | case WXK_TAB: 760 | 761 | break; 762 | case WXK_SHIFT: 763 | 764 | break; 765 | case WXK_ALT: 766 | SetMenuBar(menuBar); 767 | break; 768 | }break; 769 | 770 | } 771 | } 772 | 773 | void MyFrame::Stage1() 774 | { wxBitmap adrixdown("/opt/extras.ubuntu.com/azpazeta/media/Adrix.png", wxBITMAP_TYPE_PNG); 775 | wxBitmap cap1dib1("/opt/extras.ubuntu.com/azpazeta/media/1x1.png", wxBITMAP_TYPE_PNG); 776 | wxClientDC maindc(dcpanel); 777 | maindc.DrawBitmap(cap1dib1,wxPoint(-1,-1),true); 778 | maindc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); 779 | city=1; 780 | wxPrintf("Bienvenido a Azpazeta!\nAutor: Adrian Arroyo Calle\nAno: 2012\nJuego certficado por: Divel Games\n"); 781 | } 782 | 783 | void MyFrame::Stage2() 784 | { 785 | wxBitmap adrixdown("/opt/extras.ubuntu.com/azpazeta/media/Adrix.png", wxBITMAP_TYPE_PNG); 786 | wxBitmap inem("/opt/extras.ubuntu.com/azpazeta/media/INEM.png", wxBITMAP_TYPE_PNG); 787 | wxClientDC maindc(dcpanel); 788 | maindc.DrawBitmap(inem,wxPoint(-1,-1),true); 789 | maindc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); 790 | city=2; 791 | } 792 | void MyFrame::Stage3() 793 | { 794 | wxBitmap adrixdown("/opt/extras.ubuntu.com/azpazeta/media/Adrix.png", wxBITMAP_TYPE_PNG); 795 | wxBitmap centro1("/opt/extras.ubuntu.com/azpazeta/media/Centro1.png", wxBITMAP_TYPE_PNG); 796 | wxClientDC maindc(dcpanel); 797 | maindc.DrawBitmap(centro1,wxPoint(-1,-1),true); 798 | maindc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); 799 | city=3; 800 | } 801 | void MyFrame::Stage4() 802 | { 803 | wxBitmap adrixdown("/opt/extras.ubuntu.com/azpazeta/media/Adrix.png", wxBITMAP_TYPE_PNG); 804 | wxBitmap centro2("/opt/extras.ubuntu.com/azpazeta/media/Centro2.png",wxBITMAP_TYPE_PNG); 805 | wxClientDC maindc(dcpanel); 806 | maindc.DrawBitmap(centro2,wxPoint(-1,-1),true); 807 | maindc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); 808 | city=4; 809 | } 810 | void MyFrame::Stage5() 811 | { 812 | wxBitmap adrixdown("/opt/extras.ubuntu.com/azpazeta/media/Adrix.png", wxBITMAP_TYPE_PNG); 813 | wxBitmap centro3("/opt/extras.ubuntu.com/azpazeta/media/Centro3.png", wxBITMAP_TYPE_PNG); 814 | wxClientDC maindc(dcpanel); 815 | maindc.DrawBitmap(centro3,wxPoint(-1,-1),true); 816 | maindc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); 817 | city=5; 818 | } 819 | void MyFrame::Stage6() 820 | { 821 | wxBitmap adrixdown("/opt/extras.ubuntu.com/azpazeta/media/Adrix.png", wxBITMAP_TYPE_PNG); 822 | wxBitmap hiper("/opt/extras.ubuntu.com/azpazeta/media/Hiper.png", wxBITMAP_TYPE_PNG); 823 | wxClientDC maindc(dcpanel); 824 | maindc.DrawBitmap(hiper,wxPoint(-1,-1),true); 825 | maindc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); 826 | city=6; 827 | } 828 | void MyFrame::Stage7() 829 | { 830 | wxBitmap adrixdown("/opt/extras.ubuntu.com/azpazeta/media/Adrix.png", wxBITMAP_TYPE_PNG); 831 | wxBitmap golf("/opt/extras.ubuntu.com/azpazeta/media/Golf.png", wxBITMAP_TYPE_PNG); 832 | wxClientDC maindc(dcpanel); 833 | maindc.DrawBitmap(golf,wxPoint(-1,-1),true); 834 | maindc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); 835 | city=7; 836 | } 837 | void MyFrame::Stage11() 838 | { 839 | wxBitmap adrixdown("/opt/extras.ubuntu.com/azpazeta/media/Adrix.png", wxBITMAP_TYPE_PNG); 840 | wxBitmap gorguez("/opt/extras.ubuntu.com/azpazeta/media/Gorguez.png", wxBITMAP_TYPE_PNG); 841 | wxClientDC maindc(dcpanel); 842 | maindc.DrawBitmap(gorguez,wxPoint(-1,-1),true); 843 | maindc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); 844 | city=11; 845 | } 846 | void MyFrame::Stage12() 847 | { 848 | int granja=wxMessageBox("Quieres comprar materia prima a 50 $?","Granjas Nacionales",wxYES_NO|wxICON_QUESTION); 849 | if(granja==wxYES){ 850 | money-=50; 851 | prima++; 852 | city=3; 853 | Load(); 854 | }else{ 855 | city=3; 856 | Load(); 857 | } 858 | } 859 | void MyFrame::Load() 860 | { 861 | /*actualizar->Destroy(); 862 | jugar->Destroy(); 863 | instrucciones->Destroy();*/ 864 | /*NotifyNotification *n; 865 | notify_init("Azpazeta"); 866 | n = notify_notification_new ("Azpazeta", "Se ha cargado correctamente la partida", NULL); 867 | notify_notification_set_timeout(n, 3000); 868 | if (!notify_notification_show (n, NULL)) { 869 | wxPrintf("Error al enviar notificación.\n"); 870 | }*/ 871 | switch(city){ 872 | case 1: Stage1(); break; 873 | case 2: Stage2(); break; 874 | case 3: Stage3(); break; 875 | case 4: Stage4(); break; 876 | case 5: Stage5(); break; 877 | case 6: Stage6(); break; 878 | case 7: Stage7(); break; 879 | case 11: Stage11(); break; 880 | case 12:Stage12(); break; 881 | default: Stage1(); break; 882 | 883 | } 884 | 885 | } 886 | void MyApp::OnInitCmdLine(wxCmdLineParser& parser) 887 | { 888 | parser.SetDesc (g_cmdLineDesc); 889 | // must refuse '/' as parameter starter or cannot use "/path" style paths 890 | parser.SetSwitchChars (wxT("-")); 891 | } 892 | 893 | bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser) 894 | { 895 | //silent_mode = parser.Found(wxT("s")); 896 | // to get at your unnamed parameters use 897 | wxArrayString files; 898 | for (int i = 0; i < parser.GetParamCount(); i++) 899 | { 900 | files.Add(parser.GetParam(i)); 901 | } 902 | 903 | // and other command line parameters 904 | 905 | // then do what you need with them. 906 | 907 | return true; 908 | } 909 | 910 | void MyFrame::AZPCliente(wxCommandEvent& event) 911 | { 912 | wxMessageBox("Modo experimental\nSe recomienda no usar hasta otras actualizaciones","Divel Network",wxICON_WARNING|wxOK); 913 | int siono=wxMessageBox("Quieres utilizar IPv6?\nSi no se usara IPv4","Divel Network",wxICON_QUESTION|wxYES_NO); 914 | 915 | if(siono==wxNO){ 916 | 917 | char Cadena[1024]; 918 | char ip[1024]; 919 | char nombreCliente1[1024]; 920 | char nombreCliente2[1024]; 921 | wxString wxip=wxGetTextFromUser("Introduce la IP del server de Azpazeta","Divel Network","127.0.0.1"); 922 | strncpy(ip, (const char*)wxip.mb_str(wxConvUTF8), 1023); 923 | struct sockaddr_in Direccion; 924 | struct servent *Puerto; 925 | struct hostent *Host; 926 | Direccion.sin_addr.s_addr=inet_addr(ip); 927 | Direccion.sin_family = AF_INET; 928 | Direccion.sin_port = 6996; 929 | AZPServer = socket (AF_INET, SOCK_STREAM, 0); 930 | connect (AZPServer, (struct sockaddr *)&Direccion, sizeof (Direccion)); 931 | Lee_Socket(AZPServer, Cadena,1024); 932 | wxMessageBox(wxString::Format("%s",Cadena),"Server informa",wxICON_INFORMATION|wxOK); 933 | wxString onlinename=wxGetTextFromUser("Introduce tu nombre online","Divel Network",""); 934 | strncpy(nombreCliente1, (const char*)onlinename.mb_str(wxConvUTF8), 1023); 935 | Escribe_Socket(AZPServer, nombreCliente1, 1024); 936 | Lee_Socket(AZPServer, nombreCliente2, 1024); 937 | wxMessageBox(wxString::Format("El otro jugador es: %s",nombreCliente2),"Divel Network"); 938 | }else{ 939 | //IPv6 940 | char Cadena[1024]; 941 | char ip[1024]; 942 | char nombreCliente1[1024]; 943 | char nombreCliente2[1024]; 944 | wxString wxip=wxGetTextFromUser("Introduce la IPv6 del server de Azpazeta","Divel Network","::1"); 945 | strncpy(ip, (const char*)wxip.mb_str(wxConvUTF8), 1023); 946 | struct sockaddr_in6 Direccion; 947 | struct servent *Puerto; 948 | struct hostent *Host; 949 | //Direccion.sin6_len = sizeof(Direccion); 950 | //unsigned char ipv6[16]="::1"; 951 | inet_pton(PF_INET6, ip,&(Direccion.sin6_addr)); 952 | //Direccion.sin6_addr.s6_addr=inet_pton(); 953 | //Direccion.sin6_addr.s6_addr=inet_addr6(ip); 954 | Direccion.sin6_family = AF_INET6; 955 | Direccion.sin6_port = 6996; 956 | AZPServer = socket (AF_INET6, SOCK_STREAM, 0); 957 | connect (AZPServer, (struct sockaddr *)&Direccion, sizeof (Direccion)); 958 | Lee_Socket(AZPServer, Cadena,1024); 959 | wxMessageBox(wxString::Format("%s",Cadena),"Server informa",wxICON_INFORMATION|wxOK); 960 | wxString onlinename=wxGetTextFromUser("Introduce tu nombre online","Divel Network",""); 961 | strncpy(nombreCliente1, (const char*)onlinename.mb_str(wxConvUTF8), 1023); 962 | Escribe_Socket(AZPServer, nombreCliente1, 1024); 963 | Lee_Socket(AZPServer, nombreCliente2, 1024); 964 | wxMessageBox(wxString::Format("El otro jugador es: %s",nombreCliente2),"Divel Network"); 965 | } 966 | AZPServerData datos; 967 | MyEstado myestado; 968 | datos.money=money; 969 | datos.level=level; 970 | datos.city=city; 971 | datos.name="A"; 972 | datos.droga=droga; 973 | datos.blacklist=blacklist; 974 | datos.socio=socio; 975 | datos.electro=electro; 976 | datos.food=food; 977 | datos.textil=textil; 978 | datos.sobornos=sobornos; 979 | datos.mision=mision; 980 | datos.rich=rich; 981 | write(AZPServer, &datos, sizeof(datos)); 982 | read(AZPServer, &myestado, sizeof(myestado)); 983 | if(myestado.bien==true){wxMessageBox(wxString::Format("Bien, el otro tienen menos, concretamente: %d", myestado.moneyotro));} 984 | if(myestado.bien==false){wxMessageBox(wxString::Format("Mal, el otro tiene mas, concretamente: %d", myestado.moneyotro));} 985 | //close(AZPServer); 986 | wxTimer* timer; 987 | timer=new wxTimer(this, TIMER_ID); 988 | timer->Start(60000, false); 989 | wxMessageBox(wxT("Empezando nueva partida"), wxT("Azpazeta"),wxICON_INFORMATION|wxOK); 990 | newname=wxGetTextFromUser(wxT("Introduce tu nombre para la partida"),wxT("Azpazeta"),wxT("")); 991 | wxBitmap bocadillo("/opt/extras.ubuntu.com/azpazeta/media/Bocadillo.png",wxBITMAP_TYPE_PNG); 992 | Bocadillo=new wxStaticBitmap(panel, ID_DIBUJO, bocadillo, wxPoint(600,450)); 993 | cap1mis1=new wxStaticText(panel, ID_DIBUJO, wxT(CAP1MIS1TEX1), wxPoint(625, 470)); 994 | actualizar=new wxButton(panel, wxID_ANY, "..."); 995 | jugar=new wxButton(panel, wxID_ANY, "..."); 996 | instrucciones=new wxButton(panel, wxID_ANY, "..."); 997 | city=1; 998 | Adrix->Destroy(); 999 | money=2000; 1000 | mision=0; 1001 | level=0; 1002 | MyFrame::Stage1(); 1003 | 1004 | } 1005 | int MyFrame::Lee_Socket (int fd, char *Datos, int Longitud) 1006 | { 1007 | int Leido = 0; 1008 | int Aux = 0; 1009 | 1010 | /* 1011 | * Comprobacion de que los parametros de entrada son correctos 1012 | */ 1013 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 1014 | return -1; 1015 | 1016 | /* 1017 | * Mientras no hayamos leido todos los datos solicitados 1018 | */ 1019 | while (Leido < Longitud) 1020 | { 1021 | Aux = read (fd, Datos + Leido, Longitud - Leido); 1022 | if (Aux > 0) 1023 | { 1024 | /* 1025 | * Si hemos conseguido leer datos, incrementamos la variable 1026 | * que contiene los datos leidos hasta el momento 1027 | */ 1028 | Leido = Leido + Aux; 1029 | } 1030 | else 1031 | { 1032 | /* 1033 | * Si read devuelve 0, es que se ha cerrado el socket. Devolvemos 1034 | * los caracteres leidos hasta ese momento 1035 | */ 1036 | if (Aux == 0) 1037 | return Leido; 1038 | if (Aux == -1) 1039 | { 1040 | /* 1041 | * En caso de error, la variable errno nos indica el tipo 1042 | * de error. 1043 | * El error EINTR se produce si ha habido alguna 1044 | * interrupcion del sistema antes de leer ningun dato. No 1045 | * es un error realmente. 1046 | * El error EGAIN significa que el socket no esta disponible 1047 | * de momento, que lo intentemos dentro de un rato. 1048 | * Ambos errores se tratan con una espera de 100 microsegundos 1049 | * y se vuelve a intentar. 1050 | * El resto de los posibles errores provocan que salgamos de 1051 | * la funcion con error. 1052 | */ 1053 | switch (errno) 1054 | { 1055 | case EINTR: 1056 | case EAGAIN: 1057 | usleep (100); 1058 | break; 1059 | default: 1060 | return -1; 1061 | } 1062 | } 1063 | } 1064 | } 1065 | 1066 | /* 1067 | * Se devuelve el total de los caracteres leidos 1068 | */ 1069 | return Leido; 1070 | } 1071 | 1072 | /* 1073 | * Escribe dato en el socket cliente. Devuelve numero de bytes escritos, 1074 | * o -1 si hay error. 1075 | */ 1076 | int MyFrame::Escribe_Socket (int fd, char *Datos, int Longitud) 1077 | { 1078 | int Escrito = 0; 1079 | int Aux = 0; 1080 | 1081 | /* 1082 | * Comprobacion de los parametros de entrada 1083 | */ 1084 | if ((fd == -1) || (Datos == NULL) || (Longitud < 1)) 1085 | return -1; 1086 | 1087 | /* 1088 | * Bucle hasta que hayamos escrito todos los caracteres que nos han 1089 | * indicado. 1090 | */ 1091 | while (Escrito < Longitud) 1092 | { 1093 | Aux = write (fd, Datos + Escrito, Longitud - Escrito); 1094 | if (Aux > 0) 1095 | { 1096 | /* 1097 | * Si hemos conseguido escribir caracteres, se actualiza la 1098 | * variable Escrito 1099 | */ 1100 | Escrito = Escrito + Aux; 1101 | } 1102 | else 1103 | { 1104 | /* 1105 | * Si se ha cerrado el socket, devolvemos el numero de caracteres 1106 | * leidos. 1107 | * Si ha habido error, devolvemos -1 1108 | */ 1109 | if (Aux == 0) 1110 | return Escrito; 1111 | else 1112 | return -1; 1113 | } 1114 | } 1115 | 1116 | /* 1117 | * Devolvemos el total de caracteres leidos 1118 | */ 1119 | return Escrito; 1120 | } 1121 | void MyFrame::ComprobarMulti(wxTimerEvent& event) 1122 | { 1123 | AZPServerData datos; 1124 | MyEstado myestado; 1125 | datos.money=money; 1126 | datos.level=level; 1127 | datos.city=city; 1128 | datos.name="A"; 1129 | datos.droga=droga; 1130 | datos.blacklist=blacklist; 1131 | datos.socio=socio; 1132 | datos.electro=electro; 1133 | datos.food=food; 1134 | datos.textil=textil; 1135 | datos.sobornos=sobornos; 1136 | datos.mision=mision; 1137 | write(AZPServer, &datos, sizeof(datos)); 1138 | read(AZPServer, &myestado, sizeof(myestado)); 1139 | if(myestado.bien==true){wxMessageBox(wxString::Format("Bien, el otro tienen menos, concretamente: %d", myestado.moneyotro));} 1140 | if(myestado.bien==false){wxMessageBox(wxString::Format("Mal, el otro tiene mas, concretamente: %d", myestado.moneyotro));} 1141 | } 1142 | 1143 | void MyFrame::NewGame(wxCommandEvent& event) 1144 | { 1145 | wxMessageBox(wxT("Empezando nueva partida"), wxT("Azpazeta"),wxICON_INFORMATION|wxOK); 1146 | newname=wxGetTextFromUser(wxT("Introduce tu nombre para la partida"),wxT("Azpazeta"),wxT("")); 1147 | 1148 | city=1; 1149 | money=2000; 1150 | mision=0; 1151 | level=0; 1152 | MyFrame::Stage1(); 1153 | } 1154 | void MyFrame::CheckearMods(wxCommandEvent& event) 1155 | { 1156 | /*ModLoader* modsystem; 1157 | modsystem=new ModLoader(); 1158 | modsystem->CheckMod();*/ 1159 | wxMessageBox("No hay mods instalados"); 1160 | } 1161 | void MyFrame::Paint() 1162 | { 1163 | wxClientDC dc(dcpanel); 1164 | RenderDown(dc); 1165 | } 1166 | void MyFrame::RenderDown(wxDC& dc) 1167 | { 1168 | wxBitmap adrixdown("/opt/extras.ubuntu.com/azpazeta/media/Adrix.png", wxBITMAP_TYPE_PNG); 1169 | dc.DrawText("No se ha renderizado bien",wxPoint(-1,-1)); 1170 | //Dibujar fondo 1171 | switch(city){ 1172 | case 0:{dc.DrawBitmap(adrixdown, wxPoint(adrx,adry),true);} 1173 | case 1:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1174 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1175 | case 2:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/INEM.png",wxBITMAP_TYPE_PNG); 1176 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1177 | case 3:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro1.png",wxBITMAP_TYPE_PNG); 1178 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1179 | case 4:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro2.png",wxBITMAP_TYPE_PNG); 1180 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1181 | case 5:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro3.png",wxBITMAP_TYPE_PNG); 1182 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1183 | case 6:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Hiper.png",wxBITMAP_TYPE_PNG); 1184 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1185 | case 7:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Golf.png",wxBITMAP_TYPE_PNG); 1186 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1187 | case 8:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1188 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1189 | case 9:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1190 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1191 | 1192 | case 10:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1193 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1194 | case 11:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Gorguez.png",wxBITMAP_TYPE_PNG); 1195 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1196 | } 1197 | 1198 | } 1199 | void MyFrame::RenderUp(wxDC& dc) 1200 | { 1201 | #define adrixdown adrixup 1202 | wxBitmap adrixup("/opt/extras.ubuntu.com/azpazeta/media/AdrixUp.png", wxBITMAP_TYPE_PNG); 1203 | dc.DrawText("No se ha renderizado bien",wxPoint(-1,-1)); 1204 | //Dibujar fondo 1205 | switch(city){ 1206 | case 0:{dc.DrawBitmap(adrixdown, wxPoint(adrx,adry),true);} 1207 | case 1:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1208 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1209 | case 2:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/INEM.png",wxBITMAP_TYPE_PNG); 1210 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1211 | case 3:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro1.png",wxBITMAP_TYPE_PNG); 1212 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1213 | case 4:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro2.png",wxBITMAP_TYPE_PNG); 1214 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1215 | case 5:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro3.png",wxBITMAP_TYPE_PNG); 1216 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1217 | case 6:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Hiper.png",wxBITMAP_TYPE_PNG); 1218 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1219 | case 7:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Golf.png",wxBITMAP_TYPE_PNG); 1220 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1221 | case 8:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1222 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1223 | case 9:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1224 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1225 | 1226 | case 10:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1227 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1228 | case 11:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Gorguez.png",wxBITMAP_TYPE_PNG); 1229 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1230 | } 1231 | 1232 | } 1233 | void MyFrame::RenderLeft(wxDC& dc) 1234 | { 1235 | wxBitmap adrixleft("/opt/extras.ubuntu.com/azpazeta/media/AdrixLeft.png", wxBITMAP_TYPE_PNG); 1236 | dc.DrawText("No se ha renderizado bien",wxPoint(-1,-1)); 1237 | #define adrixdown adrixleft 1238 | //Dibujar fondo 1239 | switch(city){ 1240 | case 0:{dc.DrawBitmap(adrixdown, wxPoint(adrx,adry),true);} 1241 | case 1:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1242 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1243 | case 2:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/INEM.png",wxBITMAP_TYPE_PNG); 1244 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1245 | case 3:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro1.png",wxBITMAP_TYPE_PNG); 1246 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1247 | case 4:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro2.png",wxBITMAP_TYPE_PNG); 1248 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1249 | case 5:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro3.png",wxBITMAP_TYPE_PNG); 1250 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1251 | case 6:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Hiper.png",wxBITMAP_TYPE_PNG); 1252 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1253 | case 7:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Golf.png",wxBITMAP_TYPE_PNG); 1254 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1255 | case 8:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1256 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1257 | case 9:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1258 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1259 | 1260 | case 10:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1261 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1262 | case 11:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Gorguez.png",wxBITMAP_TYPE_PNG); 1263 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1264 | } 1265 | 1266 | } 1267 | void MyFrame::RenderRight(wxDC& dc) 1268 | { 1269 | 1270 | wxBitmap adrixright("/opt/extras.ubuntu.com/azpazeta/media/AdrixRight.png", wxBITMAP_TYPE_PNG); 1271 | #define adrixdown adrixright 1272 | dc.DrawText("No se ha renderizado bien",wxPoint(-1,-1)); 1273 | //Dibujar fondo 1274 | switch(city){ 1275 | case 0:{dc.DrawBitmap(adrixdown, wxPoint(adrx,adry),true);} 1276 | case 1:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1277 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1278 | case 2:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/INEM.png",wxBITMAP_TYPE_PNG); 1279 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1280 | case 3:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro1.png",wxBITMAP_TYPE_PNG); 1281 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1282 | case 4:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro2.png",wxBITMAP_TYPE_PNG); 1283 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1284 | case 5:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Centro3.png",wxBITMAP_TYPE_PNG); 1285 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1286 | case 6:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Hiper.png",wxBITMAP_TYPE_PNG); 1287 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1288 | case 7:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Golf.png",wxBITMAP_TYPE_PNG); 1289 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1290 | case 8:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1291 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1292 | case 9:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1293 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1294 | 1295 | case 10:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/1x1.png",wxBITMAP_TYPE_PNG); 1296 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1297 | case 11:{ wxBitmap general("/opt/extras.ubuntu.com/azpazeta/media/Gorguez.png",wxBITMAP_TYPE_PNG); 1298 | dc.DrawBitmap(general,wxPoint(-1,-1),true); dc.DrawBitmap(adrixdown,wxPoint(adrx,adry),true); break;} 1299 | } 1300 | 1301 | } 1302 | --------------------------------------------------------------------------------