|
@@ -1,6 +1,8 @@
|
|
#include "EditorKlient.h"
|
|
#include "EditorKlient.h"
|
|
#include <Klient.h>
|
|
#include <Klient.h>
|
|
#include "../Karte/EditorKarte.h"
|
|
#include "../Karte/EditorKarte.h"
|
|
|
|
+#include <DateiSystem.h>
|
|
|
|
+#include <M2Datei.h>
|
|
|
|
|
|
using namespace Network;
|
|
using namespace Network;
|
|
using namespace Editor;
|
|
using namespace Editor;
|
|
@@ -75,7 +77,7 @@ int EditorKlient::init()
|
|
if( ret == 3 )
|
|
if( ret == 3 )
|
|
{
|
|
{
|
|
unsigned char l = 0;
|
|
unsigned char l = 0;
|
|
- k->getNachrichtEncrypted( (char*)&l, 1 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
char *err = new char[ l + 1 ];
|
|
char *err = new char[ l + 1 ];
|
|
err[ l ] = 0;
|
|
err[ l ] = 0;
|
|
k->getNachrichtEncrypted( err, l );
|
|
k->getNachrichtEncrypted( err, l );
|
|
@@ -103,7 +105,7 @@ bool EditorKlient::sitzungVerwerfen()
|
|
if( ret == 3 )
|
|
if( ret == 3 )
|
|
{
|
|
{
|
|
unsigned char l = 0;
|
|
unsigned char l = 0;
|
|
- k->getNachrichtEncrypted( (char*)&l, 1 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
char *err = new char[ l + 1 ];
|
|
char *err = new char[ l + 1 ];
|
|
err[ l ] = 0;
|
|
err[ l ] = 0;
|
|
k->getNachrichtEncrypted( err, l );
|
|
k->getNachrichtEncrypted( err, l );
|
|
@@ -131,7 +133,7 @@ bool EditorKlient::sitzungBeenden()
|
|
if( ret == 3 )
|
|
if( ret == 3 )
|
|
{
|
|
{
|
|
unsigned char l = 0;
|
|
unsigned char l = 0;
|
|
- k->getNachrichtEncrypted( (char*)&l, 1 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
char *err = new char[ l + 1 ];
|
|
char *err = new char[ l + 1 ];
|
|
err[ l ] = 0;
|
|
err[ l ] = 0;
|
|
k->getNachrichtEncrypted( err, l );
|
|
k->getNachrichtEncrypted( err, l );
|
|
@@ -157,27 +159,27 @@ bool EditorKlient::saveTeam( const TeamDaten *team )
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
if( ret == 1 )
|
|
if( ret == 1 )
|
|
{
|
|
{
|
|
- k->sendeEncrypted( (char*)&team->id, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->maxPunkte, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->beschleunigung, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->maxStabilität, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->maxEnergie, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->reparatur, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->akkuLeistung, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->laserIntensität, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->laserEffizienz, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->laserTempo, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->wendigkeit, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->antriebEffizienz, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->energieSchild, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->energieSchildEffizienz, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&team->punkte, 4 );
|
|
|
|
|
|
+ k->sendeEncrypted( (char *)& team->id, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->maxPunkte, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->beschleunigung, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->maxStabilität, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->maxEnergie, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->reparatur, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->akkuLeistung, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->laserIntensität, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->laserEffizienz, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->laserTempo, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->wendigkeit, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->antriebEffizienz, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->energieSchild, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->energieSchildEffizienz, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& team->punkte, 4 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
}
|
|
}
|
|
if( ret == 3 )
|
|
if( ret == 3 )
|
|
{
|
|
{
|
|
unsigned char l = 0;
|
|
unsigned char l = 0;
|
|
- k->getNachrichtEncrypted( (char*)&l, 1 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
char *err = new char[ l + 1 ];
|
|
char *err = new char[ l + 1 ];
|
|
err[ l ] = 0;
|
|
err[ l ] = 0;
|
|
k->getNachrichtEncrypted( err, l );
|
|
k->getNachrichtEncrypted( err, l );
|
|
@@ -203,32 +205,32 @@ bool EditorKlient::saveSpieler( const SpielerDaten *spieler )
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
if( ret == 1 )
|
|
if( ret == 1 )
|
|
{
|
|
{
|
|
- k->sendeEncrypted( (char*)&spieler->id, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->pos.x, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->pos.y, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->rot, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->beschleunigung, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->maxStabilität, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->maxEnergie, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->reparatur, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->akkuLeistung, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->laserIntensität, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->laserEffizienz, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->laserTempo, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->wendigkeit, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->antriebEffizienz, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->energieSchild, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->energieSchildEffizienz, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->netzwerk, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->skillPunkte, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->m2d, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&spieler->bild, 4 );
|
|
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->id, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->pos.x, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->pos.y, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->rot, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->beschleunigung, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->maxStabilität, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->maxEnergie, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->reparatur, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->akkuLeistung, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->laserIntensität, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->laserEffizienz, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->laserTempo, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->wendigkeit, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->antriebEffizienz, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->energieSchild, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->energieSchildEffizienz, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->netzwerk, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->skillPunkte, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->m2d, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& spieler->bild, 4 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
}
|
|
}
|
|
if( ret == 3 )
|
|
if( ret == 3 )
|
|
{
|
|
{
|
|
unsigned char l = 0;
|
|
unsigned char l = 0;
|
|
- k->getNachrichtEncrypted( (char*)&l, 1 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
char *err = new char[ l + 1 ];
|
|
char *err = new char[ l + 1 ];
|
|
err[ l ] = 0;
|
|
err[ l ] = 0;
|
|
k->getNachrichtEncrypted( err, l );
|
|
k->getNachrichtEncrypted( err, l );
|
|
@@ -254,24 +256,24 @@ bool EditorKlient::saveObjekt( const ObjektDaten *objekt )
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
if( ret == 1 )
|
|
if( ret == 1 )
|
|
{
|
|
{
|
|
- k->sendeEncrypted( (char*)&objekt->pos.x, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&objekt->pos.y, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&objekt->id, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&objekt->m2d, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&objekt->bild, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&objekt->style, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&objekt->maxStabilität, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&objekt->maxEnergie, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&objekt->energieRadius, 4 );
|
|
|
|
- k->sendeEncrypted( (char*)&objekt->reparatur, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&objekt->akkuLeistung, 8 );
|
|
|
|
- k->sendeEncrypted( (char*)&objekt->team, 1 );
|
|
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->pos.x, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->pos.y, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->id, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->m2d, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->bild, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->style, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->maxStabilität, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->maxEnergie, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->energieRadius, 4 );
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->reparatur, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->akkuLeistung, 8 );
|
|
|
|
+ k->sendeEncrypted( (char *)& objekt->team, 1 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
}
|
|
}
|
|
if( ret == 3 )
|
|
if( ret == 3 )
|
|
{
|
|
{
|
|
unsigned char l = 0;
|
|
unsigned char l = 0;
|
|
- k->getNachrichtEncrypted( (char*)&l, 1 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
char *err = new char[ l + 1 ];
|
|
char *err = new char[ l + 1 ];
|
|
err[ l ] = 0;
|
|
err[ l ] = 0;
|
|
k->getNachrichtEncrypted( err, l );
|
|
k->getNachrichtEncrypted( err, l );
|
|
@@ -297,13 +299,13 @@ bool EditorKlient::deleteObjekt( int id )
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
if( ret == 1 )
|
|
if( ret == 1 )
|
|
{
|
|
{
|
|
- k->sendeEncrypted( (char*)&id, 4 );
|
|
|
|
|
|
+ k->sendeEncrypted( (char *)& id, 4 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
}
|
|
}
|
|
if( ret == 3 )
|
|
if( ret == 3 )
|
|
{
|
|
{
|
|
unsigned char l = 0;
|
|
unsigned char l = 0;
|
|
- k->getNachrichtEncrypted( (char*)&l, 1 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
char *err = new char[ l + 1 ];
|
|
char *err = new char[ l + 1 ];
|
|
err[ l ] = 0;
|
|
err[ l ] = 0;
|
|
k->getNachrichtEncrypted( err, l );
|
|
k->getNachrichtEncrypted( err, l );
|
|
@@ -315,7 +317,52 @@ bool EditorKlient::deleteObjekt( int id )
|
|
return ret == 1;
|
|
return ret == 1;
|
|
}
|
|
}
|
|
|
|
|
|
-bool EditorKlient::loadSpieler( Array< SpielerDaten* > &spieler )
|
|
|
|
|
|
+bool EditorKlient::loadResources( Array< ResourceDaten * > &resources )
|
|
|
|
+{
|
|
|
|
+ Network::Klient *k = klient->beginEditorMessage();
|
|
|
|
+ if( !k )
|
|
|
|
+ {
|
|
|
|
+ error = klient->getLetzterFehler();
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ error = "";
|
|
|
|
+ char ret;
|
|
|
|
+ k->sendeEncrypted( "\xA", 1 );
|
|
|
|
+ k->getNachrichtEncrypted( &ret, 1 );
|
|
|
|
+ if( ret == 1 )
|
|
|
|
+ {
|
|
|
|
+ int anz = 0;
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& anz, 4 );
|
|
|
|
+ for( int i = 0; i < anz; i++ )
|
|
|
|
+ {
|
|
|
|
+ ResourceDaten *resource = new ResourceDaten();
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& resource->id, 4 );
|
|
|
|
+ char len = 0;
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& len, 1 );
|
|
|
|
+ char *path = new char[ len + 1 ];
|
|
|
|
+ path[ len ] = 0;
|
|
|
|
+ k->getNachrichtEncrypted( path, len );
|
|
|
|
+ resource->path = path;
|
|
|
|
+ delete[] path;
|
|
|
|
+ resources.add( resource );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if( ret == 3 )
|
|
|
|
+ {
|
|
|
|
+ unsigned char l = 0;
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
|
+ char *err = new char[ l + 1 ];
|
|
|
|
+ err[ l ] = 0;
|
|
|
|
+ k->getNachrichtEncrypted( err, l );
|
|
|
|
+ error = err;
|
|
|
|
+ delete[] err;
|
|
|
|
+ ret = 0;
|
|
|
|
+ }
|
|
|
|
+ klient->endEditorMessage();
|
|
|
|
+ return ret == 1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+bool EditorKlient::loadSpieler( Array< SpielerDaten * > &spieler )
|
|
{
|
|
{
|
|
Network::Klient *k = klient->beginEditorMessage();
|
|
Network::Klient *k = klient->beginEditorMessage();
|
|
if( !k )
|
|
if( !k )
|
|
@@ -330,37 +377,37 @@ bool EditorKlient::loadSpieler( Array< SpielerDaten* > &spieler )
|
|
if( ret == 1 )
|
|
if( ret == 1 )
|
|
{
|
|
{
|
|
int anz = 0;
|
|
int anz = 0;
|
|
- k->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& anz, 4 );
|
|
for( int i = 0; i < anz; i++ )
|
|
for( int i = 0; i < anz; i++ )
|
|
{
|
|
{
|
|
SpielerDaten *player = new SpielerDaten();
|
|
SpielerDaten *player = new SpielerDaten();
|
|
- k->getNachrichtEncrypted( (char*)&player->id, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->pos.x, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->pos.y, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->rot, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->beschleunigung, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->maxStabilität, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->maxEnergie, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->reparatur, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->akkuLeistung, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->laserIntensität, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->laserEffizienz, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->laserTempo, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->wendigkeit, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->antriebEffizienz, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->energieSchild, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->energieSchildEffizienz, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->netzwerk, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->skillPunkte, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->m2d, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&player->bild, 4 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->id, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->pos.x, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->pos.y, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->rot, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->beschleunigung, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->maxStabilität, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->maxEnergie, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->reparatur, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->akkuLeistung, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->laserIntensität, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->laserEffizienz, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->laserTempo, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->wendigkeit, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->antriebEffizienz, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->energieSchild, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->energieSchildEffizienz, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->netzwerk, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->skillPunkte, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->m2d, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& player->bild, 4 );
|
|
spieler.add( player );
|
|
spieler.add( player );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if( ret == 3 )
|
|
if( ret == 3 )
|
|
{
|
|
{
|
|
unsigned char l = 0;
|
|
unsigned char l = 0;
|
|
- k->getNachrichtEncrypted( (char*)&l, 1 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
char *err = new char[ l + 1 ];
|
|
char *err = new char[ l + 1 ];
|
|
err[ l ] = 0;
|
|
err[ l ] = 0;
|
|
k->getNachrichtEncrypted( err, l );
|
|
k->getNachrichtEncrypted( err, l );
|
|
@@ -372,7 +419,7 @@ bool EditorKlient::loadSpieler( Array< SpielerDaten* > &spieler )
|
|
return ret == 1;
|
|
return ret == 1;
|
|
}
|
|
}
|
|
|
|
|
|
-bool EditorKlient::loadTeams( Array< TeamDaten* > &teams )
|
|
|
|
|
|
+bool EditorKlient::loadTeams( Array< TeamDaten * > &teams )
|
|
{
|
|
{
|
|
Network::Klient *k = klient->beginEditorMessage();
|
|
Network::Klient *k = klient->beginEditorMessage();
|
|
if( !k )
|
|
if( !k )
|
|
@@ -387,32 +434,32 @@ bool EditorKlient::loadTeams( Array< TeamDaten* > &teams )
|
|
if( ret == 1 )
|
|
if( ret == 1 )
|
|
{
|
|
{
|
|
int anz = 0;
|
|
int anz = 0;
|
|
- k->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& anz, 4 );
|
|
for( int i = 0; i < anz; i++ )
|
|
for( int i = 0; i < anz; i++ )
|
|
{
|
|
{
|
|
TeamDaten *team = new TeamDaten();
|
|
TeamDaten *team = new TeamDaten();
|
|
- k->getNachrichtEncrypted( (char*)&team->id, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->maxPunkte, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->beschleunigung, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->maxStabilität, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->maxEnergie, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->reparatur, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->akkuLeistung, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->laserIntensität, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->laserEffizienz, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->laserTempo, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->wendigkeit, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->antriebEffizienz, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->energieSchild, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->energieSchildEffizienz, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&team->punkte, 4 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->id, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->maxPunkte, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->beschleunigung, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->maxStabilität, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->maxEnergie, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->reparatur, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->akkuLeistung, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->laserIntensität, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->laserEffizienz, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->laserTempo, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->wendigkeit, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->antriebEffizienz, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->energieSchild, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->energieSchildEffizienz, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& team->punkte, 4 );
|
|
teams.add( team );
|
|
teams.add( team );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if( ret == 3 )
|
|
if( ret == 3 )
|
|
{
|
|
{
|
|
unsigned char l = 0;
|
|
unsigned char l = 0;
|
|
- k->getNachrichtEncrypted( (char*)&l, 1 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
char *err = new char[ l + 1 ];
|
|
char *err = new char[ l + 1 ];
|
|
err[ l ] = 0;
|
|
err[ l ] = 0;
|
|
k->getNachrichtEncrypted( err, l );
|
|
k->getNachrichtEncrypted( err, l );
|
|
@@ -424,7 +471,7 @@ bool EditorKlient::loadTeams( Array< TeamDaten* > &teams )
|
|
return ret == 1;
|
|
return ret == 1;
|
|
}
|
|
}
|
|
|
|
|
|
-bool EditorKlient::loadObjekte( Array< ObjektDaten* > &objekte )
|
|
|
|
|
|
+bool EditorKlient::loadObjekte( Array< ObjektDaten * > &objekte )
|
|
{
|
|
{
|
|
Network::Klient *k = klient->beginEditorMessage();
|
|
Network::Klient *k = klient->beginEditorMessage();
|
|
if( !k )
|
|
if( !k )
|
|
@@ -439,29 +486,29 @@ bool EditorKlient::loadObjekte( Array< ObjektDaten* > &objekte )
|
|
if( ret == 1 )
|
|
if( ret == 1 )
|
|
{
|
|
{
|
|
int anz = 0;
|
|
int anz = 0;
|
|
- k->getNachrichtEncrypted( (char*)&anz, 4 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& anz, 4 );
|
|
for( int i = 0; i < anz; i++ )
|
|
for( int i = 0; i < anz; i++ )
|
|
{
|
|
{
|
|
ObjektDaten *objekt = new ObjektDaten();
|
|
ObjektDaten *objekt = new ObjektDaten();
|
|
- k->getNachrichtEncrypted( (char*)&objekt->pos.x, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&objekt->pos.y, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&objekt->id, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&objekt->m2d, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&objekt->bild, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&objekt->style, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&objekt->maxStabilität, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&objekt->maxEnergie, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&objekt->energieRadius, 4 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&objekt->reparatur, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&objekt->akkuLeistung, 8 );
|
|
|
|
- k->getNachrichtEncrypted( (char*)&objekt->team, 1 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->pos.x, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->pos.y, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->id, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->m2d, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->bild, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->style, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->maxStabilität, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->maxEnergie, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->energieRadius, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->reparatur, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->akkuLeistung, 8 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& objekt->team, 1 );
|
|
objekte.add( objekt );
|
|
objekte.add( objekt );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if( ret == 3 )
|
|
if( ret == 3 )
|
|
{
|
|
{
|
|
unsigned char l = 0;
|
|
unsigned char l = 0;
|
|
- k->getNachrichtEncrypted( (char*)&l, 1 );
|
|
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
char *err = new char[ l + 1 ];
|
|
char *err = new char[ l + 1 ];
|
|
err[ l ] = 0;
|
|
err[ l ] = 0;
|
|
k->getNachrichtEncrypted( err, l );
|
|
k->getNachrichtEncrypted( err, l );
|
|
@@ -473,12 +520,134 @@ bool EditorKlient::loadObjekte( Array< ObjektDaten* > &objekte )
|
|
return ret == 1;
|
|
return ret == 1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+Bild *EditorKlient::loadBild( const char *templatePath )
|
|
|
|
+{
|
|
|
|
+ Text txt( templatePath );
|
|
|
|
+ Text pfad;
|
|
|
|
+ if( txt.positionVon( "spiel:" ) == 0 )
|
|
|
|
+ {
|
|
|
|
+ pfad = "data/spiele/Asteroids";
|
|
|
|
+ pfad.append( txt.getTeilText( 6 ) );
|
|
|
|
+ if( pfad.hat( ".ltdb/" ) )
|
|
|
|
+ {
|
|
|
|
+ int pos = pfad.positionVon( ".ltdb/", pfad.anzahlVon( ".ltdb/" ) - 1 );
|
|
|
|
+ LTDBDatei datei;
|
|
|
|
+ datei.setDatei( pfad.getTeilText( 0, pos + 5 ) );
|
|
|
|
+ datei.leseDaten( 0 );
|
|
|
|
+ return datei.laden( 0, pfad.getTeilText( pos + 6 ) );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if( txt.positionVon( "map:" ) == 0 )
|
|
|
|
+ {
|
|
|
|
+ pfad.append( txt.getTeilText( 5 ) );
|
|
|
|
+ if( pfad.hat( ".ltdb/" ) )
|
|
|
|
+ {
|
|
|
|
+ if( klient->deResetPath() )
|
|
|
|
+ {
|
|
|
|
+ while( pfad.anzahlVon( "/" ) > 1 )
|
|
|
|
+ {
|
|
|
|
+ Text *name = pfad.getTeilText( 0, pfad.positionVon( "/" ) );
|
|
|
|
+ klient->deOrdnerÖffnen( name );
|
|
|
|
+ pfad.remove( 0, name->getLength() + 1 );
|
|
|
|
+ name->release();
|
|
|
|
+ }
|
|
|
|
+ Text *datei = pfad.getTeilText( 0, pfad.positionVon( ".ltdb/" ) + 5 );
|
|
|
|
+ Text * bild = pfad.getTeilText( pfad.positionVon( ".ltdb/" ) + 6 );
|
|
|
|
+ Bild * res = klient->deBildLaden( datei, bild, 0 );
|
|
|
|
+ datei->release();
|
|
|
|
+ bild->release();
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ error = klient->getLetzterFehler();
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+Model2DData *EditorKlient::loadModel( const char *templatePath )
|
|
|
|
+{
|
|
|
|
+ Text txt( templatePath );
|
|
|
|
+ Text pfad;
|
|
|
|
+ if( txt.positionVon( "spiel:" ) == 0 )
|
|
|
|
+ {
|
|
|
|
+ pfad = "data/spiele/Asteroids";
|
|
|
|
+ pfad.append( txt.getTeilText( 6 ) );
|
|
|
|
+ if( pfad.hat( ".m2/" ) )
|
|
|
|
+ {
|
|
|
|
+ int pos = pfad.positionVon( ".m2/", pfad.anzahlVon( ".m2/" ) - 1 );
|
|
|
|
+ M2Datei datei;
|
|
|
|
+ Text * file = pfad.getTeilText( 0, pos + 3 );
|
|
|
|
+ datei.setPfad( file->getText() );
|
|
|
|
+ file->release();
|
|
|
|
+ datei.leseDaten();
|
|
|
|
+ return datei.ladeModel( pfad.getTeilText( pos + 4 ) );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if( txt.positionVon( "map:" ) == 0 )
|
|
|
|
+ {
|
|
|
|
+ pfad.append( txt.getTeilText( 5 ) );
|
|
|
|
+ if( pfad.hat( ".m2/" ) )
|
|
|
|
+ {
|
|
|
|
+ if( klient->deResetPath() )
|
|
|
|
+ {
|
|
|
|
+ while( pfad.anzahlVon( "/" ) > 1 )
|
|
|
|
+ {
|
|
|
|
+ Text *name = pfad.getTeilText( 0, pfad.positionVon( "/" ) );
|
|
|
|
+ klient->deOrdnerÖffnen( name );
|
|
|
|
+ pfad.remove( 0, name->getLength() + 1 );
|
|
|
|
+ name->release();
|
|
|
|
+ }
|
|
|
|
+ Text *datei = pfad.getTeilText( 0, pfad.positionVon( ".m2/" ) + 3 );
|
|
|
|
+ Text * model = pfad.getTeilText( pfad.positionVon( ".m2/" ) + 4 );
|
|
|
|
+ Model2DData * res = klient->deModelLaden( datei, model, 0 );
|
|
|
|
+ datei->release();
|
|
|
|
+ model->release();
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ error = klient->getLetzterFehler();
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
// Lädt die Spieler Team Struktur
|
|
// Lädt die Spieler Team Struktur
|
|
-bool EditorKlient::getSpielerTeamStruktur( SpielerTeamStrukturV *sts )
|
|
|
|
|
|
+bool EditorKlient::getSpielerTeamStruktur( SpielerTeamStrukturV * sts )
|
|
{
|
|
{
|
|
return klient->ladeTeamDaten( sts );
|
|
return klient->ladeTeamDaten( sts );
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+bool EditorKlient::loadMapSize( Punkt & size )
|
|
|
|
+{
|
|
|
|
+ Network::Klient *k = klient->beginEditorMessage();
|
|
|
|
+ if( !k )
|
|
|
|
+ {
|
|
|
|
+ error = klient->getLetzterFehler();
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ error = "";
|
|
|
|
+ char ret;
|
|
|
|
+ k->sendeEncrypted( "\xB", 1 );
|
|
|
|
+ k->getNachrichtEncrypted( &ret, 1 );
|
|
|
|
+ if( ret == 1 )
|
|
|
|
+ {
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& size.x, 4 );
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& size.y, 4 );
|
|
|
|
+ }
|
|
|
|
+ if( ret == 3 )
|
|
|
|
+ {
|
|
|
|
+ unsigned char l = 0;
|
|
|
|
+ k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
|
+ char *err = new char[ l + 1 ];
|
|
|
|
+ err[ l ] = 0;
|
|
|
|
+ k->getNachrichtEncrypted( err, l );
|
|
|
|
+ error = err;
|
|
|
|
+ delete[] err;
|
|
|
|
+ ret = 0;
|
|
|
|
+ }
|
|
|
|
+ klient->endEditorMessage();
|
|
|
|
+ return ret == 1;
|
|
|
|
+}
|
|
|
|
+
|
|
// Gibt den Letzten Fehler zurück
|
|
// Gibt den Letzten Fehler zurück
|
|
char *EditorKlient::getLastError() const
|
|
char *EditorKlient::getLastError() const
|
|
{
|
|
{
|