Add infos into target window
[ryzomcore.git] / ryzom / server / src / general_utilities_service / cc_commands.cpp
blob3dd56a0039de96b70dedb88c1a5270c4ed49a1f4
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //-----------------------------------------------------------------------------
18 // includes
19 //-----------------------------------------------------------------------------
21 //nel
22 #include "nel/misc/command.h"
24 // game share
25 #include "game_share/utils.h"
27 // local
28 #include "cc_contest_ctrl_script.h"
31 //-----------------------------------------------------------------------------
32 // Namespaces
33 //-----------------------------------------------------------------------------
35 using namespace std;
36 using namespace NLMISC;
39 //-----------------------------------------------------------------------------
40 // CContestCtrlScript Commands
41 //-----------------------------------------------------------------------------
43 NLMISC_CATEGORISED_COMMAND(ContestCtrl,ccAdvance,"adavnce the clock to the end of the current delay","")
45 CNLSmartLogOverride logOverride(&log);
47 if (args.size()!=0)
48 return false;
50 CContestCtrlScript::getInstance()->setDelay(0);
52 return true;
55 NLMISC_CATEGORISED_COMMAND(ContestCtrl,ccDisplayState,"display the state of the contest control module","")
57 CNLSmartLogOverride logOverride(&log);
59 if (args.size()!=0)
60 return false;
62 CContestCtrlScript::getInstance()->display();
64 return true;
67 NLMISC_CATEGORISED_COMMAND(ContestCtrl,ccLoad,"load a contest control script","<filename>")
69 CNLSmartLogOverride logOverride(&log);
71 CSString ccsFileName;
72 switch (args.size())
74 case 0:
75 ccsFileName.readFromFile("gus_cc_last_ccs.txt");
76 break;
78 case 1:
79 ccsFileName= args[0];
80 ccsFileName.writeToFile("gus_cc_last_ccs.txt");
81 break;
83 default:
84 return false;
87 CContestCtrlScript::getInstance()->load(ccsFileName);
89 return true;
92 NLMISC_CATEGORISED_COMMAND(ContestCtrl,ccQuit,"stop running the current contest control script","")
94 CNLSmartLogOverride logOverride(&log);
96 if (args.size()!=0)
97 return false;
99 CContestCtrlScript::getInstance()->stop();
101 return true;
104 NLMISC_CATEGORISED_COMMAND(ContestCtrl,ccRun,"start running the current contest control script","")
106 CNLSmartLogOverride logOverride(&log);
108 if (args.size()!=0)
109 return false;
111 CContestCtrlScript::getInstance()->start();
113 return true;
116 NLMISC_CATEGORISED_COMMAND(ContestCtrl,ccShow,"show the current contest control script","")
118 CNLSmartLogOverride logOverride(&log);
120 if (args.size()!=0)
121 return false;
123 CContestCtrlScript::getInstance()->list();
125 return true;
128 NLMISC_CATEGORISED_COMMAND(ContestCtrl,ccWait,"modify duration of current pause","<time to wait in seconds>")
130 CNLSmartLogOverride logOverride(&log);
132 if (args.size()!=1)
133 return false;
135 sint32 time= atoi(args[0].c_str());
136 if (time<=0)
137 return false;
139 CContestCtrlScript::getInstance()->setDelay(time*1000);
141 return true;
145 //-----------------------------------------------------------------------------