widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #03969
[Merge] lp:~widelands-dev/widelands/ai-coverity-fix into lp:widelands
TiborB has proposed merging lp:~widelands-dev/widelands/ai-coverity-fix into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/ai-coverity-fix/+merge/258339
Couple of small fixes of issues found by latest coverity scan.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/ai-coverity-fix into lp:widelands.
=== modified file 'src/ai/ai_help_structs.h'
--- src/ai/ai_help_structs.h 2015-04-07 20:58:16 +0000
+++ src/ai/ai_help_structs.h 2015-05-06 07:53:54 +0000
@@ -463,13 +463,13 @@
uint32_t last_time_attackable;
uint32_t last_tested;
int16_t score;
- bool warehouse;
Widelands::ExtendedBool mines_nearby;
int16_t no_attack_counter;
EnemySiteObserver()
: warehouse_(false),
attack_soldiers(0),
+ defenders(0),
stationed_soldiers(0),
last_time_attackable(std::numeric_limits<uint32_t>::max()),
last_tested(0),
=== modified file 'src/ai/ai_hints.cc'
--- src/ai/ai_hints.cc 2015-04-18 11:20:53 +0000
+++ src/ai/ai_hints.cc 2015-05-06 07:53:54 +0000
@@ -33,7 +33,8 @@
mountain_conqueror_(section ? section->get_bool("mountain_conqueror") : false),
prohibited_till_(section ? section->get_natural("prohibited_till", 0) : 0),
forced_after_(section ? section->get_natural("forced_after", 864000) : 0), // 10 days default
- mines_percent_(section ? section->get_int("mines_percent", 100) : 0)
+ mines_percent_(section ? section->get_int("mines_percent", 100) : 0),
+ trainingsite_type_(TrainingSiteType::kNoTS)
{
if (section) {
@@ -46,13 +47,10 @@
if (!section->has_val("trainingsite_type")) {
trainingsite_type_ = TrainingSiteType::kNoTS;
} else {
- if (!strcmp(section ? section->get_string("trainingsite_type", "basic") : "basic", "basic")) {
+ if (!strcmp(section->get_string("trainingsite_type", "basic"), "basic")) {
trainingsite_type_ = TrainingSiteType::kBasic;
- } else if (!strcmp(section ? section->get_string("trainingsite_type", "basic") : "basic",
- "advanced")) {
+ } else {
trainingsite_type_ = TrainingSiteType::kAdvanced;
- } else {
- trainingsite_type_ = TrainingSiteType::kNoTS;
}
}
}
=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc 2015-04-07 20:58:16 +0000
+++ src/ai/defaultai.cc 2015-05-06 07:53:54 +0000
@@ -4467,7 +4467,7 @@
}
}
- site->second.warehouse = is_warehouse;
+ site->second.warehouse_ = is_warehouse;
// getting rid of default
if (site->second.last_time_attackable == std::numeric_limits<uint32_t>::max()) {
=== modified file 'src/ai/defaultai.h'
--- src/ai/defaultai.h 2015-03-24 20:10:11 +0000
+++ src/ai/defaultai.h 2015-05-06 07:53:54 +0000
@@ -302,7 +302,6 @@
uint16_t unstationed_milit_buildings_; // counts empty military buildings (ones where no soldier
// is belogning to)
- uint16_t military_under_constr_;
uint16_t military_last_dismantle_;
uint32_t military_last_build_; // sometimes expansions just stops, this is time of last military
// building build
=== modified file 'src/economy/portdock.cc'
--- src/economy/portdock.cc 2015-04-07 06:49:51 +0000
+++ src/economy/portdock.cc 2015-05-06 07:53:54 +0000
@@ -440,15 +440,20 @@
void PortDock::log_general_info(const EditorGameBase& egbase) {
PlayerImmovable::log_general_info(egbase);
- if (!m_warehouse) {
+ if (m_warehouse) {
Coords pos(m_warehouse->get_position());
molog("PortDock for warehouse %u (at %i,%i) in fleet %u, need_ship: %s, waiting: %" PRIuS "\n",
- m_warehouse ? m_warehouse->serial() : 0,
+ m_warehouse->serial(),
pos.x,
pos.y,
m_fleet ? m_fleet->serial() : 0,
m_need_ship ? "true" : "false",
m_waiting.size());
+ } else {
+ molog("PortDock without a warehouse in fleet %u, need_ship: %s, waiting: %" PRIuS "\n",
+ m_fleet ? m_fleet->serial() : 0,
+ m_need_ship ? "true" : "false",
+ m_waiting.size());
}
for (ShippingItem& shipping_item : m_waiting) {
Follow ups