Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/network-memory into lp:widelands
The vector member variable is being kept around - the new vector was only being created locally in the function in case of communication error. I say it makes sense in case of a communication error to simply not update anything. -- https://code.launchpad.net/~widelands-dev/widelands/network-memory/+merge/286162 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/network-memory into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/network-memory into lp:widelands
Continuous integration builds have changed state: Travis build 716. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/109585303. Appveyor build 563. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_network_memory-563. -- https://code.launchpad.net/~widelands-dev/widelands/network-memory/+merge/286162 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/network-memory into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/add_hints into lp:widelands-website
The proposal to merge lp:~widelands-dev/widelands-website/add_hints into lp:widelands-website has been updated. Status: Needs review => Merged For more details, see: https://code.launchpad.net/~widelands-dev/widelands-website/add_hints/+merge/285664 -- Your team Widelands Developers is subscribed to branch lp:widelands-website. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1546153-suggested-teams into lp:widelands
The proposal to merge lp:~widelands-dev/widelands/bug-1546153-suggested-teams into lp:widelands has been updated. Commit Message changed to: The editor now writes the suggested teams to the elemental map packet. For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-1546153-suggested-teams/+merge/286345 -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1546153-suggested-teams into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1546153-suggested-teams into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1546153-suggested-teams into lp:widelands. Commit message: The editor now writes the suggested teams to the elemental map packet. Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-1546153-suggested-teams/+merge/286345 The editor now writes the suggested teams to the elemental map packet. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1546153-suggested-teams into lp:widelands. === modified file 'src/map_io/map_elemental_packet.cc' --- src/map_io/map_elemental_packet.cc 2016-02-10 20:39:02 + +++ src/map_io/map_elemental_packet.cc 2016-02-17 15:44:56 + @@ -123,20 +123,40 @@ { Profile prof; - Section & s = prof.create_section("global"); + Section& global_section = prof.create_section("global"); - s.set_int ("packet_version", kCurrentPacketVersion); + global_section.set_int ("packet_version", kCurrentPacketVersion); const Map & map = egbase.map(); - s.set_int ("map_w", map.get_width ()); - s.set_int ("map_h", map.get_height ()); - s.set_int ("nr_players", map.get_nrplayers ()); - s.set_string("name", map.get_name ()); - s.set_string("author", map.get_author ()); - s.set_string("descr", map.get_description()); - s.set_string("hint", map.get_hint ()); + global_section.set_int ("map_w", map.get_width ()); + global_section.set_int ("map_h", map.get_height ()); + global_section.set_int ("nr_players", map.get_nrplayers ()); + global_section.set_string("name", map.get_name ()); + global_section.set_string("author", map.get_author ()); + global_section.set_string("descr", map.get_description()); + global_section.set_string("hint", map.get_hint ()); if (!map.get_background().empty()) - s.set_string("background", map.get_background ()); - s.set_string("tags", boost::algorithm::join(map.get_tags(), ",")); + global_section.set_string("background", map.get_background ()); + global_section.set_string("tags", boost::algorithm::join(map.get_tags(), ",")); + + int counter = 0; + for (Widelands::Map::SuggestedTeamLineup lineup : map.get_suggested_teams()) { + Section& teams_section = prof.create_section((boost::format("teams%02d") % counter++).str().c_str()); + int lineup_counter = 0; + for (Widelands::Map::SuggestedTeam team : lineup) { + std::string section_contents = ""; + for (std::vector::const_iterator it = team.begin(); it != team.end(); ++it) { +if (it == team.begin()) { + section_contents = (boost::format("%d") % static_cast(*it)).str(); +} +else { + section_contents = + (boost::format("%s,%d") % section_contents % static_cast(*it)).str(); +} + } + teams_section.set_string((boost::format("team%d") % ++lineup_counter).str().c_str(), + section_contents); + } + } prof.write("elemental", false, fs); } ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/balancing_tribes into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/balancing_tribes into lp:widelands. Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~widelands-dev/widelands/balancing_tribes/+merge/286346 This is not ready yet, just putting it here so that we will get Travis/AppVeyor builds. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/balancing_tribes into lp:widelands. === modified file 'data/tribes/buildings/trainingsites/atlanteans/labyrinth/init.lua' --- data/tribes/buildings/trainingsites/atlanteans/labyrinth/init.lua 2016-01-25 15:58:01 + +++ data/tribes/buildings/trainingsites/atlanteans/labyrinth/init.lua 2016-02-17 15:45:55 + @@ -15,7 +15,7 @@ planks = 5, spidercloth = 5, diamond = 2, - quartz = 2 + gold = 2 }, return_on_dismantle = { log = 1, @@ -23,7 +23,7 @@ planks = 2, spidercloth = 2, diamond = 1, - quartz = 1 + gold = 1 }, animations = { === modified file 'data/tribes/workers/barbarians/soldier/init.lua' --- data/tribes/workers/barbarians/soldier/init.lua 2015-12-11 16:54:00 + +++ data/tribes/workers/barbarians/soldier/init.lua 2016-02-17 15:45:55 + @@ -88,7 +88,7 @@ minimum = 1200, maximum = 1600 }, - attack_incr_per_level = 700, + attack_incr_per_level = 800, defense = 3, defense_incr_per_level = 4, evade = 25, ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/network-memory into lp:widelands
Mhh, you canged the semantics: * now: on Error you do not update anything. * old: on Error list whre made empty (to indicate the error) I will play a round with trunk to find how it looks like and then compare wiht this branch. -- https://code.launchpad.net/~widelands-dev/widelands/network-memory/+merge/286162 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/network-memory into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1395278-logic1 into lp:widelands
Continuous integration builds have changed state: Travis build 718. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/109618240. Appveyor build 565. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1395278_logic1-565. -- https://code.launchpad.net/~widelands-dev/widelands/bug-1395278-logic1/+merge/286178 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1395278-logic1 into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/ai_small_tweaks into lp:widelands
TiborB has proposed merging lp:~widelands-dev/widelands/ai_small_tweaks into lp:widelands. Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~widelands-dev/widelands/ai_small_tweaks/+merge/286407 Another bunch of changes to AI, partially code cleaning and partially functional improvements, areas affected - blocked fields management - player strength processing - attacking reworked a bit - road management modified - other nits -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/ai_small_tweaks into lp:widelands. === modified file 'src/ai/ai_help_structs.h' --- src/ai/ai_help_structs.h 2016-01-20 20:12:00 + +++ src/ai/ai_help_structs.h 2016-02-17 21:18:41 + @@ -168,6 +168,20 @@ } }; +// Unowned but walkable fields nearby +struct FindNodeUnownedWalkable { + bool accept(const Map&, const FCoords& fc) const { + + return (fc.field->nodecaps() & MOVECAPS_WALK) && (fc.field->get_owned_by() == 0); + } + + Player* player_; + Game& game; + + FindNodeUnownedWalkable(Player* p, Game& g) : player_(p), game(g) { + } +}; + // Looking only for mines-capable fields nearby // of specific type struct FindNodeMineable { @@ -245,14 +259,6 @@ }; } -struct BlockedField { - Widelands::FCoords coords; - uint32_t blocked_until_; - - BlockedField(Widelands::FCoords c, int32_t until) : coords(c), blocked_until_(until) { - } -}; - struct BuildableField { Widelands::FCoords coords; @@ -453,6 +459,7 @@ uint32_t stocklevel_time; // time when stocklevel_ was last time recalculated uint32_t last_dismantle_time_; uint32_t construction_decision_time_; + uint32_t last_building_built_; uint32_t unoccupied_count_; @@ -593,4 +600,123 @@ }; +// List of blocked fields with block time, with some accompanying functions +struct BlockedFields { + // + // of course hash of an blocked field is unique + std::map BlockedFields; + + void add(uint32_t hash, uint32_t till){ + if (BlockedFields.count(hash) == 0) { + BlockedFields.insert(std::pair(hash, till)); + } else if (BlockedFields[hash] < till) { + BlockedFields[hash] = till; + } + //third possibility is that a field has been already blocked for longer time than 'till' + } + + uint32_t count(){ + return BlockedFields.size(); + } + + void remove_expired(uint32_t gametime) { + std::vector fields_to_remove; + for (auto field: BlockedFields) { + if (field.second all_stats; + + // Number of team, sum of players' strength + std::map team_powers; + + // Inserting/updating data + void add(uint16_t pn, uint8_t tn, uint32_t pp){ + if (all_stats.count(pn) == 0) { + all_stats.insert(std::pair(pn, PlayerStat(tn, pp))); + } else { + all_stats[pn].players_power_ = pp; + } + } + + void recalculate_team_power() { + team_powers.clear(); + for (auto& item: all_stats){ + if (item.second.tn_ > 0) { //is a member of a team +if (team_powers.count(item.second.tn_) > 0){ + team_powers[item.second.tn_] += item.second.players_power_; +} else { + team_powers[item.second.tn_] = item.second.players_power_; +} + } + } + } + + // This is strength of player plus third of strength of other members of his team + uint32_t get_modified_player_power(uint16_t pn){ + uint32_t result = 0; + uint8_t team = 0; + if (all_stats.count(pn) > 0) { + result = all_stats[pn].players_power_; + team = all_stats[pn].tn_; + }; + if (team > 0 && team_powers.count(team) > 0) { + result = result + (team_powers[team] - result) / 3; + }; + return result; + } + + bool players_in_same_team(uint16_t pl1, uint16_t pl2){ + if (all_stats.count(pl1) > 0 && all_stats.count(pl2) > 0 && pl1 != pl2) { + // team number 0 = no team + return all_stats[pl1].tn_ > 0 && all_stats[pl1].tn_ == all_stats[pl2].tn_; + } else { + return false; + } + } + + bool strong_enough(uint16_t pl) { + if (all_stats.count(pl) == 0) { + return false; + } + uint32_t my_strength = all_stats[pl].players_power_; + uint32_t strongest_oponent_strength=0; + for (auto item : all_stats) { + if (!players_in_same_team(item.first, pl) && pl != item.first) { +if (get_modified_player_power(item.first) > strongest_oponent_strength) { + strongest_oponent_strength = get_modified_player_power(item.first); +} + } + } + return my_strength > strongest_oponent_strength + 50; + } +}; + #endif // end of include guard: WL_AI_AI_HELP_STRUCTS_H === modified file 'src/ai/defaultai.cc' --- src/ai/defaultai.cc 2016-02-13 12:15:29 + +++ src/ai/defaultai.cc 2016-02-17 21:18:41 + @@ -75,6 +75,10 @@ constexpr uint32_t kNever = std::numeric_limits::max(); constexpr uint32_t kNoExpedition = 0; +// following two are used for roads management, for creating shortcuts and dismantling dispensable roads +constexpr int32_t kSpotsTooLittle = 15; +constexpr int32_t kSpotsEnough = 25; + // this is intended for map developers, by default should be off constexpr bool kPrintS
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/find_portdock_reworked into lp:widelands
TiborB has proposed merging lp:~widelands-dev/widelands/find_portdock_reworked into lp:widelands. Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~widelands-dev/widelands/find_portdock_reworked/+merge/286408 This needs a discussion. Generally it works good enough, but I dont fully understand old logic. The code: - returns portdock of size up to 2 (fields) - makes sure all fields are valid - but the problem (not invoked by this change) is when function returns 0 fields of portdock. The calling code is not ready for portdock of size 0. It crashes the game. During my testing I had not run into such situation though... -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/find_portdock_reworked into lp:widelands. === modified file 'src/logic/map.cc' --- src/logic/map.cc 2016-02-14 14:09:29 + +++ src/logic/map.cc 2016-02-17 21:24:46 + @@ -1340,31 +1340,37 @@ WALK_E, WALK_E, WALK_E }; const FCoords start = br_n(br_n(get_fcoords(c))); - FCoords f[16]; - bool iswater[16]; - int firstwater = -1; - int lastnonwater = -1; - f[0] = start; + const Widelands::PlayerNumber owner = start.field->get_owned_by(); + bool is_good_water; + FCoords f = start; + std::vector portdock; for (uint32_t i = 0; i < 16; ++i) { - iswater[i] = (f[i].field->get_caps() & (MOVECAPS_SWIM|MOVECAPS_WALK)) == MOVECAPS_SWIM; - if (iswater[i]) { - if (firstwater < 0) -firstwater = i; - } else { - lastnonwater = i; - } + is_good_water = (f.field->get_caps() & (MOVECAPS_SWIM|MOVECAPS_WALK)) == MOVECAPS_SWIM; + + // Any immovable here? (especially another portdock) + if (is_good_water && f.field->get_immovable()) { + is_good_water = false; + } + + // If starting point is owned we make sure this field has the same owner + if (is_good_water && owner > 0 && f.field->get_owned_by() != owner) { + is_good_water = false; + } + + // ... and is not on a border + if (is_good_water && owner > 0 && f.field->is_border()) { + is_good_water = false; + } + + if (is_good_water) { + portdock.push_back(f); + if (portdock.size() == 2){ +return portdock; + } + } + if (i < 15) - f[i + 1] = get_neighbour(f[i], cycledirs[i]); - } - - std::vector portdock; - if (firstwater >= 0) { - for (uint32_t i = firstwater; i < 16 && iswater[i]; ++i) - portdock.push_back(f[i]); - if (firstwater == 0 && lastnonwater >= 0) { - for (uint32_t i = lastnonwater + 1; i < 16; ++i) -portdock.push_back(f[i]); - } + f = get_neighbour(f, cycledirs[i]); } return portdock; ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1546153-suggested-teams into lp:widelands
Review: Approve testing Works well :-) -- https://code.launchpad.net/~widelands-dev/widelands/bug-1546153-suggested-teams/+merge/286345 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1546153-suggested-teams. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1546095-backslash-edit into lp:widelands
Continuous integration builds have changed state: Travis build 719. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/109632729. Appveyor build 566. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1546095_backslash_edit-566. -- https://code.launchpad.net/~widelands-dev/widelands/bug-1546095-backslash-edit/+merge/286189 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1546095-backslash-edit into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/balancing_tribes into lp:widelands
Continuous integration builds have changed state: Travis build 722. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/109900190. Appveyor build 569. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_balancing_tribes-569. -- https://code.launchpad.net/~widelands-dev/widelands/balancing_tribes/+merge/286346 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/balancing_tribes into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/listselect into lp:widelands
Continuous integration builds have changed state: Travis build 725. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/109937395. Appveyor build 572. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_listselect-572. -- https://code.launchpad.net/~widelands-dev/widelands/listselect/+merge/286033 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/listselect. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp