TiborB has proposed merging lp:~widelands-dev/widelands/seafaring-ai into
lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271
Hi, after some time this is ready for review, read the branch info for more
info.
Tested a lot as AI-only games, I would welcome a human players tests and
feedback.
--
Your team Widelands Developers is requested to review the proposed merge of
lp:~widelands-dev/widelands/seafaring-ai into lp:widelands.
=== modified file 'src/ai/ai_help_structs.h'
--- src/ai/ai_help_structs.h 2014-10-30 20:24:57 +
+++ src/ai/ai_help_structs.h 2014-11-19 21:19:43 +
@@ -32,6 +32,8 @@
#include "logic/player.h"
#include "logic/world/terrain_description.h"
#include "logic/world/world.h"
+#include "logic/ship.h"
+#include
namespace Widelands {
@@ -227,10 +229,10 @@
int16_t military_stationed_;
// stationed (manned) military buildings nearby
int16_t military_unstationed_;
- // some buildings must be postponed bit
- int32_t prohibited_till_;
- // and then some must be forced
- int32_t forced_after_;
+ bool is_portspace_;
+ // bool portspace_nearby_; // to prohibit buildings near a portspace Not needed?
+ bool port_nearby_; // to increase priority if a port is nearby,
+ // especially for new colonies
std::vector consumers_nearby_;
std::vector producers_nearby_;
@@ -261,7 +263,9 @@
military_loneliness_(1000),
military_in_constr_nearby_(0),
military_presence_(0),
- military_stationed_(0) {
+ military_stationed_(0),
+ is_portspace_(false),
+ port_nearby_(false) {
}
};
@@ -310,12 +314,14 @@
bool plants_trees_;
bool recruitment_; // is "producing" workers?
bool is_buildable_;
- bool need_trees_; // lumberjack = true
- bool need_stones_; // quarry = true
- bool mines_water_; // wells
- bool need_water_; // fisher, fish_breeder = true
- bool is_hunter_; // need to identify hunters
- bool is_fisher_; // need to identify fishers
+ bool need_trees_; // lumberjack = true
+ bool need_stones_; // quarry = true
+ bool mines_water_; // wells
+ bool need_water_; // fisher, fish_breeder = true
+ bool is_hunter_;// need to identify hunters
+ bool is_fisher_;// need to identify fishers
+ bool is_port_;
+ bool is_shipyard_;
bool space_consumer_; // farm, vineyard... = true
bool expansion_type_; // military building used that can be used to control area
bool fighting_type_; // military building built near enemies
@@ -327,7 +333,6 @@
int32_t mines_; // type of resource it mines_
uint16_t mines_percent_; // % of res it can mine
-
uint32_t current_stats_;
std::vector inputs_;
@@ -372,6 +377,25 @@
bool enemies_nearby_;
};
+struct TrainingSiteObserver {
+ Widelands::TrainingSite* site;
+ BuildingObserver* bo;
+};
+
+struct WarehouseSiteObserver {
+ Widelands::Warehouse* site;
+ BuildingObserver* bo;
+};
+
+struct ShipObserver {
+ Widelands::Ship* ship;
+ Widelands::Coords expedition_start_point_;
+ std::unordered_set visited_spots_;
+ bool island_circ_direction = true; // a ship circumvents all island in the same direction
+ bool waiting_for_command_ = false;
+ int32_t last_command_time = 0;
+};
+
struct WareObserver {
uint8_t producers_;
uint8_t consumers_;
=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc 2014-11-03 06:45:32 +
+++ src/ai/defaultai.cc 2014-11-19 21:19:43 +
@@ -6,7 +6,7 @@
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,n
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
@@ -31,7 +31,9 @@
#include "base/macros.h"
#include "economy/economy.h"
#include "economy/flag.h"
+#include "economy/portdock.h"
#include "economy/road.h"
+#include "economy/wares_queue.h"
#include "logic/constructionsite.h"
#include "logic/findbob.h"
#include "logic/findimmovable.h"
@@ -39,15 +41,19 @@
#include "logic/map.h"
#include "logic/militarysite.h"
#include "logic/player.h"
+#include "logic/playercommand.h"
#include "logic/productionsite.h"
+#include "logic/ship.h"
#include "logic/trainingsite.h"
#include "logic/tribe.h"
#include "logic/warehouse.h"
#include "logic/world/world.h"
#include "profile/profile.h"
+
// Building of new military buildings can be restricted
constexpr int kPushExpansion = 1;
+
constexpr int kResourcesOrDefense = 2;
constexpr int kDefenseOnly = 3;
constexpr int kNoNewMilitary = 4;
@@ -59,6 +65,10 @@
// building of the same building can be started after 25s at earliest
constexpr int kBuildingMinInter