← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~stephan-lutz/widelands/bug_1831499_empire3_fixes into lp:widelands

 

hessenfarmer has proposed merging lp:~stephan-lutz/widelands/bug_1831499_empire3_fixes into lp:widelands.

Commit message:
fixes in the 3rd empire scenario


Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1831499 in widelands: "empire 3 needs improvements "
  https://bugs.launchpad.net/widelands/+bug/1831499

For more details, see:
https://code.launchpad.net/~stephan-lutz/widelands/bug_1831499_empire3_fixes/+merge/370405

artifacts task now triggered earlier. 
cleaned the code from unused / unnecessary variables
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~stephan-lutz/widelands/bug_1831499_empire3_fixes into lp:widelands.
=== modified file 'data/campaigns/emp03.wmf/scripting/helper_functions.lua'
--- data/campaigns/emp03.wmf/scripting/helper_functions.lua	2017-07-09 08:16:51 +0000
+++ data/campaigns/emp03.wmf/scripting/helper_functions.lua	2019-07-21 21:54:30 +0000
@@ -26,12 +26,11 @@
    return amount
 end
 
-function count_buildings(plr, buildings)
+function count_buildings(plr)
    -- return overall amount of buildings:
    -- plr : Player to count for
-   -- tbl : Table consisting of building description objects
    local amount = 0
-   for idx, building in pairs(p1.tribe.buildings) do
+   for idx, building in pairs(plr.tribe.buildings) do
       amount = amount + #plr:get_buildings(building.name)
    end
    return amount

=== modified file 'data/campaigns/emp03.wmf/scripting/mission_thread.lua'
--- data/campaigns/emp03.wmf/scripting/mission_thread.lua	2018-09-29 13:37:59 +0000
+++ data/campaigns/emp03.wmf/scripting/mission_thread.lua	2019-07-21 21:54:30 +0000
@@ -20,14 +20,12 @@
    end
 
    campaign_message_box(amalea_12)
-   run(artifacts)
 end
 
 -- Check for control of all pieces of Neptune's shrine (artifacts)
 function artifacts()
    -- Objective will be triggered if 50+ buildings are built
-   local all_building_types = p1.tribe.buildings
-   while count_buildings(p1, all_building_types) < 50 do
+   while count_buildings(p1) < 50 do
       sleep(4000)
    end
    campaign_message_box(saledus_8)
@@ -251,6 +249,7 @@
    objective = add_campaign_objective(obj_conquer_all)
    run(explore_sea)
    run(soldiers)
+   run(artifacts)
 
    while not p2.defeated do sleep(2342) end
    objective.done = true
@@ -281,12 +280,6 @@
    campaign_message_box(saledus_12)
 
    -- If we don't have enough training sites yet, add a message and objective to complete them.
-   local training = p1:get_buildings {
-      "empire_trainingcamp",
-      "empire_barracks",
-      "empire_arena",
-      "empire_colosseum"
-   }
    if not check_trainingsites() then
       campaign_message_box(saledus_11, 3000)
       local objective = add_campaign_objective(obj_training)


Follow ups