@ -44,8 +44,9 @@ using namespace std;
LocalPlayer : : LocalPlayer ( )
{
charGenStage . current = 0 ;
charGenStage . end = 1 ;
charGenState . currentStage = 0 ;
charGenState . endStage = 1 ;
charGenState . isFinished = false ;
consoleAllowed = false ;
difficulty = 0 ;
@ -104,26 +105,22 @@ void LocalPlayer::update()
}
}
void LocalPlayer : : charGen ( int stageFirst , int stageEnd )
{
charGenStage . current = stageFirst ;
charGenStage . end = stageEnd ;
}
bool LocalPlayer : : charGenThread ( )
bool LocalPlayer : : processCharGen ( )
{
MWBase : : WindowManager * windowManager = MWBase : : Environment : : get ( ) . getWindowManager ( ) ;
// If we haven't finished CharGen and we're in a menu, it must be
// one of the CharGen menus, so go no further until it's closed
if ( windowManager - > isGuiMode ( ) & & charGenStage . end ! = 0 )
if ( windowManager - > isGuiMode ( ) & & ! charGenState . isFinished )
{
return false ;
}
// If the current stage of CharGen is not the last one,
// move to the next one
else if ( charGenSta ge. current < charGenStage . end )
else if ( charGenSta te. currentStage < charGenState . endStage )
{
switch ( charGenSta ge. current )
switch ( charGenSta te. currentStage )
{
case 0 :
windowManager - > pushGuiMode ( MWGui : : GM_Name ) ;
@ -143,14 +140,14 @@ bool LocalPlayer::charGenThread()
}
getNetworking ( ) - > getPlayerPacket ( ID_PLAYER_CHARGEN ) - > setPlayer ( this ) ;
getNetworking ( ) - > getPlayerPacket ( ID_PLAYER_CHARGEN ) - > Send ( ) ;
charGenSta ge. current + + ;
charGenSta te. currentStage + + ;
return false ;
}
// If we've reached the last stage of CharGen, send the
// corresponding packets and mark CharGen as finished
else if ( charGenStage . end ! = 0 )
else if ( ! charGenState . isFinished )
{
MWBase : : World * world = MWBase : : Environment : : get ( ) . getWorld ( ) ;
MWWorld : : Ptr ptrPlayer = world - > getPlayerPtr ( ) ;
@ -163,7 +160,7 @@ bool LocalPlayer::charGenThread()
// Send stats packets if this is the 2nd round of CharGen that
// only happens for new characters
if ( charGenSta ge. end ! = 1 )
if ( charGenSta te. endStage ! = 1 )
{
updateStatsDynamic ( true ) ;
updateAttributes ( true ) ;
@ -177,8 +174,8 @@ bool LocalPlayer::charGenThread()
sendCellStates ( ) ;
// Set the last stage variable to 0 to indicate that CharGen is finished
charGenSta ge. end = 0 ;
// Mark character generation as finished until overridden by a new ID_PLAYER_CHARGEN packet
charGenSta te. isFinished = true ;
}
return true ;
@ -186,7 +183,7 @@ bool LocalPlayer::charGenThread()
bool LocalPlayer : : hasFinishedCharGen ( )
{
return charGenSta ge. end = = 0 ;
return charGenSta te. isFinished ;
}
void LocalPlayer : : updateStatsDynamic ( bool forceUpdate )