give error message to client when no demos available to get

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3149 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2008-10-18 21:32:58 +00:00
parent ba820d4959
commit d115b41026
+10 -1
View File
@@ -752,7 +752,16 @@ static void cleardemos(int n)
void senddemo(int cn, int num)
{
if(!num) num = demos.length();
if(!demos.inrange(num-1)) return;
if(!demos.inrange(num-1))
{
if(demos.empty()) sendservmsg("no demos available", cn);
else
{
s_sprintfd(msg)("no demo %d available", num);
sendservmsg(msg, cn);
}
return;
}
demofile &d = demos[num-1];
sendf(cn, 2, "rim", SV_SENDDEMO, d.len, d.data);
}