Save error handling clean up

This commit is contained in:
Zwelf 2020-05-27 20:09:12 +02:00
parent 2d7886bf33
commit 7146eb572b
2 changed files with 7 additions and 4 deletions

View file

@ -398,6 +398,8 @@ bool CSaveTeam::HandleSaveError(int Result, int ClientID, CGameContext *pGameCon
{ {
switch(Result) switch(Result)
{ {
case 0:
return false;
case 1: case 1:
pGameContext->SendChatTarget(ClientID, "You have to be in a team (from 1-63)"); pGameContext->SendChatTarget(ClientID, "You have to be in a team (from 1-63)");
break; break;
@ -408,12 +410,12 @@ bool CSaveTeam::HandleSaveError(int Result, int ClientID, CGameContext *pGameCon
pGameContext->SendChatTarget(ClientID, "Unable to find all Characters"); pGameContext->SendChatTarget(ClientID, "Unable to find all Characters");
break; break;
case 4: case 4:
pGameContext->SendChatTarget(ClientID, "Your team is not started yet"); pGameContext->SendChatTarget(ClientID, "Your team has not started yet");
break;
default: // this state should never be reached
pGameContext->SendChatTarget(ClientID, "Unknown error while saving");
break; break;
default:
return false;
} }
return true; return true;
} }

View file

@ -100,6 +100,7 @@ public:
int load(int Team); int load(int Team);
CSaveTee* m_pSavedTees; CSaveTee* m_pSavedTees;
// returns true if an error occured
static bool HandleSaveError(int Result, int ClientID, CGameContext *pGameContext); static bool HandleSaveError(int Result, int ClientID, CGameContext *pGameContext);
private: private:
int MatchPlayer(char name[16]); int MatchPlayer(char name[16]);