diff options
author | FWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544> | 2011-12-09 14:12:12 +0000 |
---|---|---|
committer | FWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544> | 2011-12-09 14:12:12 +0000 |
commit | c45ce5cc4e54bdae2fd45a130d8957ec55b51b1b (patch) | |
tree | e7ac533ff4006d455246d4e6d85a87f1966b9dd4 /nGenEx | |
parent | ef83cdced6bc0fd4ee94f03237ad0201ef012a6b (diff) | |
download | starshatter-c45ce5cc4e54bdae2fd45a130d8957ec55b51b1b.zip starshatter-c45ce5cc4e54bdae2fd45a130d8957ec55b51b1b.tar.gz starshatter-c45ce5cc4e54bdae2fd45a130d8957ec55b51b1b.tar.bz2 |
A few fixes recommended by PVS Studio
Diffstat (limited to 'nGenEx')
-rw-r--r-- | nGenEx/AviFile.h | 24 | ||||
-rw-r--r-- | nGenEx/Font.cpp | 5 | ||||
-rw-r--r-- | nGenEx/Game.cpp | 4 | ||||
-rw-r--r-- | nGenEx/Polygon.cpp | 1 | ||||
-rw-r--r-- | nGenEx/VideoDX9.cpp | 26 |
5 files changed, 24 insertions, 36 deletions
diff --git a/nGenEx/AviFile.h b/nGenEx/AviFile.h index 495693a..6421504 100644 --- a/nGenEx/AviFile.h +++ b/nGenEx/AviFile.h @@ -43,18 +43,18 @@ public: HRESULT GetFrame(double seconds, Bitmap& bmp);
private:
- Text filename;
- Rect rect;
- int fps;
- bool play;
-
- IAVIFile* pfile; // created by CreateAvi
- IAVIStream* ps;
- IAVIStream* ps_comp; // video stream, when first created
- DWORD frame_size; // total bytes per frame of video
- DWORD nframe; // which frame will be added next
- DWORD nsamp; // which sample will be added next
- bool iserr; // if true, then no function will do anything
+ Rect rect;
+ Text filename;
+ int fps;
+
+ IAVIFile* pfile; // created by CreateAvi
+ IAVIStream* ps;
+ IAVIStream* ps_comp; // video stream, when first created
+ DWORD frame_size; // total bytes per frame of video
+ DWORD nframe; // which frame will be added next
+ DWORD nsamp; // which sample will be added next
+ bool play;
+ bool iserr; // if true, then no function will do anything
};
// +--------------------------------------------------------------------+
diff --git a/nGenEx/Font.cpp b/nGenEx/Font.cpp index 04127c6..02dca6a 100644 --- a/nGenEx/Font.cpp +++ b/nGenEx/Font.cpp @@ -416,7 +416,7 @@ Font::FindEdges(BYTE c, double* l, double* r) static bool nokern(char c)
{
- if (c <= Font::ARROW_RIGHT || c >= 128)
+ if (c <= Font::ARROW_RIGHT)
return true;
const char* nokernchars = "0123456789+=<>-.,:;?'\"";
@@ -917,14 +917,13 @@ Font::DrawTextMulti(const char* text, int count, const Rect& text_rect, Rect& cl else if (flags & DT_CENTER)
align = DT_CENTER;
- int nlines = 1;
int max_width = 0;
int line_start = 0;
int count_remaining = count;
int xoffset = 0;
int yoffset = 0;
- nlines = 0;
+ int nlines = 0;
// repeat for each line of text:
while (count_remaining > 0) {
diff --git a/nGenEx/Game.cpp b/nGenEx/Game.cpp index f297955..8c20432 100644 --- a/nGenEx/Game.cpp +++ b/nGenEx/Game.cpp @@ -282,10 +282,8 @@ Game::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow) if (status == OK) {
Print(" Initializing content...\n");
InitContent();
- }
- if (status == OK) {
- Print(" Initializing game...\n");
+ Print(" Initializing game...\n");
if (!InitGame()) {
if (!panicbuf[0])
Panic("Could not initialize the game.");
diff --git a/nGenEx/Polygon.cpp b/nGenEx/Polygon.cpp index d5c581f..1dc1326 100644 --- a/nGenEx/Polygon.cpp +++ b/nGenEx/Polygon.cpp @@ -64,7 +64,6 @@ VertexSet::Resize(int m, bool preserve) if (!loc || !nrm || !s_loc || !rw || !tu || !tv || !diffuse || !specular) {
nverts = 0;
- nverts = 0;
delete [] loc;
delete [] nrm;
diff --git a/nGenEx/VideoDX9.cpp b/nGenEx/VideoDX9.cpp index 5b6984b..d54ae1e 100644 --- a/nGenEx/VideoDX9.cpp +++ b/nGenEx/VideoDX9.cpp @@ -265,6 +265,10 @@ VideoDX9::VideoDX9(const HWND& window, VideoSettings* vs) d3d = Direct3DCreate9(D3D_SDK_VERSION);
dx9enum = new(__FILE__,__LINE__) VideoDX9Enum(d3d);
+ // DEBUG
+ vs->is_windowed = true;
+ // DEBUG
+
if (d3d && dx9enum) {
if (vs) {
dx9enum->req_fullscreen = vs->is_windowed ? false : true;
@@ -3364,24 +3368,12 @@ VideoDX9::SetupPass(int pass) current_texture = texture_0;
if (tex_bmp_1) {
- if (strategy >= DX9_STRATEGY_BLEND) {
- texture_1 = texcache->FindTexture(tex_bmp_1);
- hr = d3ddevice->SetTexture(1, texture_1);
-
- if (tex_bmp_2) {
- texture_2 = texcache->FindTexture(tex_bmp_2);
- hr = d3ddevice->SetTexture(2, texture_2);
- }
- }
+ texture_1 = texcache->FindTexture(tex_bmp_1);
+ hr = d3ddevice->SetTexture(1, texture_1);
- else {
- texture_1 = texcache->FindTexture(tex_bmp_1);
- hr = d3ddevice->SetTexture(1, texture_1);
-
- if (tex_bmp_2) {
- texture_2 = texcache->FindTexture(tex_bmp_2);
- hr = d3ddevice->SetTexture(2, texture_2);
- }
+ if (tex_bmp_2) {
+ texture_2 = texcache->FindTexture(tex_bmp_2);
+ hr = d3ddevice->SetTexture(2, texture_2);
}
}
}
|