Advanced Strategic Command
Functions
pbem-server-interaction.cpp File Reference
#include "pbem-server-interaction.h"
Include dependency graph for pbem-server-interaction.cpp:

Go to the source code of this file.

Functions

size_t ASC_PBEM_writeInternal (void *inboundData, size_t size, size_t nmemb, void *vector)
 file: ASC_PBEM.cpp author: Jade Rogalski license: GPL warranty: none More...
 
int ASC_PBEM_writeBuffer (Uint8 *buffer, const Uint8 *source, int startPos, int bufferSize, int sourceSize)
 
size_t ASC_PBEM_readInternal (Uint8 *outboundBuffer, size_t size, size_t nitems, void *infoStruct)
 
int nmain (int argc, char *argv[])
 

Function Documentation

size_t ASC_PBEM_readInternal ( Uint8 *  outboundBuffer,
size_t  size,
size_t  nitems,
void *  infoStruct 
)
int ASC_PBEM_writeBuffer ( Uint8 *  buffer,
const Uint8 *  source,
int  startPos,
int  bufferSize,
int  sourceSize 
)

Definition at line 35 of file pbem-server-interaction.cpp.

Referenced by ASC_PBEM_readInternal(), and ASC_PBEM::downloadGame().

size_t ASC_PBEM_writeInternal ( void *  inboundData,
size_t  size,
size_t  nmemb,
void *  vector 
)

file: ASC_PBEM.cpp author: Jade Rogalski license: GPL warranty: none

interface between the game asc by Marting Bickel, and the asc pbem server by Jade Rogalski

Definition at line 20 of file pbem-server-interaction.cpp.

int nmain ( int  argc,
char *  argv[] 
)

account erstellen

ASC_PBEM asc_pbem( "http://localhost:8080/ascServer/" ); if( asc_pbem.isUsable() && asc_pbem.createAccount( "user", "password", "a@b.c" ) ) { std::cout << "account erstellt, mail unterwegs\n"; }else { std::cout << "account erstellung fehlgeschlagen\n"; }

account aktivieren

ASC_PBEM asc_pbem( "http://localhost:8080/ascServer/" ); if( asc_pbem.isUsable() && asc_pbem.activateAccount( "user", "code" ) ) { std::cout << "account aktiviert, erwarte freischaltung\n"; }else { std::cout << "account aktivierung fehlgeschlagen\n"; }

upload eines spielstandes;

char* daten = "miau"; int size = strlen( "miau" ) * sizeof( char ); ASCString fileName = "duell-A-1.ascpbm"; int gameID = 1;

ASC_PBEM asc_pbem( "http://localhost:8080/ascServer/" ); if( asc_pbem.isUsable() && asc_pbem.login( "user", "pw" ) ) { if( asc_pbem.uploadFile( fileName, daten, size, gameID ) ) std::cout << "account aktiviert, erwarte freischaltung\n"; }else { std::cout << "account aktivierung fehlgeschlagen\n"; }

download eines spielstandes

ASC_PBEM asc_pbem( "http://localhost:8080/ascServer/" ); if( asc_pbem.isUsable() ) { std::vector<TGameInfo> allGames = asc_pbem.getCurrentGamesInfo( true ); TFileData *download = asc_pbem.downloadGame( allGames[ 0 ] );

if( download == NULL ) { std::cout << "download failed" << std::endl; }else { std::cout << "download worked:" << std::endl; delete download; } }

Definition at line 710 of file pbem-server-interaction.cpp.

References TGameInfo::currentPlayerName, TGameInfo::currentSaveGameName, TGameInfo::currentSlot, TGameInfo::gameID, ASC_PBEM::getBody(), ASC_PBEM::getCurrentGamesInfo(), ASC_PBEM::getHeader(), ASC_PBEM::getStatusCode(), ASC_PBEM::isUsable(), TGameInfo::lastActive, ASC_PBEM::login(), ASC_PBEM::logout(), TGameInfo::name, TGameInfo::projectID, and TGameInfo::turn.