123456789101112131415161718192021222324252627282930313233343536373839404142 |
- /*!
- * \file src/commands/CommandSound.cpp
- * \brief Sound command
- *
- * \author xythobuz
- */
-
- #include "global.h"
- #include "Game.h"
- #include "Log.h"
- #include "RunTime.h"
- #include "Sound.h"
- #include "commands/CommandSound.h"
-
- std::string CommandSound::name() {
- return "sound";
- }
-
- std::string CommandSound::brief() {
- return "INT - Test play sound";
- }
-
- void CommandSound::printHelp() {
- getLog() << "sound-Command Usage:" << Log::endl;
- getLog() << "sound-Command Usage:" << Log::endl;
- getLog() << " sound INT" << Log::endl;
- getLog() << "Where INT is a valid sound ID integer" << Log::endl;
- }
-
- int CommandSound::execute(std::istream& args) {
- if (!getGame().isLoaded()) {
- getLog() << "Use sound command interactively!" << Log::endl;
- return -1;
- }
-
- std::string s;
- args >> s;
-
- getSound().play(atoi(s.c_str()));
- return 0;
- }
|