widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #05907
[Merge] lp:~widelands-dev/widelands/simplify_setbobdescription into lp:widelands
SirVer has proposed merging lp:~widelands-dev/widelands/simplify_setbobdescription into lp:widelands.
Commit message:
Remove support in setbobdescription for tribe bobs. There aren't any.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1345741 in widelands: "Simplify setbobdescription worker program"
https://bugs.launchpad.net/widelands/+bug/1345741
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/simplify_setbobdescription/+merge/285236
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/simplify_setbobdescription into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/worker.cc'
--- src/logic/map_objects/tribes/worker.cc 2016-02-02 12:38:05 +0000
+++ src/logic/map_objects/tribes/worker.cc 2016-02-05 20:22:46 +0000
@@ -320,24 +320,11 @@
{
int32_t const idx = game.logic_rand() % action.sparamv.size();
- std::vector<std::string> const list(split_string(action.sparamv[idx], ":"));
- std::string bob;
- if (list.size() == 1) {
- state.svar1 = "world";
- bob = list[0];
- } else {
- state.svar1 = "tribe";
- bob = list[1];
- }
-
- state.ivar2 =
- state.svar1 == "world" ?
- game.world().get_bob(bob.c_str())
- :
- game.tribes().ship_index(bob.c_str());
+ const std::string& bob = action.sparamv[idx];
+ state.ivar2 = game.world().get_bob(bob.c_str());
if (state.ivar2 < 0) {
- molog(" WARNING: Unknown bob %s\n", action.sparamv[idx].c_str());
+ molog(" WARNING: Unknown bob %s\n", bob.c_str());
send_signal(game, "fail");
pop_task(game);
return true;
@@ -866,11 +853,7 @@
*/
bool Worker::run_create_bob(Game & game, State & state, const Action &)
{
- if (state.svar1 == "world") {
- game.create_critter(get_position(), state.ivar2);
- } else {
- game.create_ship(get_position(), state.ivar2);
- }
+ game.create_critter(get_position(), state.ivar2);
++state.ivar1;
schedule_act(game, 10);
return true;
Follow ups