| 151 | } |
| 152 | |
| 153 | Command::Result cSrvAddCreature(const Command::ArgumentList_t& args, ConsoleInterface& c, GameMap& gameMap) |
| 154 | { |
| 155 | if (args.size() < 6) |
| 156 | { |
| 157 | c.print("Invalid number of arguments\n"); |
| 158 | return Command::Result::INVALID_ARGUMENT; |
| 159 | } |
| 160 | |
| 161 | // We remove the first argument (the console command) |
| 162 | Command::ArgumentList_t tmp = args; |
| 163 | tmp.erase(tmp.begin()); |
| 164 | std::string str = boost::algorithm::join(tmp, "\t"); |
| 165 | std::stringstream ss(str); |
| 166 | Creature* creature = Creature::getCreatureFromStream(&gameMap, ss); |
| 167 | if(creature == nullptr) |
| 168 | { |
| 169 | OD_LOG_INF("Cannot creature proper creature from string=" + str); |
| 170 | return Command::Result::FAILED; |
| 171 | } |
| 172 | |
| 173 | creature->addToGameMap(); |
| 174 | //Set up definition for creature. This was previously done in createMesh for some reason. |
| 175 | creature->setupDefinition(gameMap, *ConfigManager::getSingleton().getCreatureDefinitionDefaultWorker()); |
| 176 | //Set position to update info on what tile the creature is in. |
| 177 | creature->setPosition(creature->getPosition()); |
| 178 | |
| 179 | return Command::Result::SUCCESS; |
| 180 | } |
| 181 | |
| 182 | Command::Result cList(const Command::ArgumentList_t& args, ConsoleInterface& c, AbstractModeManager& mm) |
| 183 | { |
nothing calls this directly
no test coverage detected