FOnline Development > FOnline Projects

FOnline TLA mk2 - now in English!

<< < (150/151) > >>

Dagnir:

--- Quote from: JovankaB on October 27, 2014, 07:29:32 pm ---This is some secret?
--- End quote ---
Not sure, hence PM. Plus it's offtopic. In any case, author wouldn't share it if it was a secret, so here is a copy of the PM:

Here is what Cracker told:


--- Quote from: Cracker ---1) Critter flag is removed from the hex where critter was standing
2) We change the coordinates of the critter and send a signal to the client
3) We save the old critter in the client
4) We place the new critter into the new position in the client (and place him in the hex)

Something like this, although I could forget something.
--- End quote ---

Server side:


--- Code: ---void critter_action(bool localCall, CritterCl& cr, int action, int actionExt, ItemCl@ item)
{
...
switch(action)
{
case ACTION_MOVE:
{
if( actionExt != 0 ) // Few critters on one hex support.
{
Message( " actionExt " + actionExt );
 
uint16 x=(actionExt)&0xFFFF;
uint16 y=(actionExt>>16)&0xFFFF;
// Critter is removed from the hex
// cr.HexX, cr.HexY
if( valid( cr.LastHexCritter ) && cr.LastHexCritter.HexX == cr.HexX && cr.LastHexCritter.HexY == cr.HexY )
{
SetCritterHex( cr.LastHexCritter, cr.HexX, cr.HexY );
}
else SetCritterHex( null, cr.HexX, cr.HexY );
SetCritterHex( null, x, y );
//SetCritterHex( cr, x, y );
//SetCritterHex( null, x, y );
}
}
break; 
 
 
case ACTION_REFRESH:
if( actionExt != 0 )
{
uint16 x=(actionExt)&0xFFFF;
uint16 y=(actionExt>>16)&0xFFFF;
Message( " refresh cr.HexX " + cr.HexX + " cr.HexY " + cr.HexY );
Message( " x " + x + " y " + y );
@cr.LastHexCritter = SetCritterHex( cr, x, y );
//CritterCl@[] crs;
//for( uint i = 0, iEnd = GetCrittersHex( x, y, 0, int findType, CritterCl@[]@+ critters); i < iEnd; i++ )
} break;
...
}
...
}
--- End code ---

Client side:


--- Code: ---void critter_action(bool localCall, CritterCl& cr, int action, int actionExt, ItemCl@ item)
{
...
switch(action)
{
case ACTION_MOVE:
{
if( actionExt != 0 ) // Few critters on one hex support.
{
Message( " actionExt " + actionExt );
 
uint16 x=(actionExt)&0xFFFF;
uint16 y=(actionExt>>16)&0xFFFF;
// Critter is removed from the hex
// cr.HexX, cr.HexY
if( valid( cr.LastHexCritter ) && cr.LastHexCritter.HexX == cr.HexX && cr.LastHexCritter.HexY == cr.HexY )
{
SetCritterHex( cr.LastHexCritter, cr.HexX, cr.HexY );
}
else SetCritterHex( null, cr.HexX, cr.HexY );
SetCritterHex( null, x, y );
//SetCritterHex( cr, x, y );
//SetCritterHex( null, x, y );
}
}
break; 
 
 
case ACTION_REFRESH:
if( actionExt != 0 )
{
uint16 x=(actionExt)&0xFFFF;
uint16 y=(actionExt>>16)&0xFFFF;
Message( " refresh cr.HexX " + cr.HexX + " cr.HexY " + cr.HexY );
Message( " x " + x + " y " + y );
@cr.LastHexCritter = SetCritterHex( cr, x, y );
//CritterCl@[] crs;
//for( uint i = 0, iEnd = GetCrittersHex( x, y, 0, int findType, CritterCl@[]@+ critters); i < iEnd; i++ )
} break;
...
}
...
}
--- End code ---

--- Quote from: Cracker ---Let them think up the rest themselves
--- End quote ---

Wipe:
Hah, thanks for sharing and GJ for Cracker!

devis:
Thanks for sharing the magic!

Koniko:
Never thought this will see a daylight. Thnx..

Dagnir:
The new session has started.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version