From ad48145196acb5421db1ae3534d424acd5f19b88 Mon Sep 17 00:00:00 2001 From: Lucas GAUTHERON Date: Sat, 14 May 2011 15:09:47 +0000 Subject: [PATCH] $curdemofile git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6432 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/menus.cfg | 2 +- source/src/client.cpp | 6 +++--- source/src/clients2c.cpp | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config/menus.cfg b/config/menus.cfg index 7e71d7b4..be5cbbe7 100755 --- a/config/menus.cfg +++ b/config/menus.cfg @@ -78,7 +78,7 @@ menudirlist "demos" "dmo" "demo $arg1" // in-game menu that opens when pressing escape while watching a demo. newmenu "Watching demo" menuitem "Stop watching demo" [ stopdemo ] -menuitem "Restart demo" [ demo $_demofile ] +menuitem "Restart demo" [ demo $curdemofile ] menuitem "Watch other demo" [ stopdemo; closemenu "Watching demo"; showmenu "Play demo" ] menuitem "" -1 menuitem " 4Main menu..." [ closemenu "Watching demo"; showmenu main ] diff --git a/source/src/client.cpp b/source/src/client.cpp index 01e88a4e..5e678e8a 100644 --- a/source/src/client.cpp +++ b/source/src/client.cpp @@ -9,7 +9,7 @@ ENetHost *clienthost = NULL; ENetPeer *curpeer = NULL, *connpeer = NULL; int connmillis = 0, connattempts = 0, discmillis = 0; bool watchingdemo = false; -string demofile; +SVAR(curdemofile, "n/a"); extern bool clfail, cllock; extern int searchlan; @@ -775,9 +775,9 @@ void shiftgametime(int newmillis) if(newmillis < gamemillis) { // if rewinding - if(!demofile || !demofile[0]) return; + if(!curdemofile || !curdemofile[0]) return; watchingdemo = false; - callvote(SA_MAP, demofile, "-1"); + callvote(SA_MAP, curdemofile, "-1"); nextmillis = newmillis; } else diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 39682a16..dd5f53f3 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -1268,11 +1268,14 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) case SV_DEMOPLAYBACK: { - extern string demofile; - getstring(demofile, p); + string demofile; + extern char *curdemofile; + getstring(demofile, p, MAXSTRLEN); watchingdemo = demoplayback = demofile && demofile[0]; + delete[] curdemofile; if(demoplayback) { + curdemofile = newstring(demofile); player1->resetspec(); player1->state = CS_SPECTATE; player1->team = TEAM_SPECT; @@ -1280,6 +1283,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) else { // cleanups + curdemofile = newstring("n/a"); loopv(players) zapplayer(players[i]); clearvote(); player1->state = CS_ALIVE;