|
@@ -27,7 +27,6 @@ void Editor::open()
|
|
|
|
|
|
bool Editor::nachricht( SKlient *k )
|
|
|
{
|
|
|
- /*
|
|
|
err = "";
|
|
|
char n = 0;
|
|
|
k->getNachrichtEncrypted( &n, 1 );
|
|
@@ -51,13 +50,77 @@ bool Editor::nachricht( SKlient *k )
|
|
|
else
|
|
|
return 0;
|
|
|
return 1;
|
|
|
- case 2: // Sitzung speichern unt beenden
|
|
|
+ case 2: // Sitzung speichern und beenden
|
|
|
if( saveSitzung() )
|
|
|
k->sendeEncrypted( "\1", 1 );
|
|
|
else
|
|
|
return 0;
|
|
|
return 1;
|
|
|
- case 3: // Lade Spieler Daten
|
|
|
+ case 3: // Get Size
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/size";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::lesen ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int width;
|
|
|
+ int height;
|
|
|
+ d.lese( (char *)&width, 4 );
|
|
|
+ d.lese( (char *)&height, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&width, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&height, 4 );
|
|
|
+ d.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim laden von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ case 4: // Lade Team Daten
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/team";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ RCArray< Text > *files = d.getDateiListe();
|
|
|
+ if( files )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int anz = files->getEintragAnzahl();
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
+ for( int i = 0; i < anz; i++ )
|
|
|
+ {
|
|
|
+ Text pf = tmpPf;
|
|
|
+ pf += "/";
|
|
|
+ pf += files->z( i )->getText();
|
|
|
+ Datei team;
|
|
|
+ team.setDatei( pf );
|
|
|
+ team.open( Datei::Style::lesen );
|
|
|
+ int id = *files->z( i );
|
|
|
+ int maxWbZeit;
|
|
|
+ int punkte;
|
|
|
+ team.lese( (char *)&maxWbZeit, 4 );
|
|
|
+ team.lese( (char *)&punkte, 4 );
|
|
|
+ team.close();
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&maxWbZeit, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&punkte, 4 );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim laden von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ case 5: // Lade Spieler Daten
|
|
|
{
|
|
|
Text tmpPf = pfad.getText();
|
|
|
tmpPf += "/player";
|
|
@@ -68,7 +131,7 @@ bool Editor::nachricht( SKlient *k )
|
|
|
{
|
|
|
k->sendeEncrypted( "\1", 1 );
|
|
|
int anz = files->getEintragAnzahl();
|
|
|
- k->sendeEncrypted( (char *)& anz, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
Text pf = tmpPf;
|
|
@@ -77,28 +140,15 @@ bool Editor::nachricht( SKlient *k )
|
|
|
Datei player;
|
|
|
player.setDatei( pf );
|
|
|
player.open( Datei::Style::lesen );
|
|
|
- SpielerStr p( player.getThis() );
|
|
|
+ int id = *files->z( i );
|
|
|
+ int spawnX;
|
|
|
+ int spawnY;
|
|
|
+ player.lese( (char *)&spawnX, 4 );
|
|
|
+ player.lese( (char *)&spawnY, 4 );
|
|
|
player.close();
|
|
|
- k->sendeEncrypted( (char *)& p.id, 4 );
|
|
|
- k->sendeEncrypted( (char *)& p.pos.x, 4 );
|
|
|
- k->sendeEncrypted( (char *)& p.pos.y, 4 );
|
|
|
- k->sendeEncrypted( (char *)& p.rot, 8 );
|
|
|
- k->sendeEncrypted( (char *)& p.beschleunigung, 8 );
|
|
|
- k->sendeEncrypted( (char *)& p.maxStability, 4 );
|
|
|
- k->sendeEncrypted( (char *)& p.maxEnergie, 4 );
|
|
|
- k->sendeEncrypted( (char *)& p.reparatur, 8 );
|
|
|
- k->sendeEncrypted( (char *)& p.akkuLeistung, 8 );
|
|
|
- k->sendeEncrypted( (char *)& p.laserIntensity, 4 );
|
|
|
- k->sendeEncrypted( (char *)& p.laserEffizienz, 4 );
|
|
|
- k->sendeEncrypted( (char *)& p.laserTempo, 4 );
|
|
|
- k->sendeEncrypted( (char *)& p.wendigkeit, 8 );
|
|
|
- k->sendeEncrypted( (char *)& p.antriebEffizienz, 8 );
|
|
|
- k->sendeEncrypted( (char *)& p.energieSchild, 8 );
|
|
|
- k->sendeEncrypted( (char *)& p.energieSchildEffizienz, 8 );
|
|
|
- k->sendeEncrypted( (char *)& p.netzwerk, 4 );
|
|
|
- k->sendeEncrypted( (char *)& p.skillPunkte, 4 );
|
|
|
- k->sendeEncrypted( (char *)& p.m2d, 4 );
|
|
|
- k->sendeEncrypted( (char *)& p.bild, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&spawnX, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&spawnY, 4 );
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -109,10 +159,10 @@ bool Editor::nachricht( SKlient *k )
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
- case 4: // Lade Team Daten
|
|
|
+ case 6: // Lade Bariere Daten
|
|
|
{
|
|
|
Text tmpPf = pfad.getText();
|
|
|
- tmpPf += "/team";
|
|
|
+ tmpPf += "/bariere";
|
|
|
Datei d;
|
|
|
d.setDatei( tmpPf );
|
|
|
RCArray< Text > *files = d.getDateiListe();
|
|
@@ -120,32 +170,42 @@ bool Editor::nachricht( SKlient *k )
|
|
|
{
|
|
|
k->sendeEncrypted( "\1", 1 );
|
|
|
int anz = files->getEintragAnzahl();
|
|
|
- k->sendeEncrypted( (char *)& anz, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
Text pf = tmpPf;
|
|
|
pf += "/";
|
|
|
pf += files->z( i )->getText();
|
|
|
- Datei team;
|
|
|
- team.setDatei( pf );
|
|
|
- team.open( Datei::Style::lesen );
|
|
|
- TeamStr t( team.getThis() );
|
|
|
- team.close();
|
|
|
- k->sendeEncrypted( (char *)& t.id, 4 );
|
|
|
- k->sendeEncrypted( (char *)& t.maxPunkte, 4 );
|
|
|
- k->sendeEncrypted( (char *)& t.beschleunigung, 8 );
|
|
|
- k->sendeEncrypted( (char *)& t.maxStability, 4 );
|
|
|
- k->sendeEncrypted( (char *)& t.maxEnergie, 4 );
|
|
|
- k->sendeEncrypted( (char *)& t.reparatur, 8 );
|
|
|
- k->sendeEncrypted( (char *)& t.akkuLeistung, 8 );
|
|
|
- k->sendeEncrypted( (char *)& t.laserIntensity, 4 );
|
|
|
- k->sendeEncrypted( (char *)& t.laserEffizienz, 4 );
|
|
|
- k->sendeEncrypted( (char *)& t.laserTempo, 4 );
|
|
|
- k->sendeEncrypted( (char *)& t.wendigkeit, 8 );
|
|
|
- k->sendeEncrypted( (char *)& t.antriebEffizienz, 8 );
|
|
|
- k->sendeEncrypted( (char *)& t.energieSchild, 8 );
|
|
|
- k->sendeEncrypted( (char *)& t.energieSchildEffizienz, 8 );
|
|
|
- k->sendeEncrypted( (char *)& t.punkte, 4 );
|
|
|
+ Datei object;
|
|
|
+ object.setDatei( pf );
|
|
|
+ object.open( Datei::Style::lesen );
|
|
|
+ int id = *files->z( i );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ int style;
|
|
|
+ int verschiebungWeite;
|
|
|
+ int autoSchaltungMaxTime;
|
|
|
+ int team;
|
|
|
+ object.lese( (char *)&x, 4 );
|
|
|
+ object.lese( (char *)&y, 4 );
|
|
|
+ object.lese( (char *)&breite, 4 );
|
|
|
+ object.lese( (char *)&height, 4 );
|
|
|
+ object.lese( (char *)&style, 4 );
|
|
|
+ object.lese( (char *)&verschiebungWeite, 4 );
|
|
|
+ object.lese( (char *)&autoSchaltungMaxTime, 4 );
|
|
|
+ object.lese( (char *)&team, 4 );
|
|
|
+ object.close();
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&x, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&y, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&breite, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&height, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&style, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&verschiebungWeite, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&autoSchaltungMaxTime, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&team, 4 );
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -156,10 +216,10 @@ bool Editor::nachricht( SKlient *k )
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
- case 5: // Lade Objekt Daten
|
|
|
+ case 7: // Lade Base Daten
|
|
|
{
|
|
|
Text tmpPf = pfad.getText();
|
|
|
- tmpPf += "/objekt";
|
|
|
+ tmpPf += "/base";
|
|
|
Datei d;
|
|
|
d.setDatei( tmpPf );
|
|
|
RCArray< Text > *files = d.getDateiListe();
|
|
@@ -167,7 +227,7 @@ bool Editor::nachricht( SKlient *k )
|
|
|
{
|
|
|
k->sendeEncrypted( "\1", 1 );
|
|
|
int anz = files->getEintragAnzahl();
|
|
|
- k->sendeEncrypted( (char *)& anz, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
Text pf = tmpPf;
|
|
@@ -176,22 +236,39 @@ bool Editor::nachricht( SKlient *k )
|
|
|
Datei object;
|
|
|
object.setDatei( pf );
|
|
|
object.open( Datei::Style::lesen );
|
|
|
- ObjektStr o( object.getThis() );
|
|
|
+ int id = *files->z( i );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ int maxTime;
|
|
|
+ int team;
|
|
|
+ bool showTimer;
|
|
|
+ int timerX;
|
|
|
+ int timerY;
|
|
|
+ int timerFarbe;
|
|
|
+ object.lese( (char *)&x, 4 );
|
|
|
+ object.lese( (char *)&y, 4 );
|
|
|
+ object.lese( (char *)&breite, 4 );
|
|
|
+ object.lese( (char *)&height, 4 );
|
|
|
+ object.lese( (char *)&maxTime, 4 );
|
|
|
+ object.lese( (char *)&team, 4 );
|
|
|
+ object.lese( (char *)&showTimer, 1 );
|
|
|
+ object.lese( (char *)&timerX, 4 );
|
|
|
+ object.lese( (char *)&timerY, 4 );
|
|
|
+ object.lese( (char *)&timerFarbe, 4 );
|
|
|
object.close();
|
|
|
- k->sendeEncrypted( (char *)& o.pos.x, 4 );
|
|
|
- k->sendeEncrypted( (char *)& o.pos.y, 4 );
|
|
|
- k->sendeEncrypted( (char *)& o.rot, 4 );
|
|
|
- k->sendeEncrypted( (char *)& o.scale, 4 );
|
|
|
- k->sendeEncrypted( (char *)& o.id, 4 );
|
|
|
- k->sendeEncrypted( (char *)& o.m2d, 4 );
|
|
|
- k->sendeEncrypted( (char *)& o.bild, 4 );
|
|
|
- k->sendeEncrypted( (char *)& o.style, 4 );
|
|
|
- k->sendeEncrypted( (char *)& o.maxStability, 4 );
|
|
|
- k->sendeEncrypted( (char *)& o.maxEnergie, 4 );
|
|
|
- k->sendeEncrypted( (char *)& o.energieRadius, 4 );
|
|
|
- k->sendeEncrypted( (char *)& o.reparatur, 8 );
|
|
|
- k->sendeEncrypted( (char *)& o.akkuLeistung, 8 );
|
|
|
- k->sendeEncrypted( (char *)& o.team, 1 );
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&x, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&y, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&breite, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&height, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&maxTime, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&team, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&showTimer, 1 );
|
|
|
+ k->sendeEncrypted( (char *)&timerX, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&timerY, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&timerFarbe, 4 );
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -202,140 +279,227 @@ bool Editor::nachricht( SKlient *k )
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
- case 6: // Save Player
|
|
|
+ case 8: // Lade Drop Daten
|
|
|
{
|
|
|
- k->sendeEncrypted( "\1", 1 );
|
|
|
- SpielerStr p( 0 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.id, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.pos.x, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.pos.y, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.rot, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.beschleunigung, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.maxStability, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.maxEnergie, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.reparatur, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.akkuLeistung, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.laserIntensity, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.laserEffizienz, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.laserTempo, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.wendigkeit, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.antriebEffizienz, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.energieSchild, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.energieSchildEffizienz, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.netzwerk, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.skillPunkte, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.m2d, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& p.bild, 4 );
|
|
|
- Text pf = pfad.getText();
|
|
|
- pf += "/player/";
|
|
|
- pf += p.id;
|
|
|
- pf += ".p";
|
|
|
- Datei player;
|
|
|
- player.setDatei( pf );
|
|
|
- if( player.open( Datei::Style::schreiben ) )
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/drop";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ RCArray< Text > *files = d.getDateiListe();
|
|
|
+ if( files )
|
|
|
{
|
|
|
- p.save( player.getThis() );
|
|
|
- player.close();
|
|
|
k->sendeEncrypted( "\1", 1 );
|
|
|
- return 1;
|
|
|
+ int anz = files->getEintragAnzahl();
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
+ for( int i = 0; i < anz; i++ )
|
|
|
+ {
|
|
|
+ Text pf = tmpPf;
|
|
|
+ pf += "/";
|
|
|
+ pf += files->z( i )->getText();
|
|
|
+ Datei object;
|
|
|
+ object.setDatei( pf );
|
|
|
+ object.open( Datei::Style::lesen );
|
|
|
+ int id = *files->z( i );
|
|
|
+ int minX;
|
|
|
+ int minY;
|
|
|
+ int maxX;
|
|
|
+ int maxY;
|
|
|
+ int maxTime;
|
|
|
+ int numDrops;
|
|
|
+ float wahrscheinlichkeit[ ITEMANZAHL ];
|
|
|
+ unsigned char len;
|
|
|
+ object.lese( (char *)&minX, 4 );
|
|
|
+ object.lese( (char *)&minY, 4 );
|
|
|
+ object.lese( (char *)&maxX, 4 );
|
|
|
+ object.lese( (char *)&maxY, 4 );
|
|
|
+ object.lese( (char *)&maxTime, 4 );
|
|
|
+ object.lese( (char *)&numDrops, 4 );
|
|
|
+ for( int i = 0; i < ITEMANZAHL; i++ )
|
|
|
+ object.lese( (char *)&wahrscheinlichkeit[ i ], 4 );
|
|
|
+ object.lese( (char *)&len, 1 );
|
|
|
+ char *name = new char[ len ];
|
|
|
+ object.lese( name, len );
|
|
|
+ object.close();
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&minX, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&minY, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&maxX, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&maxY, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&maxTime, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&numDrops, 4 );
|
|
|
+ for( int i = 0; i < ITEMANZAHL; i++ )
|
|
|
+ k->sendeEncrypted( (char *)&wahrscheinlichkeit[ i ], 4 );
|
|
|
+ k->sendeEncrypted( (char *)&len, 1 );
|
|
|
+ k->sendeEncrypted( name, len );
|
|
|
+ delete[] name;
|
|
|
+ }
|
|
|
}
|
|
|
- err = "Fehler beim Schreiben von ";
|
|
|
- err += pf.getText();
|
|
|
- return 0;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim laden von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
}
|
|
|
- case 7: // Save Team
|
|
|
+ case 9: // Lade Schalter Daten
|
|
|
{
|
|
|
- k->sendeEncrypted( "\1", 1 );
|
|
|
- TeamStr t( 0 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.id, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.maxPunkte, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.beschleunigung, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.maxStability, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.maxEnergie, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.reparatur, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.akkuLeistung, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.laserIntensity, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.laserEffizienz, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.laserTempo, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.wendigkeit, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.antriebEffizienz, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.energieSchild, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.energieSchildEffizienz, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& t.punkte, 4 );
|
|
|
- Text pf = pfad.getText();
|
|
|
- pf += "/player/";
|
|
|
- pf += t.id;
|
|
|
- pf += ".t";
|
|
|
- Datei team;
|
|
|
- team.setDatei( pf );
|
|
|
- if( team.open( Datei::Style::schreiben ) )
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/schalter";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ RCArray< Text > *files = d.getDateiListe();
|
|
|
+ if( files )
|
|
|
{
|
|
|
- t.save( team.getThis() );
|
|
|
- team.close();
|
|
|
k->sendeEncrypted( "\1", 1 );
|
|
|
- return 1;
|
|
|
+ int anz = files->getEintragAnzahl();
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
+ for( int i = 0; i < anz; i++ )
|
|
|
+ {
|
|
|
+ Text pf = tmpPf;
|
|
|
+ pf += "/";
|
|
|
+ pf += files->z( i )->getText();
|
|
|
+ Datei object;
|
|
|
+ object.setDatei( pf );
|
|
|
+ object.open( Datei::Style::lesen );
|
|
|
+ int id = *files->z( i );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ bool aktive;
|
|
|
+ object.lese( (char *)&x, 4 );
|
|
|
+ object.lese( (char *)&y, 4 );
|
|
|
+ object.lese( (char *)&breite, 4 );
|
|
|
+ object.lese( (char *)&height, 4 );
|
|
|
+ object.lese( (char *)&aktive, 1 );
|
|
|
+ object.close();
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&x, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&y, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&breite, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&height, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&aktive, 1 );
|
|
|
+ }
|
|
|
}
|
|
|
- err = "Fehler beim Schreiben von ";
|
|
|
- err += pf.getText();
|
|
|
- return 0;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim laden von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
}
|
|
|
- case 8: // Save Objekt
|
|
|
+ case 0xA: // Lade Schiene Daten
|
|
|
{
|
|
|
- k->sendeEncrypted( "\1", 1 );
|
|
|
- ObjektStr o( 0 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.pos.x, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.pos.y, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.rot, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.scale, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.id, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.m2d, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.bild, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.style, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.maxStability, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.maxEnergie, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.energieRadius, 4 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.reparatur, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.akkuLeistung, 8 );
|
|
|
- k->getNachrichtEncrypted( (char *)& o.team, 1 );
|
|
|
- Text pf = pfad.getText();
|
|
|
- pf += "/objekt/";
|
|
|
- pf += o.id;
|
|
|
- pf += ".o";
|
|
|
- Datei objekt;
|
|
|
- objekt.setDatei( pf );
|
|
|
- if( objekt.erstellen() && objekt.open( Datei::Style::schreiben ) )
|
|
|
- {
|
|
|
- o.save( objekt.getThis() );
|
|
|
- objekt.close();
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/schiene";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ RCArray< Text > *files = d.getDateiListe();
|
|
|
+ if( files )
|
|
|
+ {
|
|
|
k->sendeEncrypted( "\1", 1 );
|
|
|
- return 1;
|
|
|
+ int anz = files->getEintragAnzahl();
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
+ for( int i = 0; i < anz; i++ )
|
|
|
+ {
|
|
|
+ Text pf = tmpPf;
|
|
|
+ pf += "/";
|
|
|
+ pf += files->z( i )->getText();
|
|
|
+ Datei object;
|
|
|
+ object.setDatei( pf );
|
|
|
+ object.open( Datei::Style::lesen );
|
|
|
+ int id = *files->z( i );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ object.lese( (char *)&x, 4 );
|
|
|
+ object.lese( (char *)&y, 4 );
|
|
|
+ object.lese( (char *)&breite, 4 );
|
|
|
+ object.lese( (char *)&height, 4 );
|
|
|
+ object.close();
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&x, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&y, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&breite, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&height, 4 );
|
|
|
+ }
|
|
|
}
|
|
|
- err = "Fehler beim Schreiben von ";
|
|
|
- err += pf.getText();
|
|
|
- return 0;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim laden von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
}
|
|
|
- case 9: // Delete Objekt
|
|
|
+ case 0xB: // Lade Schiene Daten
|
|
|
{
|
|
|
- k->sendeEncrypted( "\1", 1 );
|
|
|
- int id;
|
|
|
- k->getNachrichtEncrypted( (char *)& id, 4 );
|
|
|
- Text pf = pfad.getText();
|
|
|
- pf += "/objekt/";
|
|
|
- pf += id;
|
|
|
- pf += ".o";
|
|
|
- if( DateiRemove( pf ) )
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/timer";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ RCArray< Text > *files = d.getDateiListe();
|
|
|
+ if( files )
|
|
|
{
|
|
|
k->sendeEncrypted( "\1", 1 );
|
|
|
- return 1;
|
|
|
+ int anz = files->getEintragAnzahl();
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
+ for( int i = 0; i < anz; i++ )
|
|
|
+ {
|
|
|
+ Text pf = tmpPf;
|
|
|
+ pf += "/";
|
|
|
+ pf += files->z( i )->getText();
|
|
|
+ Datei object;
|
|
|
+ object.setDatei( pf );
|
|
|
+ object.open( Datei::Style::lesen );
|
|
|
+ int id = *files->z( i );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int maxZeit;
|
|
|
+ bool sichtbar;
|
|
|
+ bool autoWiederhohlung;
|
|
|
+ bool runns;
|
|
|
+ int farbe;
|
|
|
+ unsigned char len;
|
|
|
+ object.lese( (char *)&x, 4 );
|
|
|
+ object.lese( (char *)&y, 4 );
|
|
|
+ object.lese( (char *)&maxZeit, 4 );
|
|
|
+ object.lese( (char *)&sichtbar, 1 );
|
|
|
+ object.lese( (char *)&autoWiederhohlung, 1 );
|
|
|
+ object.lese( (char *)&runns, 1 );
|
|
|
+ object.lese( (char *)&farbe, 4 );
|
|
|
+ object.lese( (char *)&len, 1 );
|
|
|
+ char *name = new char[ len ];
|
|
|
+ object.lese( name, len );
|
|
|
+ object.close();
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&x, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&y, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&maxZeit, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&sichtbar, 1 );
|
|
|
+ k->sendeEncrypted( (char *)&autoWiederhohlung, 1 );
|
|
|
+ k->sendeEncrypted( (char *)&runns, 1 );
|
|
|
+ k->sendeEncrypted( (char *)&farbe, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&len, 1 );
|
|
|
+ k->sendeEncrypted( name, len );
|
|
|
+ delete[]name;
|
|
|
+ }
|
|
|
}
|
|
|
- err = "Fehler beim löschen der Datei ";
|
|
|
- err += pf;
|
|
|
- return 0;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim laden von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
}
|
|
|
- case 0xA: // Lade Resourcen
|
|
|
+ case 0xC: // Lade Tunnel Daten
|
|
|
{
|
|
|
Text tmpPf = pfad.getText();
|
|
|
- tmpPf += "/resource";
|
|
|
+ tmpPf += "/tunnel";
|
|
|
Datei d;
|
|
|
d.setDatei( tmpPf );
|
|
|
RCArray< Text > *files = d.getDateiListe();
|
|
@@ -343,26 +507,39 @@ bool Editor::nachricht( SKlient *k )
|
|
|
{
|
|
|
k->sendeEncrypted( "\1", 1 );
|
|
|
int anz = files->getEintragAnzahl();
|
|
|
- k->sendeEncrypted( (char *)& anz, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
Text pf = tmpPf;
|
|
|
pf += "/";
|
|
|
pf += files->z( i )->getText();
|
|
|
- Datei resource;
|
|
|
- resource.setDatei( pf );
|
|
|
- resource.open( Datei::Style::lesen );
|
|
|
+ Datei object;
|
|
|
+ object.setDatei( pf );
|
|
|
+ object.open( Datei::Style::lesen );
|
|
|
int id = *files->z( i );
|
|
|
- k->sendeEncrypted( (char *)& id, 4 );
|
|
|
- char len = 0;
|
|
|
- resource.lese( &len, 1 );
|
|
|
- char *path = new char[ len + 1 ];
|
|
|
- path[ (int)len ] = 0;
|
|
|
- resource.lese( path, len );
|
|
|
- k->sendeEncrypted( &len, 1 );
|
|
|
- k->sendeEncrypted( path, len );
|
|
|
- delete[] path;
|
|
|
- resource.close();
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ int zielX;
|
|
|
+ int zielY;
|
|
|
+ bool aktiv;
|
|
|
+ object.lese( (char *)&x, 4 );
|
|
|
+ object.lese( (char *)&y, 4 );
|
|
|
+ object.lese( (char *)&breite, 4 );
|
|
|
+ object.lese( (char *)&height, 4 );
|
|
|
+ object.lese( (char *)&zielX, 4 );
|
|
|
+ object.lese( (char *)&zielY, 4 );
|
|
|
+ object.lese( (char *)&aktiv, 1 );
|
|
|
+ object.close();
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&x, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&y, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&breite, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&height, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&zielX, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&zielY, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&aktiv, 1 );
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -373,21 +550,54 @@ bool Editor::nachricht( SKlient *k )
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
- case 0xB: // Map Size
|
|
|
+ case 0xD: // Lade Umlenkung Daten
|
|
|
{
|
|
|
Text tmpPf = pfad.getText();
|
|
|
- tmpPf += "/size";
|
|
|
+ tmpPf += "/umlenkung";
|
|
|
Datei d;
|
|
|
d.setDatei( tmpPf );
|
|
|
- if( d.open( Datei::Style::lesen ) )
|
|
|
+ RCArray< Text > *files = d.getDateiListe();
|
|
|
+ if( files )
|
|
|
{
|
|
|
k->sendeEncrypted( "\1", 1 );
|
|
|
- int size = 0;
|
|
|
- d.lese( (char *)& size, 4 );
|
|
|
- k->sendeEncrypted( (char *)& size, 4 );
|
|
|
- d.lese( (char *)& size, 4 );
|
|
|
- k->sendeEncrypted( (char *)& size, 4 );
|
|
|
- d.close();
|
|
|
+ int anz = files->getEintragAnzahl();
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
+ for( int i = 0; i < anz; i++ )
|
|
|
+ {
|
|
|
+ Text pf = tmpPf;
|
|
|
+ pf += "/";
|
|
|
+ pf += files->z( i )->getText();
|
|
|
+ Datei object;
|
|
|
+ object.setDatei( pf );
|
|
|
+ object.open( Datei::Style::lesen );
|
|
|
+ int id = *files->z( i );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ char richtung;
|
|
|
+ int maxAbklingzeit;
|
|
|
+ bool drehend;
|
|
|
+ bool aktiv;
|
|
|
+ object.lese( (char *)&x, 4 );
|
|
|
+ object.lese( (char *)&y, 4 );
|
|
|
+ object.lese( (char *)&breite, 4 );
|
|
|
+ object.lese( (char *)&height, 4 );
|
|
|
+ object.lese( (char *)&richtung, 1 );
|
|
|
+ object.lese( (char *)&maxAbklingzeit, 4 );
|
|
|
+ object.lese( (char *)&drehend, 1 );
|
|
|
+ object.lese( (char *)&aktiv, 1 );
|
|
|
+ object.close();
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&x, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&y, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&breite, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&height, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&richtung, 1 );
|
|
|
+ k->sendeEncrypted( (char *)&maxAbklingzeit, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&drehend, 1 );
|
|
|
+ k->sendeEncrypted( (char *)&aktiv, 1 );
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -397,51 +607,1370 @@ bool Editor::nachricht( SKlient *k )
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
- case 0xC: // Add Resource
|
|
|
+ case 0xE: // Lade Trigger Daten
|
|
|
{
|
|
|
- k->sendeEncrypted( "\1", 1 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/trigger";
|
|
|
Datei d;
|
|
|
- d.setDatei( Text( pfad.getText() ) + "/resource" );
|
|
|
- RCArray<Text> *list = d.getDateiListe();
|
|
|
- int nId = 0;
|
|
|
- bool found = 0;
|
|
|
- do
|
|
|
- {
|
|
|
- nId++;
|
|
|
- found = 0;
|
|
|
- for( auto t = list->getIterator(); t; t++ )
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ RCArray< Text > *files = d.getDateiListe();
|
|
|
+ if( files )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int anz = files->getEintragAnzahl();
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
+ for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
- if( t->istGleich( Text( nId ) + ".r" ) )
|
|
|
+ Text pf = tmpPf;
|
|
|
+ pf += "/";
|
|
|
+ pf += files->z( i )->getText();
|
|
|
+ Datei object;
|
|
|
+ object.setDatei( pf );
|
|
|
+ __int64 size = object.getSize();
|
|
|
+ object.open( Datei::Style::lesen );
|
|
|
+ char buffer[ 2048 ];
|
|
|
+ int id = *files->z( i );
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ k->sendeEncrypted( (char *)&size, 8 );
|
|
|
+ while( size > 0 )
|
|
|
{
|
|
|
- found = 1;
|
|
|
- break;
|
|
|
+ object.lese( buffer, MIN( 2048, (int)size ) );
|
|
|
+ k->sendeEncrypted( buffer, MIN( 2048, (int)size ) );
|
|
|
+ size -= 2048;
|
|
|
}
|
|
|
+ object.close();
|
|
|
}
|
|
|
- } while( found );
|
|
|
- list->release();
|
|
|
- unsigned char len = 0;
|
|
|
- k->getNachrichtEncrypted( (char *)& len, 1 );
|
|
|
- char *path = new char[ len + 1 ];
|
|
|
- path[ len ] = 0;
|
|
|
- k->getNachrichtEncrypted( path, len );
|
|
|
- d.setDatei( Text( pfad.getText() ) + "/resource/" + nId + ".r" );
|
|
|
- if( d.open( Datei::Style::schreiben ) )
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim laden von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ case 0xF: // Lade Variable Daten
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/variable";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ RCArray< Text > *files = d.getDateiListe();
|
|
|
+ if( files )
|
|
|
{
|
|
|
- d.schreibe( (char *)& len, 1 );
|
|
|
- d.schreibe( path, len );
|
|
|
- d.close();
|
|
|
k->sendeEncrypted( "\1", 1 );
|
|
|
- k->sendeEncrypted( (char *)& nId, 4 );
|
|
|
- return 1;
|
|
|
+ int anz = files->getEintragAnzahl();
|
|
|
+ k->sendeEncrypted( (char *)&anz, 4 );
|
|
|
+ for( int i = 0; i < anz; i++ )
|
|
|
+ {
|
|
|
+ Text pf = tmpPf;
|
|
|
+ pf += "/";
|
|
|
+ pf += files->z( i )->getText();
|
|
|
+ Datei object;
|
|
|
+ object.setDatei( pf );
|
|
|
+ __int64 size = object.getSize();
|
|
|
+ object.open( Datei::Style::lesen );
|
|
|
+ char buffer[ 2048 ];
|
|
|
+ unsigned char len = (unsigned char)(files->z( i )->getLength() - 2);
|
|
|
+ k->sendeEncrypted( (char *)&len, 1 );
|
|
|
+ k->sendeEncrypted( *files->z( i ), len );
|
|
|
+ k->sendeEncrypted( (char *)&size, 8 );
|
|
|
+ while( size > 0 )
|
|
|
+ {
|
|
|
+ object.lese( buffer, MIN( 2048, (int)size ) );
|
|
|
+ k->sendeEncrypted( buffer, MIN( 2048, (int)size ) );
|
|
|
+ size -= 2048;
|
|
|
+ }
|
|
|
+ object.close();
|
|
|
+ }
|
|
|
}
|
|
|
- err = "Fehler beim schreiben der Datei.";
|
|
|
- return 0;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim laden von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ case 0x10: // Change Map Size
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/size";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int width;
|
|
|
+ int height;
|
|
|
+ k->getNachrichtEncrypted( (char *)&width, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ if( width <= 0 || height <= 0 )
|
|
|
+ {
|
|
|
+ err = "Illegal Argument Exception";
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ d.schreibe( (char *)&width, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ case 0x11: // Change Team data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/team/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".t";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int maxWbZeit;
|
|
|
+ int punkte;
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxWbZeit, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&punkte, 4 );
|
|
|
+ d.schreibe( (char *)&maxWbZeit, 4 );
|
|
|
+ d.schreibe( (char *)&punkte, 4 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x12: // Change Player data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/player/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".p";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int spawnX;
|
|
|
+ int spawnY;
|
|
|
+ k->getNachrichtEncrypted( (char *)&spawnX, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&spawnY, 4 );
|
|
|
+ d.schreibe( (char *)&spawnX, 4 );
|
|
|
+ d.schreibe( (char *)&spawnY, 4 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x13: // Change Bariere data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/bariere/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".b";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ int style;
|
|
|
+ int verschiebungWeite;
|
|
|
+ int autoSchaltungMaxTime;
|
|
|
+ int team;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&style, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&verschiebungWeite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&autoSchaltungMaxTime, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&team, 4 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&style, 4 );
|
|
|
+ d.schreibe( (char *)&verschiebungWeite, 4 );
|
|
|
+ d.schreibe( (char *)&autoSchaltungMaxTime, 4 );
|
|
|
+ d.schreibe( (char *)&team, 4 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x14: // Change Base data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/base/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".b";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ int maxTime;
|
|
|
+ int team;
|
|
|
+ bool showTimer;
|
|
|
+ int timerX;
|
|
|
+ int timerY;
|
|
|
+ int timerFarbe;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxTime, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&team, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&showTimer, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&timerX, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&timerY, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&timerFarbe, 4 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&maxTime, 4 );
|
|
|
+ d.schreibe( (char *)&team, 4 );
|
|
|
+ d.schreibe( (char *)&showTimer, 1 );
|
|
|
+ d.schreibe( (char *)&timerX, 4 );
|
|
|
+ d.schreibe( (char *)&timerY, 4 );
|
|
|
+ d.schreibe( (char *)&timerFarbe, 4 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x15: // Change Drop data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/drop/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".d";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int minX;
|
|
|
+ int minY;
|
|
|
+ int maxX;
|
|
|
+ int maxY;
|
|
|
+ int maxTime;
|
|
|
+ int numDrops;
|
|
|
+ float wahrscheinlichkeit[ ITEMANZAHL ];
|
|
|
+ unsigned char len;
|
|
|
+ k->getNachrichtEncrypted( (char *)&minX, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&minY, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxX, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxY, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxTime, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&numDrops, 4 );
|
|
|
+ for( int i = 0; i < ITEMANZAHL; i++ )
|
|
|
+ k->getNachrichtEncrypted( (char *)&wahrscheinlichkeit[ i ], 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&len, 1 );
|
|
|
+ char *name = new char[ len ];
|
|
|
+ k->getNachrichtEncrypted( name, len );
|
|
|
+ d.schreibe( (char *)&minX, 4 );
|
|
|
+ d.schreibe( (char *)&minY, 4 );
|
|
|
+ d.schreibe( (char *)&maxX, 4 );
|
|
|
+ d.schreibe( (char *)&maxY, 4 );
|
|
|
+ d.schreibe( (char *)&maxTime, 4 );
|
|
|
+ d.schreibe( (char *)&numDrops, 4 );
|
|
|
+ for( int i = 0; i < ITEMANZAHL; i++ )
|
|
|
+ d.schreibe( (char *)&wahrscheinlichkeit[ i ], 4 );
|
|
|
+ d.schreibe( (char *)&len, 1 );
|
|
|
+ d.schreibe( name, len );
|
|
|
+ delete[]name;
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x16: // Change Schalter data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/schalter/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".s";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ bool aktive;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&aktive, 1 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&aktive, 1 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x17: // Change Schiene data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/schiene/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".s";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x18: // Change Timer data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/timer/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".t";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int maxZeit;
|
|
|
+ bool sichtbar;
|
|
|
+ bool autoWiederhohlung;
|
|
|
+ bool runns;
|
|
|
+ int farbe;
|
|
|
+ unsigned char len;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxZeit, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&sichtbar, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&autoWiederhohlung, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&runns, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&farbe, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&len, 1 );
|
|
|
+ char *name = new char[ len ];
|
|
|
+ k->getNachrichtEncrypted( name, len );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&maxZeit, 4 );
|
|
|
+ d.schreibe( (char *)&sichtbar, 1 );
|
|
|
+ d.schreibe( (char *)&autoWiederhohlung, 1 );
|
|
|
+ d.schreibe( (char *)&runns, 1 );
|
|
|
+ d.schreibe( (char *)&farbe, 4 );
|
|
|
+ d.schreibe( (char *)&len, 1 );
|
|
|
+ d.schreibe( name, len );
|
|
|
+ delete[]name;
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x19: // Change Tunnel data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/tunnel/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".t";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ int zielX;
|
|
|
+ int zielY;
|
|
|
+ bool aktiv;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&zielX, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&zielY, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&aktiv, 1 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&zielX, 4 );
|
|
|
+ d.schreibe( (char *)&zielY, 4 );
|
|
|
+ d.schreibe( (char *)&aktiv, 1 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x1A: // Change Umlenkung data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/umlenkung/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".u";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ char richtung;
|
|
|
+ int maxAbklingzeit;
|
|
|
+ bool drehend;
|
|
|
+ bool aktiv;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&richtung, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxAbklingzeit, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&drehend, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&aktiv, 1 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&richtung, 1 );
|
|
|
+ d.schreibe( (char *)&maxAbklingzeit, 4 );
|
|
|
+ d.schreibe( (char *)&drehend, 1 );
|
|
|
+ d.schreibe( (char *)&aktiv, 1 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x1B: // Change Trigger data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/trigger/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".t";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ __int64 size;
|
|
|
+ k->getNachrichtEncrypted( (char *)&size, 8 );
|
|
|
+ char buffer[ 2048 ];
|
|
|
+ while( size > 0 )
|
|
|
+ {
|
|
|
+ k->getNachrichtEncrypted( buffer, MIN( 2048, (int)size ) );
|
|
|
+ d.schreibe( buffer, MIN( 2048, (int)size ) );
|
|
|
+ size -= 2048;
|
|
|
+ }
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x1C: // Change Variable data
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ unsigned char len;
|
|
|
+ k->getNachrichtEncrypted( (char *)&len, 1 );
|
|
|
+ char *originalName = new char[ len + 1 ];
|
|
|
+ k->getNachrichtEncrypted( (char *)&originalName, len );
|
|
|
+ originalName[ len ] = 0;
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/variable/";
|
|
|
+ tmpPf += originalName;
|
|
|
+ tmpPf += ".v";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ k->getNachrichtEncrypted( (char *)&len, 1 );
|
|
|
+ char *name = new char[ len + 1 ];
|
|
|
+ k->getNachrichtEncrypted( (char *)&name, len );
|
|
|
+ name[ len ] = 0;
|
|
|
+ if( !Text( name ).istGleich( originalName ) )
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/variable/";
|
|
|
+ tmpPf += name;
|
|
|
+ tmpPf += ".v";
|
|
|
+ if( !d.umbenennen( tmpPf ) )
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ __int64 size;
|
|
|
+ k->getNachrichtEncrypted( (char *)&size, 8 );
|
|
|
+ char buffer[ 2048 ];
|
|
|
+ while( size > 0 )
|
|
|
+ {
|
|
|
+ k->getNachrichtEncrypted( buffer, MIN( 2048, (int)size ) );
|
|
|
+ d.schreibe( buffer, MIN( 2048, (int)size ) );
|
|
|
+ size -= 2048;
|
|
|
+ }
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ delete[]name;
|
|
|
+ delete[]originalName;
|
|
|
+ }
|
|
|
+ case 0x1D: // Add Bariere
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/bariere/";
|
|
|
+ int id = 0;
|
|
|
+ while( true )
|
|
|
+ {
|
|
|
+ if( !DateiExistiert( tmpPf + id + ".b" ) )
|
|
|
+ break;
|
|
|
+ id++;
|
|
|
+ }
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".b";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ k->sendeEncrypted( (char*)&id, 4 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ int style;
|
|
|
+ int verschiebungWeite;
|
|
|
+ int autoSchaltungMaxTime;
|
|
|
+ int team;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&style, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&verschiebungWeite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&autoSchaltungMaxTime, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&team, 4 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&style, 4 );
|
|
|
+ d.schreibe( (char *)&verschiebungWeite, 4 );
|
|
|
+ d.schreibe( (char *)&autoSchaltungMaxTime, 4 );
|
|
|
+ d.schreibe( (char *)&team, 4 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x1E: // Add Base
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/base/";
|
|
|
+ int id = 0;
|
|
|
+ while( true )
|
|
|
+ {
|
|
|
+ if( !DateiExistiert( tmpPf + id + ".b" ) )
|
|
|
+ break;
|
|
|
+ id++;
|
|
|
+ }
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".b";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ k->sendeEncrypted( (char*)&id, 4 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ int maxTime;
|
|
|
+ int team;
|
|
|
+ bool showTimer;
|
|
|
+ int timerX;
|
|
|
+ int timerY;
|
|
|
+ int timerFarbe;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxTime, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&team, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&showTimer, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&timerX, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&timerY, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&timerFarbe, 4 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&maxTime, 4 );
|
|
|
+ d.schreibe( (char *)&team, 4 );
|
|
|
+ d.schreibe( (char *)&showTimer, 1 );
|
|
|
+ d.schreibe( (char *)&timerX, 4 );
|
|
|
+ d.schreibe( (char *)&timerY, 4 );
|
|
|
+ d.schreibe( (char *)&timerFarbe, 4 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x1F: // Add Drop
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/drop/";
|
|
|
+ int id = 0;
|
|
|
+ while( true )
|
|
|
+ {
|
|
|
+ if( !DateiExistiert( tmpPf + id + ".d" ) )
|
|
|
+ break;
|
|
|
+ id++;
|
|
|
+ }
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".d";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ int minX;
|
|
|
+ int minY;
|
|
|
+ int maxX;
|
|
|
+ int maxY;
|
|
|
+ int maxTime;
|
|
|
+ int numDrops;
|
|
|
+ float wahrscheinlichkeit[ ITEMANZAHL ];
|
|
|
+ unsigned char len;
|
|
|
+ k->getNachrichtEncrypted( (char *)&minX, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&minY, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxX, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxY, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxTime, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&numDrops, 4 );
|
|
|
+ for( int i = 0; i < ITEMANZAHL; i++ )
|
|
|
+ k->getNachrichtEncrypted( (char *)&wahrscheinlichkeit[ i ], 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&len, 1 );
|
|
|
+ char *name = new char[ len ];
|
|
|
+ k->getNachrichtEncrypted( name, len );
|
|
|
+ d.schreibe( (char *)&minX, 4 );
|
|
|
+ d.schreibe( (char *)&minY, 4 );
|
|
|
+ d.schreibe( (char *)&maxX, 4 );
|
|
|
+ d.schreibe( (char *)&maxY, 4 );
|
|
|
+ d.schreibe( (char *)&maxTime, 4 );
|
|
|
+ d.schreibe( (char *)&numDrops, 4 );
|
|
|
+ for( int i = 0; i < ITEMANZAHL; i++ )
|
|
|
+ d.schreibe( (char *)&wahrscheinlichkeit[ i ], 4 );
|
|
|
+ d.schreibe( (char *)&len, 1 );
|
|
|
+ d.schreibe( name, len );
|
|
|
+ delete[]name;
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x20: // Add Schalter
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/schalter/";
|
|
|
+ int id = 0;
|
|
|
+ while( true )
|
|
|
+ {
|
|
|
+ if( !DateiExistiert( tmpPf + id + ".s" ) )
|
|
|
+ break;
|
|
|
+ id++;
|
|
|
+ }
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".s";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ bool aktive;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&aktive, 1 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&aktive, 1 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x21: // Add Schiene
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/schiene/";
|
|
|
+ int id = 0;
|
|
|
+ while( true )
|
|
|
+ {
|
|
|
+ if( !DateiExistiert( tmpPf + id + ".s" ) )
|
|
|
+ break;
|
|
|
+ id++;
|
|
|
+ }
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".s";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x22: // Add Timer
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/timer/";
|
|
|
+ int id = 0;
|
|
|
+ while( true )
|
|
|
+ {
|
|
|
+ if( !DateiExistiert( tmpPf + id + ".t" ) )
|
|
|
+ break;
|
|
|
+ id++;
|
|
|
+ }
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".t";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int maxZeit;
|
|
|
+ bool sichtbar;
|
|
|
+ bool autoWiederhohlung;
|
|
|
+ bool runns;
|
|
|
+ int farbe;
|
|
|
+ unsigned char len;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxZeit, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&sichtbar, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&autoWiederhohlung, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&runns, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&farbe, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&len, 1 );
|
|
|
+ char *name = new char[ len ];
|
|
|
+ k->getNachrichtEncrypted( name, len );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&maxZeit, 4 );
|
|
|
+ d.schreibe( (char *)&sichtbar, 1 );
|
|
|
+ d.schreibe( (char *)&autoWiederhohlung, 1 );
|
|
|
+ d.schreibe( (char *)&runns, 1 );
|
|
|
+ d.schreibe( (char *)&farbe, 4 );
|
|
|
+ d.schreibe( (char *)&len, 1 );
|
|
|
+ d.schreibe( name, len );
|
|
|
+ delete[]name;
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x23: // Add Tunnel
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/tunnel/";
|
|
|
+ int id = 0;
|
|
|
+ while( true )
|
|
|
+ {
|
|
|
+ if( !DateiExistiert( tmpPf + id + ".t" ) )
|
|
|
+ break;
|
|
|
+ id++;
|
|
|
+ }
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".t";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ int zielX;
|
|
|
+ int zielY;
|
|
|
+ bool aktiv;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&zielX, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&zielY, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&aktiv, 1 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&zielX, 4 );
|
|
|
+ d.schreibe( (char *)&zielY, 4 );
|
|
|
+ d.schreibe( (char *)&aktiv, 1 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x24: // Add Umlenkung
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/umlenkung/";
|
|
|
+ int id = 0;
|
|
|
+ while( true )
|
|
|
+ {
|
|
|
+ if( !DateiExistiert( tmpPf + id + ".u" ) )
|
|
|
+ break;
|
|
|
+ id++;
|
|
|
+ }
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".u";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ k->sendeEncrypted( (char *)&id, 4 );
|
|
|
+ int x;
|
|
|
+ int y;
|
|
|
+ int breite;
|
|
|
+ int height;
|
|
|
+ char richtung;
|
|
|
+ int maxAbklingzeit;
|
|
|
+ bool drehend;
|
|
|
+ bool aktiv;
|
|
|
+ k->getNachrichtEncrypted( (char *)&x, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&y, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&breite, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&height, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&richtung, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&maxAbklingzeit, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&drehend, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&aktiv, 1 );
|
|
|
+ d.schreibe( (char *)&x, 4 );
|
|
|
+ d.schreibe( (char *)&y, 4 );
|
|
|
+ d.schreibe( (char *)&breite, 4 );
|
|
|
+ d.schreibe( (char *)&height, 4 );
|
|
|
+ d.schreibe( (char *)&richtung, 1 );
|
|
|
+ d.schreibe( (char *)&maxAbklingzeit, 4 );
|
|
|
+ d.schreibe( (char *)&drehend, 1 );
|
|
|
+ d.schreibe( (char *)&aktiv, 1 );
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x25: // Add Trigger
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/trigger/";
|
|
|
+ int id = 0;
|
|
|
+ while( true )
|
|
|
+ {
|
|
|
+ if( !DateiExistiert( tmpPf + id + ".t" ) )
|
|
|
+ break;
|
|
|
+ id++;
|
|
|
+ }
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".t";
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ __int64 size;
|
|
|
+ k->getNachrichtEncrypted( (char *)&size, 8 );
|
|
|
+ char buffer[ 2048 ];
|
|
|
+ while( size > 0 )
|
|
|
+ {
|
|
|
+ k->getNachrichtEncrypted( buffer, MIN( 2048, (int)size ) );
|
|
|
+ d.schreibe( buffer, MIN( 2048, (int)size ) );
|
|
|
+ size -= 2048;
|
|
|
+ }
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x26: // Add Variable
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ unsigned char len;
|
|
|
+ k->getNachrichtEncrypted( (char *)&len, 1 );
|
|
|
+ char *name = new char[ len + 1 ];
|
|
|
+ k->getNachrichtEncrypted( (char *)&name, len );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/variable/";
|
|
|
+ tmpPf += name;
|
|
|
+ tmpPf += ".v";
|
|
|
+ Datei d;
|
|
|
+ if( d.existiert() )
|
|
|
+ {
|
|
|
+ err = "Die Variable existiert bereits";
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ d.setDatei( tmpPf );
|
|
|
+ name[ len ] = 0;
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ __int64 size;
|
|
|
+ k->getNachrichtEncrypted( (char *)&size, 8 );
|
|
|
+ char buffer[ 2048 ];
|
|
|
+ while( size > 0 )
|
|
|
+ {
|
|
|
+ k->getNachrichtEncrypted( buffer, MIN( 2048, (int)size ) );
|
|
|
+ d.schreibe( buffer, MIN( 2048, (int)size ) );
|
|
|
+ size -= 2048;
|
|
|
+ }
|
|
|
+ d.close();
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim schreiben von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ delete[]name;
|
|
|
+ }
|
|
|
+ case 0x27: // Remove Bariere
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/bariere/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".b";
|
|
|
+ if( DateiRemove( tmpPf ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim löschen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x28: // Remove Base
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/base/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".b";
|
|
|
+ if( DateiRemove( tmpPf ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim löschen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x29: // Remove Drop
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/drop/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".d";
|
|
|
+ if( DateiRemove( tmpPf ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim löschen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x2A: // Remove Schalter
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/schalter/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".s";
|
|
|
+ if( DateiRemove( tmpPf ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim löschen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x2B: // Remove Schiene
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/schiene/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".s";
|
|
|
+ if( DateiRemove( tmpPf ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim löschen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x2C: // Remove Timer
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/timer/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".t";
|
|
|
+ if( DateiRemove( tmpPf ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim löschen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x2D: // Remove Tunnel
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/tunnel/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".t";
|
|
|
+ if( DateiRemove( tmpPf ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim löschen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x2E: // Remove Umlenkung
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/umlenkung/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".u";
|
|
|
+ if( DateiRemove( tmpPf ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim löschen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x2F: // Remove Trigger
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ int id;
|
|
|
+ k->getNachrichtEncrypted( (char *)&id, 4 );
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/trigger/";
|
|
|
+ tmpPf += id;
|
|
|
+ tmpPf += ".t";
|
|
|
+ if( DateiRemove( tmpPf ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim löschen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ case 0x30: // Remove Variable
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ unsigned char len;
|
|
|
+ k->getNachrichtEncrypted( (char *)&len, 1 );
|
|
|
+ char *name = new char[ len + 1 ];
|
|
|
+ k->getNachrichtEncrypted( name, len );
|
|
|
+ name[ len ] = 0;
|
|
|
+ Text tmpPf = pfad.getText();
|
|
|
+ tmpPf += "/variable/";
|
|
|
+ tmpPf += name;
|
|
|
+ tmpPf += ".v";
|
|
|
+ delete[]name;
|
|
|
+ if( DateiRemove( tmpPf ) )
|
|
|
+ {
|
|
|
+ k->sendeEncrypted( "\1", 1 );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim löschen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ err = "Unbekannte Nachricht. Error Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ return 0;
|
|
|
}
|
|
|
- default:
|
|
|
- err = "Unbekannte Nachricht. Error Code: " __FILE__ ":";
|
|
|
- err += __LINE__;
|
|
|
- return 0;
|
|
|
- }*/
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -469,7 +1998,7 @@ ESEditorV *Editor::release()
|
|
|
// privat
|
|
|
bool Editor::createSitzung()
|
|
|
{
|
|
|
- /*DateiRemove( pfad );
|
|
|
+ DateiRemove( pfad );
|
|
|
Text pf = pfad.getText();
|
|
|
pf.remove( pf.getLength() - 6, pf.getLength() );
|
|
|
pf += "map/server/sts.ltgd";
|
|
@@ -487,8 +2016,8 @@ bool Editor::createSitzung()
|
|
|
return 0;
|
|
|
}
|
|
|
d.open( Datei::Style::lesen );
|
|
|
- d.lese( (char *)& spielerAnzahl, 4 );
|
|
|
- d.lese( (char *)& teamAnzahl, 4 );
|
|
|
+ d.lese( (char *)&spielerAnzahl, 4 );
|
|
|
+ d.lese( (char *)&teamAnzahl, 4 );
|
|
|
d.close();
|
|
|
pf = pfad.getText();
|
|
|
pf.remove( pf.getLength() - 6, pf.getLength() );
|
|
@@ -510,8 +2039,8 @@ bool Editor::createSitzung()
|
|
|
err += "\n";
|
|
|
}
|
|
|
__int64 size = 0;
|
|
|
- d.lese( (char *)& size, 8 );
|
|
|
- s.schreibe( (char *)& size, 8 );
|
|
|
+ d.lese( (char *)&size, 8 );
|
|
|
+ s.schreibe( (char *)&size, 8 );
|
|
|
s.close();
|
|
|
// teams
|
|
|
pf = pfad.getText();
|
|
@@ -523,8 +2052,8 @@ bool Editor::createSitzung()
|
|
|
tmpPf += ".t";
|
|
|
int maxWbZeit;
|
|
|
int punkte;
|
|
|
- d.lese( (char *)& maxWbZeit, 4 );
|
|
|
- d.lese( (char *)& punkte, 4 );
|
|
|
+ d.lese( (char *)&maxWbZeit, 4 );
|
|
|
+ d.lese( (char *)&punkte, 4 );
|
|
|
Datei t;
|
|
|
t.setDatei( tmpPf );
|
|
|
t.erstellen();
|
|
@@ -536,8 +2065,8 @@ bool Editor::createSitzung()
|
|
|
err += __LINE__;
|
|
|
err += "\n";
|
|
|
}
|
|
|
- t.schreibe( (char *)& maxWbZeit, 4 );
|
|
|
- t.schreibe( (char *)& punkte, 4 );
|
|
|
+ t.schreibe( (char *)&maxWbZeit, 4 );
|
|
|
+ t.schreibe( (char *)&punkte, 4 );
|
|
|
t.close();
|
|
|
}
|
|
|
// spieler
|
|
@@ -547,11 +2076,11 @@ bool Editor::createSitzung()
|
|
|
{
|
|
|
Text tmpPf = pf.getText();
|
|
|
tmpPf += i;
|
|
|
- tmpPf += ".t";
|
|
|
+ tmpPf += ".p";
|
|
|
int spawnX;
|
|
|
int spawnY;
|
|
|
- d.lese( (char *)& spawnX, 4 );
|
|
|
- d.lese( (char *)& spawnY, 4 );
|
|
|
+ d.lese( (char *)&spawnX, 4 );
|
|
|
+ d.lese( (char *)&spawnY, 4 );
|
|
|
Datei s;
|
|
|
s.setDatei( tmpPf );
|
|
|
s.erstellen();
|
|
@@ -563,8 +2092,8 @@ bool Editor::createSitzung()
|
|
|
err += __LINE__;
|
|
|
err += "\n";
|
|
|
}
|
|
|
- s.schreibe( (char *)& spawnX, 4 );
|
|
|
- s.schreibe( (char *)& spawnY, 4 );
|
|
|
+ s.schreibe( (char *)&spawnX, 4 );
|
|
|
+ s.schreibe( (char *)&spawnY, 4 );
|
|
|
s.close();
|
|
|
}
|
|
|
// barieren
|
|
@@ -575,10 +2104,10 @@ bool Editor::createSitzung()
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int id;
|
|
|
- d.lese( (char *)& id, 4 );
|
|
|
+ d.lese( (char *)&id, 4 );
|
|
|
Text tmpPf = pf.getText();
|
|
|
tmpPf += id;
|
|
|
- tmpPf += ".t";
|
|
|
+ tmpPf += ".b";
|
|
|
char buffer[ 32 ];
|
|
|
d.lese( buffer, 32 );
|
|
|
Datei s;
|
|
@@ -602,10 +2131,10 @@ bool Editor::createSitzung()
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int id;
|
|
|
- d.lese( (char *)& id, 4 );
|
|
|
+ d.lese( (char *)&id, 4 );
|
|
|
Text tmpPf = pf.getText();
|
|
|
tmpPf += id;
|
|
|
- tmpPf += ".t";
|
|
|
+ tmpPf += ".b";
|
|
|
char buffer[ 24 ];
|
|
|
d.lese( buffer, 24 );
|
|
|
Datei s;
|
|
@@ -629,10 +2158,10 @@ bool Editor::createSitzung()
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int id;
|
|
|
- d.lese( (char *)& id, 4 );
|
|
|
+ d.lese( (char *)&id, 4 );
|
|
|
Text tmpPf = pf.getText();
|
|
|
tmpPf += id;
|
|
|
- tmpPf += ".t";
|
|
|
+ tmpPf += ".d";
|
|
|
char buffer[ 96 ];
|
|
|
d.lese( buffer, 96 );
|
|
|
Datei s;
|
|
@@ -664,10 +2193,10 @@ bool Editor::createSitzung()
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int id;
|
|
|
- d.lese( (char *)& id, 4 );
|
|
|
+ d.lese( (char *)&id, 4 );
|
|
|
Text tmpPf = pf.getText();
|
|
|
tmpPf += id;
|
|
|
- tmpPf += ".t";
|
|
|
+ tmpPf += ".s";
|
|
|
char buffer[ 17 ];
|
|
|
d.lese( buffer, 17 );
|
|
|
Datei s;
|
|
@@ -691,10 +2220,10 @@ bool Editor::createSitzung()
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int id;
|
|
|
- d.lese( (char *)& id, 4 );
|
|
|
+ d.lese( (char *)&id, 4 );
|
|
|
Text tmpPf = pf.getText();
|
|
|
tmpPf += id;
|
|
|
- tmpPf += ".t";
|
|
|
+ tmpPf += ".s";
|
|
|
char buffer[ 16 ];
|
|
|
d.lese( buffer, 16 );
|
|
|
Datei s;
|
|
@@ -718,7 +2247,7 @@ bool Editor::createSitzung()
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int id;
|
|
|
- d.lese( (char *)& id, 4 );
|
|
|
+ d.lese( (char *)&id, 4 );
|
|
|
Text tmpPf = pf.getText();
|
|
|
tmpPf += id;
|
|
|
tmpPf += ".t";
|
|
@@ -737,12 +2266,12 @@ bool Editor::createSitzung()
|
|
|
}
|
|
|
s.schreibe( buffer, 19 );
|
|
|
unsigned char len;
|
|
|
- d.lese( (char *)& len, 1 );
|
|
|
+ d.lese( (char *)&len, 1 );
|
|
|
char *name = new char[ (int)len + 1 ];
|
|
|
d.lese( name, len );
|
|
|
name[ (int)len ] = 0;
|
|
|
- s.schreibe( (char *)& len, 1 );
|
|
|
- s.schreibe( (char *)& name, len );
|
|
|
+ s.schreibe( (char *)&len, 1 );
|
|
|
+ s.schreibe( (char *)&name, len );
|
|
|
delete[] name;
|
|
|
s.close();
|
|
|
}
|
|
@@ -753,7 +2282,7 @@ bool Editor::createSitzung()
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int id;
|
|
|
- d.lese( (char *)& id, 4 );
|
|
|
+ d.lese( (char *)&id, 4 );
|
|
|
Text tmpPf = pf.getText();
|
|
|
tmpPf += id;
|
|
|
tmpPf += ".t";
|
|
@@ -780,10 +2309,10 @@ bool Editor::createSitzung()
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int id;
|
|
|
- d.lese( (char *)& id, 4 );
|
|
|
+ d.lese( (char *)&id, 4 );
|
|
|
Text tmpPf = pf.getText();
|
|
|
tmpPf += id;
|
|
|
- tmpPf += ".t";
|
|
|
+ tmpPf += ".u";
|
|
|
char buffer[ 23 ];
|
|
|
d.lese( buffer, 23 );
|
|
|
Datei s;
|
|
@@ -808,7 +2337,7 @@ bool Editor::createSitzung()
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int id;
|
|
|
- d.lese( (char *)& id, 4 );
|
|
|
+ d.lese( (char *)&id, 4 );
|
|
|
Text tmpPf = pf.getText();
|
|
|
tmpPf += id;
|
|
|
tmpPf += ".t";
|
|
@@ -843,8 +2372,8 @@ bool Editor::createSitzung()
|
|
|
for( int j = 0; j < ereignisAnzahl; j++ )
|
|
|
{
|
|
|
int typ;
|
|
|
- d.lese( (char *)& typ, 4 );
|
|
|
- s.schreibe( (char *)& typ, 4 );
|
|
|
+ d.lese( (char *)&typ, 4 );
|
|
|
+ s.schreibe( (char *)&typ, 4 );
|
|
|
}
|
|
|
for( int j = 0; j < bedingungAnzahl; j++ )
|
|
|
mr.writeAktion( mr.readAktion( d ), s );
|
|
@@ -859,7 +2388,7 @@ bool Editor::createSitzung()
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
char len;
|
|
|
- d.lese( (char *)& len, 1 );
|
|
|
+ d.lese( (char *)&len, 1 );
|
|
|
char *name = new char[ (int)len + 1 ];
|
|
|
d.lese( name, len );
|
|
|
name[ (int)len ] = 0;
|
|
@@ -886,135 +2415,368 @@ bool Editor::createSitzung()
|
|
|
s.schreibe( &def, 1 );
|
|
|
if( def )
|
|
|
{
|
|
|
- if( typ == BOOLEAN || typ == TASTE )
|
|
|
- {
|
|
|
- char v;
|
|
|
- d.lese( &v, 1 );
|
|
|
- s.schreibe( &v, 1 );
|
|
|
- }
|
|
|
- else if( typ == STRING || typ == RICHTUNG )
|
|
|
+ if( typ == BOOLEAN || typ == TASTE )
|
|
|
+ {
|
|
|
+ char v;
|
|
|
+ d.lese( &v, 1 );
|
|
|
+ s.schreibe( &v, 1 );
|
|
|
+ }
|
|
|
+ else if( typ == STRING || typ == RICHTUNG )
|
|
|
+ {
|
|
|
+ char len;
|
|
|
+ d.lese( (char *)&len, 1 );
|
|
|
+ char *str = new char[ (int)len + 1 ];
|
|
|
+ d.lese( str, len );
|
|
|
+ s.schreibe( &len, 1 );
|
|
|
+ s.schreibe( str, len );
|
|
|
+ delete[] str;
|
|
|
+ }
|
|
|
+ else if( typ != NICHTS )
|
|
|
+ {
|
|
|
+ int v;
|
|
|
+ d.lese( (char *)&v, 4 );
|
|
|
+ s.schreibe( (char *)&v, 4 );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ s.close();
|
|
|
+ }
|
|
|
+ d.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Sitzung konnte nicht korrekt erstellt werden. Fehler beim lesen von ";
|
|
|
+ err += pf;
|
|
|
+ err += ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ pf = pfad.getText();
|
|
|
+ pf += "/empty.file";
|
|
|
+ DateiPfadErstellen( pf );
|
|
|
+ DateiRemove( pf );
|
|
|
+ }
|
|
|
+ if( !err.getLength() )
|
|
|
+ return 1;
|
|
|
+ else
|
|
|
+ return 0;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+bool Editor::saveSitzung()
|
|
|
+{
|
|
|
+ Text pf = pfad.getText();
|
|
|
+ pf.remove( pf.getLength() - 6, pf.getLength() );
|
|
|
+ pf += "map/server/sts.ltgd";
|
|
|
+ int spielerAnzahl;
|
|
|
+ int teamAnzahl;
|
|
|
+ Datei d;
|
|
|
+ d.setDatei( pf );
|
|
|
+ if( !d.existiert() || d.istOrdner() )
|
|
|
+ {
|
|
|
+ err += "Sitzung konnte nicht korrekt erstellt werden. Fehler beim lesen von ";
|
|
|
+ err += pf;
|
|
|
+ err += ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ err += "\n";
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ d.open( Datei::Style::lesen );
|
|
|
+ d.lese( (char *)&spielerAnzahl, 4 );
|
|
|
+ d.lese( (char *)&teamAnzahl, 4 );
|
|
|
+ d.close();
|
|
|
+ pf = pfad.getText();
|
|
|
+ pf.remove( pf.getLength() - 6, pf.getLength() );
|
|
|
+ pf += "map/server/data_tmp.map";
|
|
|
+ d.setDatei( pf.getText() );
|
|
|
+ if( d.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ pf = pfad.getText();
|
|
|
+ pf += "/size";
|
|
|
+ Datei s;
|
|
|
+ s.setDatei( pf.getText() );
|
|
|
+ if( !s.open( Datei::Style::schreiben ) )
|
|
|
+ {
|
|
|
+ err += "Sitzung konnte nicht korrekt erstellt werden. Fehler beim lesen von ";
|
|
|
+ err += pf;
|
|
|
+ err += ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ err += "\n";
|
|
|
+ }
|
|
|
+ __int64 size = 0;
|
|
|
+ s.lese( (char *)&size, 8 );
|
|
|
+ d.schreibe( (char *)&size, 8 );
|
|
|
+ s.close();
|
|
|
+ for( int i = 0; i < teamAnzahl; i++ )
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad + "/team/";
|
|
|
+ tmpPf += i;
|
|
|
+ tmpPf += ".t";
|
|
|
+ Datei r;
|
|
|
+ r.setDatei( tmpPf );
|
|
|
+ if( r.open( Datei::Style::lesen ) )
|
|
|
+ {
|
|
|
+ int maxWbZeit;
|
|
|
+ int punkte;
|
|
|
+ r.lese( (char *)&maxWbZeit, 4 );
|
|
|
+ r.lese( (char *)&punkte, 4 );
|
|
|
+ d.schreibe( (char *)&maxWbZeit, 4 );
|
|
|
+ d.schreibe( (char *)&punkte, 4 );
|
|
|
+ r.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim Lesen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ err += ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ d.close();
|
|
|
+ d.remove();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for( int i = 0; i < spielerAnzahl; i++ )
|
|
|
+ {
|
|
|
+ Text tmpPf = pfad + "/player/";
|
|
|
+ tmpPf += i;
|
|
|
+ tmpPf += ".p";
|
|
|
+ Datei r;
|
|
|
+ r.setDatei( tmpPf );
|
|
|
+ if( r.open( Datei::Style::lesen ) )
|
|
|
+ {
|
|
|
+ int spawnX;
|
|
|
+ int spawnY;
|
|
|
+ r.lese( (char *)&spawnX, 4 );
|
|
|
+ r.lese( (char *)&spawnY, 4 );
|
|
|
+ d.schreibe( (char *)&spawnX, 4 );
|
|
|
+ d.schreibe( (char *)&spawnY, 4 );
|
|
|
+ r.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim Lesen von ";
|
|
|
+ err += tmpPf.getText();
|
|
|
+ err += ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ d.close();
|
|
|
+ d.remove();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pf = pfad.getText();
|
|
|
+ pf += "/bariere";
|
|
|
+ Datei obj;
|
|
|
+ obj.setDatei( pf );
|
|
|
+ RCArray<Text> *objList = obj.getDateiListe();
|
|
|
+ if( objList )
|
|
|
+ {
|
|
|
+ int anz = objList->getEintragAnzahl();
|
|
|
+ d.schreibe( (char *)&anz, 4 );
|
|
|
+ for( auto objPf = objList->getIterator(); objPf && objPf._; objPf++ )
|
|
|
+ {
|
|
|
+ Text tmp = pf.getText();
|
|
|
+ tmp += "/";
|
|
|
+ tmp += objPf->getText();
|
|
|
+ Datei r;
|
|
|
+ r.setDatei( tmp );
|
|
|
+ if( r.open( Datei::Style::lesen ) )
|
|
|
+ {
|
|
|
+ int id = (int)*objPf.val();
|
|
|
+ d.schreibe( (char *)&id, 4 );
|
|
|
+ char buffer[ 32 ];
|
|
|
+ r.lese( buffer, 32 );
|
|
|
+ d.schreibe( buffer, 32 );
|
|
|
+ r.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim Lesen von ";
|
|
|
+ err += tmp.getText();
|
|
|
+ err = ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ d.close();
|
|
|
+ d.remove();
|
|
|
+ objList->release();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ objList->release();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ d.schreibe( "\0\0\0\0", 4 );
|
|
|
+ pf = pfad.getText();
|
|
|
+ pf += "/base";
|
|
|
+ obj.setDatei( pf );
|
|
|
+ objList = obj.getDateiListe();
|
|
|
+ if( objList )
|
|
|
+ {
|
|
|
+ int anz = objList->getEintragAnzahl();
|
|
|
+ d.schreibe( (char *)&anz, 4 );
|
|
|
+ for( auto objPf = objList->getIterator(); objPf && objPf._; objPf++ )
|
|
|
+ {
|
|
|
+ Text tmp = pf.getText();
|
|
|
+ tmp += "/";
|
|
|
+ tmp += objPf->getText();
|
|
|
+ Datei r;
|
|
|
+ r.setDatei( tmp );
|
|
|
+ if( r.open( Datei::Style::lesen ) )
|
|
|
+ {
|
|
|
+ int id = (int)*objPf.val();
|
|
|
+ d.schreibe( (char *)&id, 4 );
|
|
|
+ char buffer[ 24 ];
|
|
|
+ r.lese( buffer, 24 );
|
|
|
+ d.schreibe( buffer, 24 );
|
|
|
+ r.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim Lesen von ";
|
|
|
+ err += tmp.getText();
|
|
|
+ err = ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ d.close();
|
|
|
+ d.remove();
|
|
|
+ objList->release();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ objList->release();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ d.schreibe( "\0\0\0\0", 4 );
|
|
|
+ pf = pfad.getText();
|
|
|
+ pf += "/drop";
|
|
|
+ obj.setDatei( pf );
|
|
|
+ objList = obj.getDateiListe();
|
|
|
+ if( objList )
|
|
|
+ {
|
|
|
+ int anz = objList->getEintragAnzahl();
|
|
|
+ d.schreibe( (char *)&anz, 4 );
|
|
|
+ for( auto objPf = objList->getIterator(); objPf && objPf._; objPf++ )
|
|
|
+ {
|
|
|
+ Text tmp = pf.getText();
|
|
|
+ tmp += "/";
|
|
|
+ tmp += objPf->getText();
|
|
|
+ Datei r;
|
|
|
+ r.setDatei( tmp );
|
|
|
+ if( r.open( Datei::Style::lesen ) )
|
|
|
{
|
|
|
- char len;
|
|
|
- d.lese( (char *)& len, 1 );
|
|
|
- char *str = new char[ (int)len + 1 ];
|
|
|
- d.lese( str, len );
|
|
|
- s.schreibe( &len, 1 );
|
|
|
- s.schreibe( str, len );
|
|
|
- delete[] str;
|
|
|
+ int id = (int)*objPf.val();
|
|
|
+ d.schreibe( (char *)&id, 4 );
|
|
|
+ char buffer[ 96 ];
|
|
|
+ r.lese( buffer, 96 );
|
|
|
+ d.schreibe( buffer, 96 );
|
|
|
+ unsigned char len;
|
|
|
+ r.lese( (char *)&len, 1 );
|
|
|
+ char *name = new char[ (int)len + 1 ];
|
|
|
+ r.lese( name, len );
|
|
|
+ name[ (int)len ] = 0;
|
|
|
+ d.schreibe( (char *)&len, 1 );
|
|
|
+ d.schreibe( (char *)&name, len );
|
|
|
+ delete[] name;
|
|
|
+ r.close();
|
|
|
}
|
|
|
- else if( typ != NICHTS )
|
|
|
+ else
|
|
|
{
|
|
|
- int v;
|
|
|
- d.lese( (char *)&v, 4 );
|
|
|
- s.schreibe( (char *)&v, 4 );
|
|
|
+ err = "Fehler beim Lesen von ";
|
|
|
+ err += tmp.getText();
|
|
|
+ err = ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ d.close();
|
|
|
+ d.remove();
|
|
|
+ objList->release();
|
|
|
+ return 0;
|
|
|
}
|
|
|
}
|
|
|
- s.close();
|
|
|
+ objList->release();
|
|
|
}
|
|
|
- d.close();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- err = "Sitzung konnte nicht korrekt erstellt werden. Fehler beim lesen von ";
|
|
|
- err += pf;
|
|
|
- err += ". Fehler Code: " __FILE__ ":";
|
|
|
- err += __LINE__;
|
|
|
- pf = pfad.getText();
|
|
|
- pf += "/empty.file";
|
|
|
- DateiPfadErstellen( pf );
|
|
|
- DateiRemove( pf );
|
|
|
- }
|
|
|
- if( !err.getLength() )
|
|
|
- return 1;
|
|
|
- else
|
|
|
- return 0;*/
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-bool Editor::saveSitzung()
|
|
|
-{/*
|
|
|
- Text pf = pfad.getText();
|
|
|
- pf.remove( pf.getLength() - 6, pf.getLength() );
|
|
|
- pf += "map/server/data_tmp.map";
|
|
|
- Datei d;
|
|
|
- d.setDatei( pf.getText() );
|
|
|
- if( d.open( Datei::Style::schreiben ) )
|
|
|
- {
|
|
|
+ else
|
|
|
+ d.schreibe( "\0\0\0\0", 4 );
|
|
|
pf = pfad.getText();
|
|
|
- pf += "/resource";
|
|
|
- Datei res;
|
|
|
- res.setDatei( pf );
|
|
|
- RCArray<Text> *resList = res.getDateiListe();
|
|
|
- if( resList )
|
|
|
- {
|
|
|
- int anz = resList->getEintragAnzahl();
|
|
|
- d.schreibe( (char *)& anz, 4 );
|
|
|
- for( auto resPf = resList->getIterator(); resPf && resPf._; resPf++ )
|
|
|
+ pf += "/schalter";
|
|
|
+ obj.setDatei( pf );
|
|
|
+ objList = obj.getDateiListe();
|
|
|
+ if( objList )
|
|
|
+ {
|
|
|
+ int anz = objList->getEintragAnzahl();
|
|
|
+ d.schreibe( (char *)&anz, 4 );
|
|
|
+ for( auto objPf = objList->getIterator(); objPf && objPf._; objPf++ )
|
|
|
{
|
|
|
Text tmp = pf.getText();
|
|
|
tmp += "/";
|
|
|
- tmp += resPf->getText();
|
|
|
+ tmp += objPf->getText();
|
|
|
Datei r;
|
|
|
r.setDatei( tmp );
|
|
|
if( r.open( Datei::Style::lesen ) )
|
|
|
{
|
|
|
- int id = (int)* resPf;
|
|
|
- d.schreibe( (char *)& id, 4 );
|
|
|
- char b = 0;
|
|
|
- r.lese( &b, 1 );
|
|
|
- char *buffer = new char[ b + 1 ];
|
|
|
- buffer[ (int)b ] = 0;
|
|
|
- r.lese( buffer, b );
|
|
|
- d.schreibe( &b, 1 );
|
|
|
- d.schreibe( buffer, b );
|
|
|
+ int id = (int)*objPf.val();
|
|
|
+ d.schreibe( (char *)&id, 4 );
|
|
|
+ char buffer[ 17 ];
|
|
|
+ r.lese( buffer, 17 );
|
|
|
+ d.schreibe( buffer, 17 );
|
|
|
r.close();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
err = "Fehler beim Lesen von ";
|
|
|
err += tmp.getText();
|
|
|
- err += ". Fehler Code: " __FILE__ ":";
|
|
|
+ err = ". Fehler Code: " __FILE__ ":";
|
|
|
err += __LINE__;
|
|
|
d.close();
|
|
|
d.remove();
|
|
|
- resList->release();
|
|
|
+ objList->release();
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
- resList->release();
|
|
|
+ objList->release();
|
|
|
}
|
|
|
else
|
|
|
d.schreibe( "\0\0\0\0", 4 );
|
|
|
pf = pfad.getText();
|
|
|
- pf += "/size";
|
|
|
- Datei s;
|
|
|
- s.setDatei( pf.getText() );
|
|
|
- if( s.open( Datei::Style::lesen ) )
|
|
|
+ pf += "/schiene";
|
|
|
+ obj.setDatei( pf );
|
|
|
+ objList = obj.getDateiListe();
|
|
|
+ if( objList )
|
|
|
{
|
|
|
- __int64 size = 0;
|
|
|
- s.lese( (char *)& size, 8 );
|
|
|
- d.schreibe( (char *)& size, 8 );
|
|
|
- s.close();
|
|
|
+ int anz = objList->getEintragAnzahl();
|
|
|
+ d.schreibe( (char *)&anz, 4 );
|
|
|
+ for( auto objPf = objList->getIterator(); objPf && objPf._; objPf++ )
|
|
|
+ {
|
|
|
+ Text tmp = pf.getText();
|
|
|
+ tmp += "/";
|
|
|
+ tmp += objPf->getText();
|
|
|
+ Datei r;
|
|
|
+ r.setDatei( tmp );
|
|
|
+ if( r.open( Datei::Style::lesen ) )
|
|
|
+ {
|
|
|
+ int id = (int)*objPf.val();
|
|
|
+ d.schreibe( (char *)&id, 4 );
|
|
|
+ char buffer[ 16 ];
|
|
|
+ r.lese( buffer, 16 );
|
|
|
+ d.schreibe( buffer, 16 );
|
|
|
+ r.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim Lesen von ";
|
|
|
+ err += tmp.getText();
|
|
|
+ err = ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ d.close();
|
|
|
+ d.remove();
|
|
|
+ objList->release();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ objList->release();
|
|
|
}
|
|
|
else
|
|
|
- {
|
|
|
- err = "Fehler beim Lesen von ";
|
|
|
- err += pf.getText();
|
|
|
- err = ". Fehler Code: " __FILE__ ":";
|
|
|
- err += __LINE__;
|
|
|
- d.close();
|
|
|
- d.remove();
|
|
|
- return 0;
|
|
|
- }
|
|
|
+ d.schreibe( "\0\0\0\0", 4 );
|
|
|
pf = pfad.getText();
|
|
|
- pf += "/objekt";
|
|
|
- Datei obj;
|
|
|
+ pf += "/timer";
|
|
|
obj.setDatei( pf );
|
|
|
- RCArray<Text> *objList = obj.getDateiListe();
|
|
|
+ objList = obj.getDateiListe();
|
|
|
if( objList )
|
|
|
{
|
|
|
int anz = objList->getEintragAnzahl();
|
|
|
- d.schreibe( (char *)& anz, 4 );
|
|
|
+ d.schreibe( (char *)&anz, 4 );
|
|
|
for( auto objPf = objList->getIterator(); objPf && objPf._; objPf++ )
|
|
|
{
|
|
|
Text tmp = pf.getText();
|
|
@@ -1024,8 +2786,19 @@ bool Editor::saveSitzung()
|
|
|
r.setDatei( tmp );
|
|
|
if( r.open( Datei::Style::lesen ) )
|
|
|
{
|
|
|
- ObjektStr objStr( &r );
|
|
|
- objStr.save( &d );
|
|
|
+ int id = (int)*objPf.val();
|
|
|
+ d.schreibe( (char *)&id, 4 );
|
|
|
+ char buffer[ 19 ];
|
|
|
+ r.lese( buffer, 19 );
|
|
|
+ d.schreibe( buffer, 19 );
|
|
|
+ unsigned char len;
|
|
|
+ r.lese( (char *)&len, 1 );
|
|
|
+ char *name = new char[ (int)len + 1 ];
|
|
|
+ r.lese( name, len );
|
|
|
+ name[ (int)len ] = 0;
|
|
|
+ d.schreibe( (char *)&len, 1 );
|
|
|
+ d.schreibe( (char *)&name, len );
|
|
|
+ delete[] name;
|
|
|
r.close();
|
|
|
}
|
|
|
else
|
|
@@ -1045,87 +2818,219 @@ bool Editor::saveSitzung()
|
|
|
else
|
|
|
d.schreibe( "\0\0\0\0", 4 );
|
|
|
pf = pfad.getText();
|
|
|
- pf += "/player";
|
|
|
- Datei pl;
|
|
|
- pl.setDatei( pf );
|
|
|
- RCArray<Text> *plList = pl.getDateiListe();
|
|
|
- if( !plList )
|
|
|
- {
|
|
|
- err = "Fehler beim Lesen von ";
|
|
|
- err += pf.getText();
|
|
|
- err = ". Fehler Code: " __FILE__ ":";
|
|
|
- err += __LINE__;
|
|
|
- d.close();
|
|
|
- d.remove();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- for( auto plPf = plList->getIterator(); plPf && plPf._; plPf++ )
|
|
|
+ pf += "/tunnel";
|
|
|
+ obj.setDatei( pf );
|
|
|
+ objList = obj.getDateiListe();
|
|
|
+ if( objList )
|
|
|
{
|
|
|
- Text tmp = pf.getText();
|
|
|
- tmp += "/";
|
|
|
- tmp += plPf->getText();
|
|
|
- Datei r;
|
|
|
- r.setDatei( tmp );
|
|
|
- if( r.open( Datei::Style::lesen ) )
|
|
|
+ int anz = objList->getEintragAnzahl();
|
|
|
+ d.schreibe( (char *)&anz, 4 );
|
|
|
+ for( auto objPf = objList->getIterator(); objPf && objPf._; objPf++ )
|
|
|
{
|
|
|
- SpielerStr spStr( &r );
|
|
|
- spStr.save( &d );
|
|
|
- r.close();
|
|
|
+ Text tmp = pf.getText();
|
|
|
+ tmp += "/";
|
|
|
+ tmp += objPf->getText();
|
|
|
+ Datei r;
|
|
|
+ r.setDatei( tmp );
|
|
|
+ if( r.open( Datei::Style::lesen ) )
|
|
|
+ {
|
|
|
+ int id = (int)*objPf.val();
|
|
|
+ d.schreibe( (char *)&id, 4 );
|
|
|
+ char buffer[ 25 ];
|
|
|
+ r.lese( buffer, 25 );
|
|
|
+ d.schreibe( buffer, 25 );
|
|
|
+ r.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim Lesen von ";
|
|
|
+ err += tmp.getText();
|
|
|
+ err = ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ d.close();
|
|
|
+ d.remove();
|
|
|
+ objList->release();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|
|
|
- else
|
|
|
+ objList->release();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ d.schreibe( "\0\0\0\0", 4 );
|
|
|
+ pf = pfad.getText();
|
|
|
+ pf += "/umlenkung";
|
|
|
+ obj.setDatei( pf );
|
|
|
+ objList = obj.getDateiListe();
|
|
|
+ if( objList )
|
|
|
+ {
|
|
|
+ int anz = objList->getEintragAnzahl();
|
|
|
+ d.schreibe( (char *)&anz, 4 );
|
|
|
+ for( auto objPf = objList->getIterator(); objPf && objPf._; objPf++ )
|
|
|
{
|
|
|
- err = "Fehler beim Lesen von ";
|
|
|
- err += tmp.getText();
|
|
|
- err = ". Fehler Code: " __FILE__ ":";
|
|
|
- err += __LINE__;
|
|
|
- d.close();
|
|
|
- d.remove();
|
|
|
- plList->release();
|
|
|
- return 0;
|
|
|
+ Text tmp = pf.getText();
|
|
|
+ tmp += "/";
|
|
|
+ tmp += objPf->getText();
|
|
|
+ Datei r;
|
|
|
+ r.setDatei( tmp );
|
|
|
+ if( r.open( Datei::Style::lesen ) )
|
|
|
+ {
|
|
|
+ int id = (int)*objPf.val();
|
|
|
+ d.schreibe( (char *)&id, 4 );
|
|
|
+ char buffer[ 23 ];
|
|
|
+ r.lese( buffer, 23 );
|
|
|
+ d.schreibe( buffer, 23 );
|
|
|
+ r.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim Lesen von ";
|
|
|
+ err += tmp.getText();
|
|
|
+ err = ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ d.close();
|
|
|
+ d.remove();
|
|
|
+ objList->release();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|
|
|
+ objList->release();
|
|
|
}
|
|
|
- plList->release();
|
|
|
+ else
|
|
|
+ d.schreibe( "\0\0\0\0", 4 );
|
|
|
pf = pfad.getText();
|
|
|
- pf += "/team";
|
|
|
- Datei tm;
|
|
|
- tm.setDatei( pf );
|
|
|
- RCArray<Text> *tmList = tm.getDateiListe();
|
|
|
- if( !tmList )
|
|
|
- {
|
|
|
- err = "Fehler beim Lesen von ";
|
|
|
- err += pf.getText();
|
|
|
- err = ". Fehler Code: " __FILE__ ":";
|
|
|
- err += __LINE__;
|
|
|
- d.close();
|
|
|
- d.remove();
|
|
|
- return 0;
|
|
|
- }
|
|
|
- for( auto tmPf = tmList->getIterator(); tmPf && tmPf._; tmPf++ )
|
|
|
+ pf += "/trigger";
|
|
|
+ MapReader mr;
|
|
|
+ obj.setDatei( pf );
|
|
|
+ objList = obj.getDateiListe();
|
|
|
+ if( objList )
|
|
|
{
|
|
|
- Text tmp = pf.getText();
|
|
|
- tmp += "/";
|
|
|
- tmp += tmPf->getText();
|
|
|
- Datei r;
|
|
|
- r.setDatei( tmp );
|
|
|
- if( r.open( Datei::Style::lesen ) )
|
|
|
+ int anz = objList->getEintragAnzahl();
|
|
|
+ d.schreibe( (char *)&anz, 4 );
|
|
|
+ for( auto objPf = objList->getIterator(); objPf && objPf._; objPf++ )
|
|
|
{
|
|
|
- TeamStr tStr( &r );
|
|
|
- tStr.save( &d );
|
|
|
- r.close();
|
|
|
+ Text tmp = pf.getText();
|
|
|
+ tmp += "/";
|
|
|
+ tmp += objPf->getText();
|
|
|
+ Datei r;
|
|
|
+ r.setDatei( tmp );
|
|
|
+ if( r.open( Datei::Style::lesen ) )
|
|
|
+ {
|
|
|
+ int id = (int)*objPf.val();
|
|
|
+ d.schreibe( (char *)&id, 4 );
|
|
|
+ unsigned char len;
|
|
|
+ r.lese( (char *)&len, 1 );
|
|
|
+ char *name = new char[ (int)len + 1 ];
|
|
|
+ r.lese( name, len );
|
|
|
+ name[ (int)len ] = 0;
|
|
|
+ d.schreibe( (char *)&len, 1 );
|
|
|
+ d.schreibe( (char *)&name, len );
|
|
|
+ delete[] name;
|
|
|
+ int ereignisAnzahl;
|
|
|
+ int bedingungAnzahl;
|
|
|
+ int aktionAnzahl;
|
|
|
+ r.lese( (char *)&ereignisAnzahl, 4 );
|
|
|
+ r.lese( (char *)&bedingungAnzahl, 4 );
|
|
|
+ r.lese( (char *)&aktionAnzahl, 4 );
|
|
|
+ d.schreibe( (char *)&ereignisAnzahl, 4 );
|
|
|
+ d.schreibe( (char *)&bedingungAnzahl, 4 );
|
|
|
+ d.schreibe( (char *)&aktionAnzahl, 4 );
|
|
|
+ for( int j = 0; j < ereignisAnzahl; j++ )
|
|
|
+ {
|
|
|
+ int typ;
|
|
|
+ r.lese( (char *)&typ, 4 );
|
|
|
+ d.schreibe( (char *)&typ, 4 );
|
|
|
+ }
|
|
|
+ for( int j = 0; j < bedingungAnzahl; j++ )
|
|
|
+ mr.writeAktion( mr.readAktion( r ), d );
|
|
|
+ for( int j = 0; j < aktionAnzahl; j++ )
|
|
|
+ mr.writeAktion( mr.readAktion( r ), d );
|
|
|
+ r.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim Lesen von ";
|
|
|
+ err += tmp.getText();
|
|
|
+ err = ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ d.close();
|
|
|
+ d.remove();
|
|
|
+ objList->release();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|
|
|
- else
|
|
|
+ objList->release();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ d.schreibe( "\0\0\0\0", 4 );
|
|
|
+ pf = pfad.getText();
|
|
|
+ pf += "/variable";
|
|
|
+ obj.setDatei( pf );
|
|
|
+ objList = obj.getDateiListe();
|
|
|
+ if( objList )
|
|
|
+ {
|
|
|
+ int anz = objList->getEintragAnzahl();
|
|
|
+ d.schreibe( (char *)&anz, 4 );
|
|
|
+ for( auto objPf = objList->getIterator(); objPf && objPf._; objPf++ )
|
|
|
{
|
|
|
- err = "Fehler beim Lesen von ";
|
|
|
- err += tmp.getText();
|
|
|
- err = ". Fehler Code: " __FILE__ ":";
|
|
|
- err += __LINE__;
|
|
|
- d.close();
|
|
|
- d.remove();
|
|
|
- tmList->release();
|
|
|
- return 0;
|
|
|
+ Text tmp = pf.getText();
|
|
|
+ tmp += "/";
|
|
|
+ tmp += objPf->getText();
|
|
|
+ Datei r;
|
|
|
+ r.setDatei( tmp );
|
|
|
+ if( r.open( Datei::Style::lesen ) )
|
|
|
+ {
|
|
|
+ unsigned char len = (unsigned char)(objPf->getLength() - 2);
|
|
|
+ d.schreibe( (char *)&len, 1 );
|
|
|
+ d.schreibe( objPf->getText(), len );
|
|
|
+ char typ;
|
|
|
+ r.lese( &typ, 1 );
|
|
|
+ char def;
|
|
|
+ r.lese( &def, 1 );
|
|
|
+ d.schreibe( &typ, 1 );
|
|
|
+ d.schreibe( &def, 1 );
|
|
|
+ if( def )
|
|
|
+ {
|
|
|
+ if( typ == BOOLEAN || typ == TASTE )
|
|
|
+ {
|
|
|
+ char v;
|
|
|
+ r.lese( &v, 1 );
|
|
|
+ d.schreibe( &v, 1 );
|
|
|
+ }
|
|
|
+ else if( typ == STRING || typ == RICHTUNG )
|
|
|
+ {
|
|
|
+ char len;
|
|
|
+ r.lese( (char *)&len, 1 );
|
|
|
+ char *str = new char[ (int)len + 1 ];
|
|
|
+ r.lese( str, len );
|
|
|
+ d.schreibe( &len, 1 );
|
|
|
+ d.schreibe( str, len );
|
|
|
+ delete[] str;
|
|
|
+ }
|
|
|
+ else if( typ != NICHTS )
|
|
|
+ {
|
|
|
+ int v;
|
|
|
+ r.lese( (char *)&v, 4 );
|
|
|
+ d.schreibe( (char *)&v, 4 );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ r.close();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ err = "Fehler beim Lesen von ";
|
|
|
+ err += tmp.getText();
|
|
|
+ err = ". Fehler Code: " __FILE__ ":";
|
|
|
+ err += __LINE__;
|
|
|
+ d.close();
|
|
|
+ d.remove();
|
|
|
+ objList->release();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|
|
|
+ objList->release();
|
|
|
}
|
|
|
- tmList->release();
|
|
|
+ else
|
|
|
+ d.schreibe( "\0\0\0\0", 4 );
|
|
|
pf = pfad.getText();
|
|
|
pf.remove( pf.getLength() - 6, pf.getLength() );
|
|
|
pf += "map/server/data.map";
|
|
@@ -1170,6 +3075,5 @@ bool Editor::saveSitzung()
|
|
|
return 0;
|
|
|
}
|
|
|
DateiRemove( pfad.getText() );
|
|
|
- */
|
|
|
return 1;
|
|
|
}
|