From f3e4d1b73b46d88fff396707aaf1dd5953c1340c Mon Sep 17 00:00:00 2001 From: flowtron Date: Mon, 28 Mar 2011 20:07:29 +0000 Subject: [PATCH] minor comments & fixes git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6151 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/client.cpp | 22 +++++++++++++--------- source/src/clientgame.cpp | 23 ++++++++--------------- source/src/entities.cpp | 2 +- source/src/packetqueue.cpp | 2 +- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/source/src/client.cpp b/source/src/client.cpp index a97f7fe0..a7d760eb 100644 --- a/source/src/client.cpp +++ b/source/src/client.cpp @@ -619,15 +619,19 @@ void genauthkey(const char *secret) void saveauthkeys() { - stream *f = openfile("config/auth.cfg", "w"); - if(!f) { conoutf("failed to open config/auth.cfg for writing"); return; } - loopv(authkeys) - { - authkey *a = authkeys[i]; - f->printf("authkey \"%s\" \"%s\" \"%s\"\n", a->name, a->key, a->desc); - } - conoutf("saved authkeys to config/auth.cfg"); - delete f; + if(authkeys.length()) + { + stream *f = openfile("config/auth.cfg", "w"); + if(!f) { conoutf("failed to open config/auth.cfg for writing"); return; } + loopv(authkeys) + { + authkey *a = authkeys[i]; + f->printf("authkey \"%s\" \"%s\" \"%s\"\n", a->name, a->key, a->desc); + } + conoutf("saved authkeys to config/auth.cfg"); + delete f; + } + else conoutf("you need to use 'addauthkey USER KEY DESC' first; one DESC 'public', one DESC empty(=private)"); } bool tryauth(const char *desc) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 8d27089d..6986e570 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -664,19 +664,9 @@ VARP(hitsound, 0, 0, 1); void dodamage(int damage, playerent *pl, playerent *actor, int gun, bool gib, bool local) { - /* - TODO:FIXME: talk to DES|V-Man about passing arguments - // execute ondamage event - if(pl==player1) - { - const char *ondamage = getalias("ondamage"); - if(ondamage && ondamage[0]) { addsleep(0, ondamage); } - } - */ - if(pl->state != CS_ALIVE || intermission) return; - - pl->respawnoffset = pl->lastpain = lastmillis; - + if(pl->state != CS_ALIVE || intermission) return; + pl->respawnoffset = pl->lastpain = lastmillis; + // could the author of the FIXME below please elaborate what's to fix?! (ft:2011mar28) // playerent *h = local ? player1 : updatefollowplayer(0); if(/*actor==h && pl!=actor*/ actor == player1 && pl!=actor ) // FIXME { @@ -1208,8 +1198,11 @@ void callvote(int type, char *arg1, char *arg2) break; } sendpackettoserv(1, p.finalize()); - defformatstring(runas)("%s %d %d [%s] [%s]", "onCallVote", type, -1, arg1, arg2); - execute(runas); + if(identexists("onCallVote")) + { + defformatstring(runas)("%s %d %d [%s] [%s]", "onCallVote", type, -1, arg1, arg2); + execute(runas); + } } else conoutf(_("%c3invalid vote"), CC); } diff --git a/source/src/entities.cpp b/source/src/entities.cpp index 9164283a..fda97474 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -172,7 +172,7 @@ void renderentities() int sc = 17; // "carrot" (orange) - entity slot currently unused, possibly "reserved" if(i==closest) { - sc = 2; + sc = 2; // blue } else switch(e.type) { diff --git a/source/src/packetqueue.cpp b/source/src/packetqueue.cpp index 01fe4fba..c10e73ab 100644 --- a/source/src/packetqueue.cpp +++ b/source/src/packetqueue.cpp @@ -28,7 +28,7 @@ bool packetqueue::flushtolog(const char *logfile) if(!f) return false; // header - f->printf("AC PACKET LOG %11s\n\n", numtime()); + f->printf("AC v%d PACKET LOG : proto %d : @ %11s\n\n", AC_VERSION, PROTOCOL_VERSION, numtime()); // serialize each packet loopv(packets) {