Skip to content

Commit

Permalink
Merge pull request ddnet#7449 from furo321/lasttp-save
Browse files Browse the repository at this point in the history
Save entire character with `/lasttp`.
  • Loading branch information
def- authored Nov 12, 2023
2 parents 76d27e7 + f9b9480 commit 32f3f9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/game/server/ddracechat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1547,10 +1547,10 @@ void CGameContext::ConTele(IConsole::IResult *pResult, void *pUserData)
return;
Pos = pChrTo->m_Pos;
}
pPlayer->LastTelePos = Pos;
pSelf->Teleport(pChr, Pos);
pChr->UnFreeze();
pChr->Core()->m_Vel = vec2(0, 0);
pPlayer->m_LastTeleTee.Save(pChr);
}

void CGameContext::ConLastTele(IConsole::IResult *pResult, void *pUserData)
Expand All @@ -1572,14 +1572,13 @@ void CGameContext::ConLastTele(IConsole::IResult *pResult, void *pUserData)
pSelf->SendChatTarget(pPlayer->GetCID(), "You're not in a team with /practice turned on. Note that you can't earn a rank with practice enabled.");
return;
}
if(!pPlayer->LastTelePos.x)
if(!pPlayer->m_LastTeleTee.GetPos().x)
{
pSelf->SendChatTarget(pPlayer->GetCID(), "You haven't previously teleported. Use /tp before using this command.");
return;
}
pSelf->Teleport(pChr, pPlayer->LastTelePos);
pChr->UnFreeze();
pChr->Core()->m_Vel = vec2(0, 0);
pPlayer->m_LastTeleTee.Load(pChr, pChr->Team(), true);
pPlayer->Pause(CPlayer::PAUSE_NONE, true);
}

void CGameContext::ConPracticeUnSolo(IConsole::IResult *pResult, void *pUserData)
Expand Down
3 changes: 2 additions & 1 deletion src/game/server/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <engine/shared/protocol.h>

#include <game/alloc.h>
#include <game/server/save.h>

#include "teeinfo.h"

Expand Down Expand Up @@ -221,7 +222,7 @@ class CPlayer
int m_SwapTargetsClientID; //Client ID of the swap target for the given player
bool m_BirthdayAnnounced;

vec2 LastTelePos;
CSaveTee m_LastTeleTee;
};

#endif

0 comments on commit 32f3f9e

Please sign in to comment.