allow to get current kill message from cube script + more checks

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6231 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lucas GAUTHERON
2011-04-09 10:52:48 +00:00
parent 7fe276fcbf
commit 0f06b8add3
2 changed files with 8 additions and 10 deletions
+6 -10
View File
@@ -697,21 +697,17 @@ void dodamage(int damage, playerent *pl, playerent *actor, int gun, bool gib, bo
void setkillmessage(int gun, bool gib, const char *message)
{
if(!message || !*message)
{
result(killmessage(gun, gib));
return;
}
if(gun < 0 || gun >= NUMGUNS)
{
conoutf("invalid gun specified");
return;
}
if(strlen(message)==0)
{
conoutf("invalid message");
return;
}
if(strlen(message)>MAXKILLMSGLEN)
{
conoutf("message is too long (max len is %i)", MAXKILLMSGLEN);
return;
}
if(gib) formatstring(gibmessages[gun])("%s", message);
else formatstring(fragmessages[gun])("%s", message);
+2
View File
@@ -619,6 +619,8 @@ extern char fragmessages[NUMGUNS][MAXKILLMSGLEN];
extern char gibmessages[NUMGUNS][MAXKILLMSGLEN];
inline char *killmessage(int gun, bool gib = false)
{
if(gun<0 || gun>=NUMGUNS) return "";
if(gib) return gibmessages[gun];
else return fragmessages[gun];
}