summaryrefslogtreecommitdiffhomepage
path: root/Stars45
diff options
context:
space:
mode:
authorFWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544>2012-06-24 18:55:14 +0000
committerFWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544>2012-06-24 18:55:14 +0000
commit88a7e24d44695f49e1250a9314f03bf4c6e1cff8 (patch)
treeb02bac4b5735ede954eb48e0a2cfbead900f1fa5 /Stars45
parent05f1b225a03adeab4cda01a6c96595359464ac0e (diff)
downloadstarshatter-88a7e24d44695f49e1250a9314f03bf4c6e1cff8.zip
starshatter-88a7e24d44695f49e1250a9314f03bf4c6e1cff8.tar.gz
starshatter-88a7e24d44695f49e1250a9314f03bf4c6e1cff8.tar.bz2
A few PVS studio things5.1.87
Diffstat (limited to 'Stars45')
-rw-r--r--Stars45/FighterAI.cpp24
-rw-r--r--Stars45/HUDView.cpp4
-rw-r--r--Stars45/Main.cpp2
-rw-r--r--Stars45/ShipAI.cpp2
-rw-r--r--Stars45/ShipDesign.cpp3
-rw-r--r--Stars45/Starshatter.cpp1
6 files changed, 24 insertions, 12 deletions
diff --git a/Stars45/FighterAI.cpp b/Stars45/FighterAI.cpp
index 0102f21..835bd00 100644
--- a/Stars45/FighterAI.cpp
+++ b/Stars45/FighterAI.cpp
@@ -1604,20 +1604,22 @@ FighterAI::EvadeThreat()
else {
evading = true;
-
- if (target == threat) {
- if (target->Type() == SimObject::SIM_SHIP) {
- Ship* tgt_ship = (Ship*) target;
- if (tgt_ship->GetTrigger(0)) {
- SetTarget(0);
- drop_time = 3;
+
+ if (target != nullptr) {
+ if (target == threat) {
+ if (target->Type() == SimObject::SIM_SHIP) {
+ Ship* tgt_ship = (Ship*) target;
+ if (tgt_ship->GetTrigger(0)) {
+ SetTarget(0);
+ drop_time = 3;
+ }
}
}
- }
- else if (target && threat_dist < threat_range / 2) {
- SetTarget(0);
- drop_time = 3;
+ else if (target && threat_dist < threat_range / 2) {
+ SetTarget(0);
+ drop_time = 3;
+ }
}
if (target)
diff --git a/Stars45/HUDView.cpp b/Stars45/HUDView.cpp
index 48953ac..5edda65 100644
--- a/Stars45/HUDView.cpp
+++ b/Stars45/HUDView.cpp
@@ -959,6 +959,10 @@ HUDView::DrawContactMarkers()
// draw life bars on targeted ship:
if (target && target->Type() == SimObject::SIM_SHIP && target->Rep()) {
Ship* tgt_ship = (Ship*) target;
+ if (tgt_ship == nullptr) {
+ Print(" Null Pointer in HUDView::DrawContactMarkers(). Please investigate.");
+ return;
+ }
Graphic* g = tgt_ship->Rep();
Rect r = g->ScreenRect();
diff --git a/Stars45/Main.cpp b/Stars45/Main.cpp
index 340e393..6f307d7 100644
--- a/Stars45/Main.cpp
+++ b/Stars45/Main.cpp
@@ -38,7 +38,7 @@ extern FILE* ErrLog;
extern int VD3D_describe_things;
int dump_missions = 0;
-const char* versionInfo = "5.1.66";
+const char* versionInfo = "5.1.87 EX";
static void PrintLogHeader()
{
diff --git a/Stars45/ShipAI.cpp b/Stars45/ShipAI.cpp
index 27e12d3..876f067 100644
--- a/Stars45/ShipAI.cpp
+++ b/Stars45/ShipAI.cpp
@@ -101,6 +101,8 @@ ShipAI::GetWard() const
void
ShipAI::SetWard(Ship* s)
{
+ if (ship == nullptr)
+ return;
if (s == ship->GetWard())
return;
diff --git a/Stars45/ShipDesign.cpp b/Stars45/ShipDesign.cpp
index 9965d3d..92a5c30 100644
--- a/Stars45/ShipDesign.cpp
+++ b/Stars45/ShipDesign.cpp
@@ -3590,6 +3590,8 @@ void
ShipDesign::ParseSkinMtl(TermStruct* val, Skin* skin)
{
Material* mtl = new(__FILE__,__LINE__) Material;
+ if (mtl == nullptr)
+ return;
for (int i = 0; i < val->elements()->size(); i++) {
TermDef* def = val->elements()->at(i)->isDef();
@@ -3675,6 +3677,7 @@ ShipDesign::ParseSkinMtl(TermStruct* val, Skin* skin)
Print("WARNING: invalid or missing tex_emissive in '%s'\n", filename);
DataLoader* loader = DataLoader::GetLoader();
+
loader->LoadTexture(tex_name, mtl->tex_emissive);
}
}
diff --git a/Stars45/Starshatter.cpp b/Stars45/Starshatter.cpp
index 7641227..b2cded4 100644
--- a/Stars45/Starshatter.cpp
+++ b/Stars45/Starshatter.cpp
@@ -425,6 +425,7 @@ Starshatter::InitGame()
input = new(__FILE__,__LINE__) MultiController;
Keyboard* k = new(__FILE__,__LINE__) Keyboard;
input->AddController(k);
+ ActivateKeyboardLayout(GetKeyboardLayout(0), 0);
mouse_input = new(__FILE__,__LINE__) MouseController;
input->AddController(mouse_input);