fix harmless warnings and properly try/catch allocations via new
otherwise the error handling will never be triggered
This commit is contained in:
parent
06b760e8dd
commit
3b11d6019b
|
@ -27,7 +27,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
#if _WIN32
|
||||
#include <windows.h>
|
||||
#include <Windows.h>
|
||||
|
||||
// Windows subsystem main
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
|
||||
|
|
|
@ -40,10 +40,10 @@ TBall::TBall(TPinballTable* table) : TPinballComponent(table, -1, false)
|
|||
|
||||
Offset = *loader::query_float_attribute(groupIndex, 0, 500);
|
||||
auto visualCount = loader::query_visual_states(groupIndex);
|
||||
auto index = 0;
|
||||
if (visualCount > 0)
|
||||
{
|
||||
auto visualZPtr = VisualZArray;
|
||||
int index = 0;
|
||||
do
|
||||
{
|
||||
loader::query_visual(groupIndex, index, &visual);
|
||||
|
|
|
@ -20,7 +20,7 @@ void TEdgeSegment::port_draw()
|
|||
TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* collComp, char* activeFlagPtr,
|
||||
unsigned int collisionGroup, float offset, size_t wallValue)
|
||||
{
|
||||
vector_type center{}, start{}, end{}, prevCenter{}, vec1{}, vec2{}, dstVec{};
|
||||
vector_type center{}, start{}, end{}, vec1{}, vec2{}, dstVec{};
|
||||
TEdgeSegment* edge = nullptr;
|
||||
|
||||
wall_type wallType = static_cast<wall_type>(static_cast<int>(floor(*floatArr) - 1.0f));
|
||||
|
@ -31,7 +31,14 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
|
|||
center.X = floatArr[1];
|
||||
center.Y = floatArr[2];
|
||||
auto radius = offset + floatArr[3];
|
||||
auto circle = new TCircle(collComp, activeFlagPtr, collisionGroup, ¢er, radius);
|
||||
TCircle* circle = nullptr;
|
||||
try
|
||||
{
|
||||
circle = new TCircle(collComp, activeFlagPtr, collisionGroup, ¢er, radius);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
edge = circle;
|
||||
|
||||
if (circle)
|
||||
|
@ -49,7 +56,14 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
|
|||
start.Y = floatArr[2];
|
||||
end.X = floatArr[3];
|
||||
end.Y = floatArr[4];
|
||||
auto line = new TLine(collComp, activeFlagPtr, collisionGroup, &start, &end);
|
||||
TLine* line = nullptr;
|
||||
try
|
||||
{
|
||||
line = new TLine(collComp, activeFlagPtr, collisionGroup, &start, &end);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
edge = line;
|
||||
|
||||
if (line)
|
||||
|
@ -65,6 +79,7 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
|
|||
{
|
||||
int wallTypeI = static_cast<int>(wallType);
|
||||
auto floatArrPtr = floatArr + 1;
|
||||
vector_type prevCenter{};
|
||||
prevCenter.X = floatArr[2 * wallTypeI - 1];
|
||||
prevCenter.Y = floatArr[2 * wallTypeI];
|
||||
|
||||
|
@ -97,7 +112,14 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
|
|||
dstVec.Z < 0.0f && offset < 0.0f)
|
||||
{
|
||||
float radius = offset * 1.001f;
|
||||
auto circle = new TCircle(collComp, activeFlagPtr, collisionGroup, ¢er, radius);
|
||||
TCircle* circle = nullptr;
|
||||
try
|
||||
{
|
||||
circle = new TCircle(collComp, activeFlagPtr, collisionGroup, ¢er, radius);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
if (circle)
|
||||
{
|
||||
|
@ -112,7 +134,14 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
|
|||
start.Y = floatArrPtr[1];
|
||||
end.X = floatArrPtr[2];
|
||||
end.Y = floatArrPtr[3];
|
||||
auto line = new TLine(collComp, activeFlagPtr, collisionGroup, &start, &end);
|
||||
TLine* line = nullptr;
|
||||
try
|
||||
{
|
||||
line = new TLine(collComp, activeFlagPtr, collisionGroup, &start, &end);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
edge = line;
|
||||
|
||||
if (line)
|
||||
|
|
|
@ -21,14 +21,28 @@ TFlagSpinner::TFlagSpinner(TPinballTable* table, int groupIndex) : TCollisionCom
|
|||
end.Y = visual.FloatArr[1];
|
||||
start.X = visual.FloatArr[2];
|
||||
start.Y = visual.FloatArr[3];
|
||||
auto line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &start, &end);
|
||||
TLine* line = nullptr;
|
||||
try
|
||||
{
|
||||
line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &start, &end);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
if (line)
|
||||
{
|
||||
line->place_in_grid();
|
||||
EdgeList.push_back(line);
|
||||
}
|
||||
|
||||
line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &end, &start);
|
||||
line = nullptr;
|
||||
try
|
||||
{
|
||||
line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &end, &start);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
PrevCollider = line;
|
||||
if (line)
|
||||
{
|
||||
|
|
|
@ -34,20 +34,26 @@ TFlipper::TFlipper(TPinballTable* table, int groupIndex) : TCollisionComponent(t
|
|||
auto vecT2 = reinterpret_cast<vector_type*>(loader::query_float_attribute(groupIndex, 0, 802));
|
||||
auto vecT1 = reinterpret_cast<vector_type*>(loader::query_float_attribute(groupIndex, 0, 801));
|
||||
auto origin = reinterpret_cast<vector_type*>(loader::query_float_attribute(groupIndex, 0, 800));
|
||||
auto flipperEdge = new TFlipperEdge(
|
||||
this,
|
||||
&ActiveFlag,
|
||||
visual.CollisionGroup,
|
||||
table,
|
||||
origin,
|
||||
vecT1,
|
||||
vecT2,
|
||||
extendTime,
|
||||
retractTime,
|
||||
collMult,
|
||||
Elasticity,
|
||||
Smoothness);
|
||||
|
||||
TFlipperEdge* flipperEdge = nullptr;
|
||||
try
|
||||
{
|
||||
flipperEdge = new TFlipperEdge(
|
||||
this,
|
||||
&ActiveFlag,
|
||||
visual.CollisionGroup,
|
||||
table,
|
||||
origin,
|
||||
vecT1,
|
||||
vecT2,
|
||||
extendTime,
|
||||
retractTime,
|
||||
collMult,
|
||||
Elasticity,
|
||||
Smoothness);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
FlipperEdge = flipperEdge;
|
||||
if (flipperEdge)
|
||||
{
|
||||
|
@ -65,7 +71,7 @@ TFlipper::~TFlipper()
|
|||
|
||||
int TFlipper::Message(int code, float value)
|
||||
{
|
||||
if (code == 1 || code == 2 || code > 1008 && code <= 1011 || code == 1022)
|
||||
if (code == 1 || code == 2 || (code > 1008 && code <= 1011) || code == 1022)
|
||||
{
|
||||
float timerTime;
|
||||
int command = code;
|
||||
|
|
|
@ -109,7 +109,6 @@ float TFlipperEdge::FindCollisionDistance(ray_type* ray)
|
|||
{
|
||||
if (FlipperFlag == 0)
|
||||
{
|
||||
EdgeCollisionFlag = 0;
|
||||
CollisionFlag1 = 0;
|
||||
CollisionFlag2 = 0;
|
||||
set_control_points(ogRay->TimeNow);
|
||||
|
@ -436,7 +435,6 @@ float TFlipperEdge::flipper_angle(float timeNow)
|
|||
|
||||
int TFlipperEdge::is_ball_inside(float x, float y)
|
||||
{
|
||||
vector_type testPoint{};
|
||||
float dx = RotOrigin.X - x;
|
||||
float dy = RotOrigin.Y - y;
|
||||
if ((A2.X - A1.X) * (y - A1.Y) - (A2.Y - A1.Y) * (x - A1.X) >= 0.0f &&
|
||||
|
@ -447,6 +445,7 @@ int TFlipperEdge::is_ball_inside(float x, float y)
|
|||
(T1.Y - y) * (T1.Y - y) + (T1.X - x) * (T1.X - x) < CircleT1RadiusSq)
|
||||
{
|
||||
float flipperLR = AngleMax < 0.0f ? -1.0f : 1.0f;
|
||||
vector_type testPoint{};
|
||||
if (FlipperFlag == 1)
|
||||
testPoint = AngleMax < 0.0f ? B1 : B2;
|
||||
else if (FlipperFlag == 2)
|
||||
|
|
|
@ -30,9 +30,16 @@ THole::THole(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
|||
if (Circle.RadiusSq == 0.0f)
|
||||
Circle.RadiusSq = 0.001f;
|
||||
|
||||
auto tCircle = new TCircle(this, &ActiveFlag, visual.CollisionGroup,
|
||||
reinterpret_cast<vector_type*>(visual.FloatArr),
|
||||
Circle.RadiusSq);
|
||||
TCircle* tCircle = nullptr;
|
||||
try
|
||||
{
|
||||
tCircle = new TCircle(this, &ActiveFlag, visual.CollisionGroup,
|
||||
reinterpret_cast<vector_type*>(visual.FloatArr),
|
||||
Circle.RadiusSq);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
if (tCircle)
|
||||
{
|
||||
tCircle->place_in_grid();
|
||||
|
|
|
@ -35,8 +35,15 @@ TKickout::TKickout(TPinballTable* table, int groupIndex, bool someFlag): TCollis
|
|||
Circle.RadiusSq = *loader::query_float_attribute(groupIndex, 0, 306) * visual.FloatArr[2];
|
||||
if (Circle.RadiusSq == 0.0f)
|
||||
Circle.RadiusSq = 0.001f;
|
||||
auto tCircle = new TCircle(this, &ActiveFlag, visual.CollisionGroup,
|
||||
reinterpret_cast<vector_type*>(visual.FloatArr), Circle.RadiusSq);
|
||||
TCircle* tCircle = nullptr;
|
||||
try
|
||||
{
|
||||
tCircle = new TCircle(this, &ActiveFlag, visual.CollisionGroup,
|
||||
reinterpret_cast<vector_type*>(visual.FloatArr), Circle.RadiusSq);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
if (tCircle)
|
||||
{
|
||||
tCircle->place_in_grid();
|
||||
|
|
|
@ -17,7 +17,13 @@ TLightBargraph::TLightBargraph(TPinballTable* table, int groupIndex) : TLightGro
|
|||
if (floatArr)
|
||||
{
|
||||
auto count = 2 * List.size();
|
||||
TimerTimeArray = new float[count];
|
||||
try
|
||||
{
|
||||
TimerTimeArray = new float[count];
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
if (TimerTimeArray)
|
||||
{
|
||||
for (auto i = 0u; i < count; ++floatArr)
|
||||
|
|
|
@ -432,7 +432,7 @@ int TLightGroup::next_light_up()
|
|||
{
|
||||
for (auto index = 0u; index < List.size(); ++index)
|
||||
{
|
||||
if (!List.at(index)->BmpIndex1)
|
||||
if (!List[index]->BmpIndex1)
|
||||
return static_cast<int>(index);
|
||||
}
|
||||
return -1;
|
||||
|
|
|
@ -20,8 +20,14 @@ TOneway::TOneway(TPinballTable* table, int groupIndex) : TCollisionComponent(tab
|
|||
linePt2.Y = visual.FloatArr[1];
|
||||
linePt1.X = visual.FloatArr[2];
|
||||
linePt1.Y = visual.FloatArr[3];
|
||||
|
||||
auto line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &linePt2, &linePt1);
|
||||
TLine* line = nullptr;
|
||||
try
|
||||
{
|
||||
line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &linePt2, &linePt1);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
if (line)
|
||||
{
|
||||
line->Offset(table->CollisionCompOffset);
|
||||
|
@ -29,7 +35,14 @@ TOneway::TOneway(TPinballTable* table, int groupIndex) : TCollisionComponent(tab
|
|||
EdgeList.push_back(line);
|
||||
}
|
||||
|
||||
line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &linePt1, &linePt2);
|
||||
line = nullptr;
|
||||
try
|
||||
{
|
||||
line = new TLine(this, &ActiveFlag, visual.CollisionGroup, &linePt1, &linePt2);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
Line = line;
|
||||
if (line)
|
||||
{
|
||||
|
|
|
@ -58,7 +58,14 @@ TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false)
|
|||
MultiballFlag = 0;
|
||||
PlayerCount = 0;
|
||||
|
||||
auto ballObj = new TBall(this);
|
||||
TBall* ballObj = nullptr;
|
||||
try
|
||||
{
|
||||
ballObj = new TBall(this);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
BallList.push_back(ballObj);
|
||||
if (ballObj)
|
||||
ballObj->ActiveFlag = 0;
|
||||
|
@ -368,7 +375,7 @@ int TPinballTable::Message(int code, float value)
|
|||
LightGroup->Message(34, 0.0);
|
||||
LightGroup->Message(20, 0.0);
|
||||
Plunger->Message(1016, 0.0);
|
||||
if (Demo->ActiveFlag)
|
||||
if (Demo && Demo->ActiveFlag)
|
||||
rc_text = pinball::get_rc_string(30, 0);
|
||||
else
|
||||
rc_text = pinball::get_rc_string(26, 0);
|
||||
|
|
|
@ -116,7 +116,14 @@ TRamp::TRamp(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
|||
}
|
||||
if (collisionGroup)
|
||||
{
|
||||
auto line = new TLine(this, &ActiveFlag, collisionGroup, point1, point2);
|
||||
TLine* line = nullptr;
|
||||
try
|
||||
{
|
||||
line = new TLine(this, &ActiveFlag, collisionGroup, point1, point2);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
EdgeList.push_back(line);
|
||||
if (line)
|
||||
{
|
||||
|
|
|
@ -44,7 +44,6 @@ void TRollover::Collision(TBall* ball, vector_type* nextPosition, vector_type* d
|
|||
ball->Position.Y = nextPosition->Y;
|
||||
ball->RayMaxDistance -= coef;
|
||||
ball->not_again(edge);
|
||||
gdrv_bitmap8* bmp = nullptr;
|
||||
if (!PinballTable->TiltLockFlag)
|
||||
{
|
||||
if (RolloverFlag)
|
||||
|
@ -60,6 +59,7 @@ void TRollover::Collision(TBall* ball, vector_type* nextPosition, vector_type* d
|
|||
RolloverFlag = RolloverFlag == 0;
|
||||
if (ListBitmap)
|
||||
{
|
||||
gdrv_bitmap8* bmp = nullptr;
|
||||
if (!RolloverFlag)
|
||||
bmp = ListBitmap->at(0);
|
||||
render::sprite_set_bitmap(RenderSprite, bmp);
|
||||
|
|
|
@ -80,13 +80,20 @@ TTableLayer::TTableLayer(TPinballTable* table): TCollisionComponent(table, -1, f
|
|||
|
||||
for (auto visFloatArrCount = visual.FloatArrCount; visFloatArrCount > 0; visFloatArrCount--)
|
||||
{
|
||||
auto line = new TLine(this,
|
||||
&ActiveFlag,
|
||||
visual.CollisionGroup,
|
||||
visArrPtr[2],
|
||||
visArrPtr[3],
|
||||
visArrPtr[0],
|
||||
visArrPtr[1]);
|
||||
TLine* line = nullptr;
|
||||
try
|
||||
{
|
||||
line = new TLine(this,
|
||||
&ActiveFlag,
|
||||
visual.CollisionGroup,
|
||||
visArrPtr[2],
|
||||
visArrPtr[3],
|
||||
visArrPtr[0],
|
||||
visArrPtr[1]);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
if (line)
|
||||
{
|
||||
line->place_in_grid();
|
||||
|
|
|
@ -123,7 +123,14 @@ void TTextBox::Display(const char* text, float time)
|
|||
if (Timer == -1)
|
||||
Clear();
|
||||
|
||||
auto message = new TTextBoxMessage(text, time);
|
||||
TTextBoxMessage* message = nullptr;
|
||||
try
|
||||
{
|
||||
message = new TTextBoxMessage(text, time);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
if (message)
|
||||
{
|
||||
if (message->Text)
|
||||
|
|
|
@ -10,7 +10,14 @@ TTextBoxMessage::TTextBoxMessage(const char* text, float time)
|
|||
if (text)
|
||||
{
|
||||
const auto textLen = strlen(text) + 1;
|
||||
Text = new char[textLen];
|
||||
Text = nullptr;
|
||||
try
|
||||
{
|
||||
Text = new char[textLen];
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
if (Text)
|
||||
strncpy(Text, text, textLen);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "TBall.h"
|
||||
#include "TPinballTable.h"
|
||||
|
||||
TTripwire::TTripwire(TPinballTable* table, int groupIndex) : TRollover(table, groupIndex, 1)
|
||||
TTripwire::TTripwire(TPinballTable* table, int groupIndex) : TRollover(table, groupIndex, true)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -206,9 +206,6 @@ void maths::line_init(line_type* line, float x0, float y0, float x1, float y1)
|
|||
|
||||
float maths::ray_intersect_line(ray_type* ray, line_type* line)
|
||||
{
|
||||
bool v5;
|
||||
bool v6;
|
||||
|
||||
float perpDot = line->PerpendicularL.Y * ray->Direction.Y + ray->Direction.X * line->PerpendicularL.X;
|
||||
if (perpDot < 0.0f)
|
||||
{
|
||||
|
@ -224,8 +221,8 @@ float maths::ray_intersect_line(ray_type* ray, line_type* line)
|
|||
{
|
||||
if (v4 >= line->OriginX)
|
||||
{
|
||||
v5 = v4 < line->OriginY;
|
||||
v6 = v4 == line->OriginY;
|
||||
bool v5 = v4 < line->OriginY;
|
||||
bool v6 = v4 == line->OriginY;
|
||||
if (v5 || v6)
|
||||
return result;
|
||||
return 1000000000.0;
|
||||
|
@ -234,8 +231,8 @@ float maths::ray_intersect_line(ray_type* ray, line_type* line)
|
|||
else if (line->OriginX <= line->RayIntersect.X)
|
||||
{
|
||||
float v7 = line->RayIntersect.X;
|
||||
v5 = v7 < line->OriginY;
|
||||
v6 = v7 == line->OriginY;
|
||||
bool v5 = v7 < line->OriginY;
|
||||
bool v6 = v7 == line->OriginY;
|
||||
if (v5 || v6)
|
||||
return result;
|
||||
return 1000000000.0;
|
||||
|
@ -299,7 +296,7 @@ float maths::basic_collision(TBall* ball, vector_type* nextPosition, vector_type
|
|||
return projSpeed;
|
||||
}
|
||||
|
||||
float maths::Distance_Squared(vector_type vec1, vector_type vec2)
|
||||
float maths::Distance_Squared(vector_type& vec1, vector_type& vec2)
|
||||
{
|
||||
return (vec1.Y - vec2.Y) * (vec1.Y - vec2.Y) + (vec1.X - vec2.X) * (vec1.X - vec2.X);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
static float basic_collision(TBall* ball, vector_type* nextPosition, vector_type* direction, float elasticity,
|
||||
float smoothness,
|
||||
float threshold, float boost);
|
||||
static float Distance_Squared(vector_type vec1, vector_type vec2);
|
||||
static float Distance_Squared(vector_type& vec1, vector_type& vec2);
|
||||
static float DotProduct(vector_type* vec1, vector_type* vec2);
|
||||
static void vswap(vector_type* vec1, vector_type* vec2);
|
||||
static float Distance(vector_type* vec1, vector_type* vec2);
|
||||
|
|
|
@ -27,8 +27,12 @@ DatFile* partman::load_records(LPCSTR lpFileName, bool fullTiltMode)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto datFile = new DatFile();
|
||||
if (!datFile)
|
||||
DatFile* datFile;
|
||||
try
|
||||
{
|
||||
datFile = new DatFile();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
fclose(fileHandle);
|
||||
return nullptr;
|
||||
|
@ -39,8 +43,12 @@ DatFile* partman::load_records(LPCSTR lpFileName, bool fullTiltMode)
|
|||
|
||||
if (header.Unknown)
|
||||
{
|
||||
auto unknownBuf = new char[header.Unknown];
|
||||
if (!unknownBuf)
|
||||
char* unknownBuf;
|
||||
try
|
||||
{
|
||||
unknownBuf = new char[header.Unknown];
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
fclose(fileHandle);
|
||||
delete datFile;
|
||||
|
@ -107,13 +115,18 @@ DatFile* partman::load_records(LPCSTR lpFileName, bool fullTiltMode)
|
|||
}
|
||||
else
|
||||
{
|
||||
auto entryBuffer = new char[fieldSize];
|
||||
entryData->Buffer = entryBuffer;
|
||||
if (!entryBuffer)
|
||||
char* entryBuffer;
|
||||
try
|
||||
{
|
||||
entryBuffer = new char[fieldSize];
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
entryData->Buffer = nullptr;
|
||||
abort = true;
|
||||
break;
|
||||
}
|
||||
entryData->Buffer = entryBuffer;
|
||||
fread(entryBuffer, 1, fieldSize, fileHandle);
|
||||
}
|
||||
|
||||
|
|
|
@ -142,9 +142,15 @@ void render::sprite_modified(render_sprite_type_struct* sprite)
|
|||
render_sprite_type_struct* render::create_sprite(VisualTypes visualType, gdrv_bitmap8* bmp, zmap_header_type* zMap,
|
||||
int xPosition, int yPosition, rectangle_type* rect)
|
||||
{
|
||||
auto sprite = new render_sprite_type_struct();
|
||||
if (!sprite)
|
||||
render_sprite_type_struct* sprite;
|
||||
try
|
||||
{
|
||||
sprite = new render_sprite_type_struct();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
sprite->BmpRect.YPosition = yPosition;
|
||||
sprite->BmpRect.XPosition = xPosition;
|
||||
sprite->Bmp = bmp;
|
||||
|
@ -420,7 +426,7 @@ void render::build_occlude_list()
|
|||
}
|
||||
}
|
||||
|
||||
if (!mainSprite->UnknownFlag && mainSprite->Bmp && spriteArr->size() < 2)
|
||||
if (mainSprite->Bmp && spriteArr->size() < 2)
|
||||
spriteArr->clear();
|
||||
if (!spriteArr->empty())
|
||||
{
|
||||
|
|
|
@ -18,9 +18,15 @@ int score::init()
|
|||
|
||||
scoreStruct* score::create(LPCSTR fieldName, gdrv_bitmap8* renderBgBmp)
|
||||
{
|
||||
auto score = new scoreStruct();
|
||||
if (!score)
|
||||
scoreStruct* score;
|
||||
try
|
||||
{
|
||||
score = new scoreStruct();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
score->Score = -9999;
|
||||
score->BackgroundBmp = renderBgBmp;
|
||||
|
||||
|
|
|
@ -12,10 +12,17 @@ timer_struct* timer::TimerBuffer;
|
|||
|
||||
int timer::init(int count)
|
||||
{
|
||||
auto buf = new timer_struct[count];
|
||||
TimerBuffer = buf;
|
||||
if (!buf)
|
||||
timer_struct* buf;
|
||||
try
|
||||
{
|
||||
buf = new timer_struct[count];
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
TimerBuffer = nullptr;
|
||||
return 1;
|
||||
}
|
||||
TimerBuffer = buf;
|
||||
Count = 0;
|
||||
MaxCount = count;
|
||||
SetCount = 1;
|
||||
|
|
Loading…
Reference in New Issue