• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。


Commit MetaInfo

Revision305 (tree)
Zeit2022-04-20 00:57:46
Autorxops-mikan

Log Message

各箇所の関数の引数判定を厳格化、一部関数の戻り値仕様を変更、一部コーディングスタイルを修正

Ändern Zusammenfassung

Diff

--- trunk/ai.cpp (revision 304)
+++ trunk/ai.cpp (revision 305)
@@ -1414,6 +1414,8 @@
14141414 if( ObjMgr == NULL ){ return false; }
14151415 if( ctrlhuman == NULL ){ return false; }
14161416
1417+ if( (id < 0)||(MAX_HUMAN-1 < id) ){ return false; }
1418+
14171419 //ターゲットのクラスを取得
14181420 class human* thuman;
14191421 thuman = ObjMgr->GetHumanObject(id);
@@ -1809,7 +1811,7 @@
18091811 //! @attention 移動パスに関わらず、指定した人への追尾を強制します。Init()関数を再度実行するまで元に戻せません。
18101812 void AIcontrol::SetHoldTracking(int id)
18111813 {
1812- MoveNavi->SetHoldTracking(id);
1814+ if( (0 <= id)&&(id < MAX_HUMAN) ){ MoveNavi->SetHoldTracking(id); }
18131815 }
18141816
18151817 //! @brief 強制的に警戒させる
@@ -2119,6 +2121,8 @@
21192121 //! @attention 移動パスに関わらず、指定した人への追尾を強制します。Init()関数を再度実行するまで元に戻せません。
21202122 void AIMoveNavi::SetHoldTracking(int id)
21212123 {
2124+ if( (id < 0)||(MAX_HUMAN-1 < id) ){ return; }
2125+
21222126 movemode = AI_TRACKING;
21232127 hold = true;
21242128 target_humanid = id;
--- trunk/config.cpp (revision 304)
+++ trunk/config.cpp (revision 305)
@@ -62,6 +62,8 @@
6262 //! @return 成功:0 失敗:1
6363 int Config::LoadFile(const char *fname)
6464 {
65+ if( fname == NULL ){ return 1; }
66+
6567 FILE *fp;
6668 char buf;
6769
@@ -77,9 +79,7 @@
7779
7880 //ファイルを開く
7981 fp = fopen(fname, "rb");
80- if( fp == NULL ){
81- return 1;
82- }
82+ if( fp == NULL ){ return 1; }
8383
8484 //キーコード
8585 for(int i=0; i<TOTAL_ControlKey; i++){
@@ -143,6 +143,8 @@
143143 //! @return 成功:0 失敗:1
144144 int Config::SaveFile(const char *fname)
145145 {
146+ if( fname == NULL ){ return 1; }
147+
146148 FILE *fp;
147149 char buf;
148150
@@ -158,9 +160,7 @@
158160
159161 //ファイルを開く
160162 fp = fopen(fname, "wb");
161- if( fp == NULL ){
162- return 1;
163- }
163+ if( fp == NULL ){ return 1; }
164164
165165 //キーコード
166166 for(int i=0; i<TOTAL_ControlKey; i++){
@@ -512,6 +512,8 @@
512512 int Config::LoadExtFile(const char *fname)
513513 {
514514 #ifdef ENABLE_ADDCONFIG
515+ if( fname == NULL ){ return 1; }
516+
515517 INIFileInterface INIConfig;
516518 int mode;
517519
--- trunk/d3dgraphics-directx.cpp (revision 304)
+++ trunk/d3dgraphics-directx.cpp (revision 305)
@@ -121,6 +121,9 @@
121121 //! @return 成功:0 失敗:1
122122 int D3DGraphics::InitD3D(WindowControl *WindowCtrl, const char *TextureFontFilename, bool fullscreen)
123123 {
124+ if( WindowCtrl == NULL ){ return 1; }
125+ if( TextureFontFilename == NULL ){ return 1; }
126+
124127 #ifdef ENABLE_DEBUGLOG
125128 //ログに出力
126129 OutputLog.WriteLog(LOG_INIT, "Graphics", "DirectX");
@@ -259,6 +262,8 @@
259262 //! @return 成功:0 待ち:1 失敗:2
260263 int D3DGraphics::ResetD3D(WindowControl *WindowCtrl)
261264 {
265+ if( WindowCtrl == NULL ){ return 2; }
266+
262267 //フォーカスを失っているなら待たせる
263268 if( pd3dDevice->TestCooperativeLevel() == D3DERR_DEVICELOST ){
264269 return 1;
@@ -488,6 +493,8 @@
488493 //! @return 成功:モデル認識番号(0以上) 失敗:-1
489494 int D3DGraphics::LoadModel(const char* filename)
490495 {
496+ if( filename == NULL ){ return -1; }
497+
491498 #ifdef ENABLE_DEBUGLOG
492499 //ログに出力
493500 OutputLog.WriteLog(LOG_LOAD, "Model", filename);
@@ -642,6 +649,8 @@
642649 //! @return 成功:テクスチャ認識番号(0以上) 失敗:-1
643650 int D3DGraphics::LoadTexture(const char* filename, bool texturefont, bool BlackTransparent)
644651 {
652+ if( filename == NULL ){ return -1; }
653+
645654 int id = -1;
646655 D3DXIMAGE_INFO info;
647656 int MipLevels;
@@ -844,6 +853,8 @@
844853 //無効な認識番号が指定されていたら、処理せず返す。
845854 if( id == -1 ){ return 1; }
846855 if( ptextures[id] == NULL ){ return 1; }
856+ if( width == NULL ){ return 1; }
857+ if( height == NULL ){ return 1; }
847858
848859 IDirect3DSurface9 *surface;
849860 D3DSURFACE_DESC desc;
@@ -1153,6 +1164,8 @@
11531164 //! @param *z z軸を受け取るポインタ
11541165 void D3DGraphics::GetWorldTransformPos(float *x, float *y, float *z)
11551166 {
1167+ if( (x == NULL)||(y == NULL)||(z == NULL) ){ return; }
1168+
11561169 D3DXMATRIX matWorld;
11571170 #if GRAPHIC_ENGINE == 0
11581171 pd3dDevice->GetTransform(D3DTS_WORLD, &matWorld);
@@ -1220,8 +1233,7 @@
12201233 D3DXMATRIXA16 matView;
12211234
12221235 //camera_ryを -PI〜PI の間に正規化
1223- for(; camera_ry>D3DX_PI; camera_ry -= D3DX_PI*2){}
1224- for(; camera_ry<D3DX_PI*-1; camera_ry += D3DX_PI*2){}
1236+ camera_ry = AngleNormalization(camera_ry);
12251237
12261238 //カメラの向きを決定
12271239 if( fabsf(camera_ry) == D3DX_PI/2 ){
@@ -1275,6 +1287,7 @@
12751287 {
12761288 //ブロックデータが指定されていなければ、処理しない。
12771289 if( in_blockdata == NULL ){ return; }
1290+ if( directory == NULL ){ return; }
12781291
12791292 char fname[MAX_PATH];
12801293 char fnamefull[MAX_PATH];
@@ -1785,6 +1798,7 @@
17851798 void D3DGraphics::Draw2DMSFontText(int x, int y, const char *str, int color)
17861799 {
17871800 //if( ptextsprite == NULL ){ return; }
1801+ if( str == NULL ){ return; }
17881802
17891803 //テキストスプライト初期化
17901804 Start2DMSFontTextRender();
@@ -1810,6 +1824,8 @@
18101824 //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DMSFontText()関数と同等です。
18111825 void D3DGraphics::Draw2DMSFontTextScaling(int x, int y, const char *str, int color)
18121826 {
1827+ if( str == NULL ){ return; }
1828+
18131829 float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640;
18141830 float scaling_y = (float)GameConfig.GetScreenHeight() / 480;
18151831
@@ -1830,6 +1846,7 @@
18301846 void D3DGraphics::Draw2DMSFontTextCenter(int x, int y, int w, int h, const char *str, int color)
18311847 {
18321848 //if( ptextsprite == NULL ){ return; }
1849+ if( str == NULL ){ return; }
18331850
18341851 //テキストスプライト初期化
18351852 Start2DMSFontTextRender();
@@ -1857,6 +1874,8 @@
18571874 //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DMSFontTextCenter()関数と同等です。
18581875 void D3DGraphics::Draw2DMSFontTextCenterScaling(int x, int y, int w, int h, const char *str, int color)
18591876 {
1877+ if( str == NULL ){ return; }
1878+
18601879 float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640;
18611880 float scaling_y = (float)GameConfig.GetScreenHeight() / 480;
18621881
@@ -1872,6 +1891,7 @@
18721891 void D3DGraphics::Draw2DMSSmallFontText(int x, int y, const char *str, int color)
18731892 {
18741893 //if( ptextsprite == NULL ){ return; }
1894+ if( str == NULL ){ return; }
18751895
18761896 //テキストスプライト初期化
18771897 Start2DMSFontTextRender();
@@ -1919,6 +1939,7 @@
19191939 {
19201940 //テクスチャフォントの取得に失敗していれば、処理しない
19211941 if( TextureFont == -1 ){ return; }
1942+ if( str == NULL ){ return; }
19221943
19231944 //2D描画用設定を適用
19241945 Start2DRender();
@@ -1993,6 +2014,8 @@
19932014 //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DTextureFontText()関数と同等です。
19942015 void D3DGraphics::Draw2DTextureFontTextScaling(int x, int y, const char *str, int color, int fontwidth, int fontheight)
19952016 {
2017+ if( str == NULL ){ return; }
2018+
19962019 float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640;
19972020 float scaling_y = (float)GameConfig.GetScreenHeight() / 480;
19982021
@@ -2009,6 +2032,8 @@
20092032 //! @attention 文字を二重に重ねて立体感を出さないと見にくくなります。
20102033 void D3DGraphics::Draw2DTextureFontTextCenter(int x, int y, const char *str, int color, int fontwidth, int fontheight)
20112034 {
2035+ if( str == NULL ){ return; }
2036+
20122037 Draw2DTextureFontText((GameConfig.GetScreenWidth() - strlen(str)*fontwidth)/2 + x, y, str, color, fontwidth, fontheight);
20132038 }
20142039
@@ -2022,6 +2047,8 @@
20222047 //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DTextureFontTextCenter()関数と同等です。
20232048 void D3DGraphics::Draw2DTextureFontTextCenterScaling(int x, int y, const char *str, int color, int fontwidth, int fontheight)
20242049 {
2050+ if( str == NULL ){ return; }
2051+
20252052 float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640;
20262053 float scaling_y = (float)GameConfig.GetScreenHeight() / 480;
20272054
@@ -2038,6 +2065,8 @@
20382065 //! @attention 文字を二重に重ねて立体感を出さないと見にくくなります。
20392066 void D3DGraphics::Draw2DTextureDebugFontText(int x, int y, const char *str, int color)
20402067 {
2068+ if( str == NULL ){ return; }
2069+
20412070 int fontwidth = 8;
20422071 int fontheight = 16;
20432072
@@ -2347,6 +2376,8 @@
23472376 //! @return 成功:true 失敗:false
23482377 bool D3DGraphics::SaveScreenShot(const char* filename)
23492378 {
2379+ if( filename == NULL ){ return false; }
2380+
23502381 LPDIRECT3DSURFACE9 pSurface = NULL;
23512382 HRESULT hr;
23522383
--- trunk/d3dgraphics-opengl.cpp (revision 304)
+++ trunk/d3dgraphics-opengl.cpp (revision 305)
@@ -121,6 +121,9 @@
121121 //! @return 成功:0 失敗:1
122122 int D3DGraphics::InitD3D(WindowControl *WindowCtrl, const char *TextureFontFilename, bool fullscreen)
123123 {
124+ if( WindowCtrl == NULL ){ return 1; }
125+ if( TextureFontFilename == NULL ){ return 1; }
126+
124127 #ifdef ENABLE_DEBUGLOG
125128 //ログに出力
126129 OutputLog.WriteLog(LOG_INIT, "Graphics", "OpenGL");
@@ -248,6 +251,8 @@
248251 //! @return 成功:0 待ち:1 失敗:2
249252 int D3DGraphics::ResetD3D(WindowControl *WindowCtrl)
250253 {
254+ if( WindowCtrl == NULL ){ return 2; }
255+
251256 #ifdef ENABLE_DEBUGLOG
252257 //ログに出力
253258 OutputLog.WriteLog(LOG_INIT, "Graphics", "OpenGL (Reset)");
@@ -420,6 +425,8 @@
420425 //! @return 成功:モデル認識番号(0以上) 失敗:-1
421426 int D3DGraphics::LoadModel(const char* filename)
422427 {
428+ if( filename == NULL ){ return -1; }
429+
423430 #ifdef ENABLE_DEBUGLOG
424431 //ログに出力
425432 OutputLog.WriteLog(LOG_LOAD, "Model", filename);
@@ -451,9 +458,7 @@
451458
452459 //ファイルを読み込む
453460 fp = fopen(filename, "r");
454- if( fp == NULL ){
455- return -1; //ファイルが読めない
456- }
461+ if( fp == NULL ){ return -1; }
457462
458463 //マジックコード取得
459464 fgets(buf, 256, fp);
@@ -839,9 +844,7 @@
839844
840845 //ファイルを読み込む
841846 fp = fopen(filename, "rb");
842- if( fp == NULL ){
843- return false; //ファイルが読めない
844- }
847+ if( fp == NULL ){ return false; }
845848
846849 //ヘッダーを読む
847850 fread(header, 1, 4, fp);
@@ -875,6 +878,8 @@
875878 //未使用引数対策
876879 UNREFERENCED_PARAMETER(texturefont);
877880
881+ if( filename == NULL ){ return -1; }
882+
878883 int id = -1;
879884 int format = 0;
880885
@@ -1004,9 +1009,7 @@
10041009
10051010 //ファイルを読み込む
10061011 fp = fopen(filename, "rb");
1007- if( fp == NULL ){
1008- return false; //ファイルが読めない
1009- }
1012+ if( fp == NULL ){ return false; }
10101013
10111014 //ヘッダーを読む
10121015 fread(header, 1, 54, fp);
@@ -1187,9 +1190,7 @@
11871190
11881191 //ファイルを読み込む
11891192 fp = fopen(filename, "rb");
1190- if( fp == NULL ){
1191- return false; //ファイルが読めない
1192- }
1193+ if( fp == NULL ){ return false; }
11931194
11941195 //ヘッダーを読む
11951196 fread(header, 1, 124+4, fp);
@@ -1273,9 +1274,7 @@
12731274
12741275 //ファイルを読み込む
12751276 fp = fopen(filename, "rb");
1276- if( fp == NULL ){
1277- return false; //ファイルが読めない
1278- }
1277+ if( fp == NULL ){ return false; }
12791278 jpeg_stdio_src(&cinfo, fp);
12801279
12811280 //パラメータの設定
@@ -1366,9 +1365,7 @@
13661365
13671366 //ファイルを読み込む
13681367 fp = fopen(filename, "rb");
1369- if( fp == NULL ){
1370- return false; //ファイルが読めない
1371- }
1368+ if( fp == NULL ){ return false; }
13721369
13731370 //PNGファイルか判定
13741371 fread(sig, 4, 1, fp);
@@ -1652,6 +1649,8 @@
16521649 //無効な認識番号が指定されていたら、処理せず返す。
16531650 if( id == -1 ){ return 1; }
16541651 if( ptextures[id].useflag == false ){ return 1; }
1652+ if( width == NULL ){ return 1; }
1653+ if( height == NULL ){ return 1; }
16551654
16561655 *width = ptextures[id].width;
16571656 *height = ptextures[id].height;
@@ -1921,6 +1920,8 @@
19211920 //! @param *z z軸を受け取るポインタ
19221921 void D3DGraphics::GetWorldTransformPos(float *x, float *y, float *z)
19231922 {
1923+ if( (x == NULL)||(y == NULL)||(z == NULL) ){ return; }
1924+
19241925 GLfloat model[16];
19251926 glMatrixMode(GL_MODELVIEW);
19261927 glGetFloatv(GL_MODELVIEW_MATRIX, model);
@@ -1991,6 +1992,7 @@
19911992 {
19921993 //ブロックデータが指定されていなければ、処理しない。
19931994 if( in_blockdata == NULL ){ return; }
1995+ if( directory == NULL ){ return; }
19941996
19951997 char fname[MAX_PATH];
19961998 char fnamefull[MAX_PATH];
@@ -2400,6 +2402,8 @@
24002402 //! @todo 1文字目が欠ける場合がある。
24012403 void D3DGraphics::Draw2DMSFontText(int x, int y, const char *str, int color)
24022404 {
2405+ if( str == NULL ){ return; }
2406+
24032407 int len = strlen(str);
24042408 WCHAR *ustr;
24052409
@@ -2480,6 +2484,8 @@
24802484 //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DMSFontText()関数と同等です。
24812485 void D3DGraphics::Draw2DMSFontTextScaling(int x, int y, const char *str, int color)
24822486 {
2487+ if( str == NULL ){ return; }
2488+
24832489 float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640;
24842490 float scaling_y = (float)GameConfig.GetScreenHeight() / 480;
24852491
@@ -2498,6 +2504,8 @@
24982504 //未使用引数対策
24992505 UNREFERENCED_PARAMETER(h);
25002506
2507+ if( str == NULL ){ return; }
2508+
25012509 int fonthalfsize = (int)(((float)GameConfig.GetScreenHeight() / 480) * 9);
25022510
25032511 //Draw2DMSFontText(x + (w/2 - (StrMaxLineLen(str)*9/2)), y, str, color);
@@ -2514,6 +2522,8 @@
25142522 //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DMSFontTextCenter()関数と同等です。
25152523 void D3DGraphics::Draw2DMSFontTextCenterScaling(int x, int y, int w, int h, const char *str, int color)
25162524 {
2525+ if( str == NULL ){ return; }
2526+
25172527 float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640;
25182528 float scaling_y = (float)GameConfig.GetScreenHeight() / 480;
25192529
@@ -2529,6 +2539,8 @@
25292539 //! @todo 同一文字列を通常フォントサイズで出すとバグが出るかもしれない。(要検証)
25302540 void D3DGraphics::Draw2DMSSmallFontText(int x, int y, const char *str, int color)
25312541 {
2542+ if( str == NULL ){ return; }
2543+
25322544 int len = strlen(str);
25332545 WCHAR *ustr;
25342546
@@ -2629,6 +2641,7 @@
26292641 {
26302642 //テクスチャフォントの取得に失敗していれば、処理しない
26312643 if( TextureFont == -1 ){ return; }
2644+ if( str == NULL ){ return; }
26322645
26332646 int strlens = (int)strlen(str);
26342647
@@ -2718,6 +2731,8 @@
27182731 //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DTextureFontText()関数と同等です。
27192732 void D3DGraphics::Draw2DTextureFontTextScaling(int x, int y, const char *str, int color, int fontwidth, int fontheight)
27202733 {
2734+ if( str == NULL ){ return; }
2735+
27212736 float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640;
27222737 float scaling_y = (float)GameConfig.GetScreenHeight() / 480;
27232738
@@ -2734,6 +2749,8 @@
27342749 //! @attention 文字を二重に重ねて立体感を出さないと見にくくなります。
27352750 void D3DGraphics::Draw2DTextureFontTextCenter(int x, int y, const char *str, int color, int fontwidth, int fontheight)
27362751 {
2752+ if( str == NULL ){ return; }
2753+
27372754 Draw2DTextureFontText((GameConfig.GetScreenWidth() - strlen(str)*fontwidth)/2 + x, y, str, color, fontwidth, fontheight);
27382755 }
27392756
@@ -2747,6 +2764,8 @@
27472764 //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DTextureFontTextCenter()関数と同等です。
27482765 void D3DGraphics::Draw2DTextureFontTextCenterScaling(int x, int y, const char *str, int color, int fontwidth, int fontheight)
27492766 {
2767+ if( str == NULL ){ return; }
2768+
27502769 float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640;
27512770 float scaling_y = (float)GameConfig.GetScreenHeight() / 480;
27522771
@@ -2763,6 +2782,8 @@
27632782 //! @attention 文字を二重に重ねて立体感を出さないと見にくくなります。
27642783 void D3DGraphics::Draw2DTextureDebugFontText(int x, int y, const char *str, int color)
27652784 {
2785+ if( str == NULL ){ return; }
2786+
27662787 int fontwidth = 8;
27672788 int fontheight = 16;
27682789
@@ -3108,6 +3129,8 @@
31083129 //! @return 成功:true 失敗:false
31093130 bool D3DGraphics::SaveScreenShot(const char* filename)
31103131 {
3132+ if( filename == NULL ){ return false; }
3133+
31113134 HDC hDC;
31123135 FILE *fp;
31133136 unsigned char header[54];
--- trunk/datafile.cpp (revision 304)
+++ trunk/datafile.cpp (revision 305)
@@ -49,6 +49,8 @@
4949 //未使用引数対策
5050 UNREFERENCED_PARAMETER(fname);
5151
52+ if( fname == NULL ){ return 1; }
53+
5254 return 0;
5355 }
5456
@@ -101,6 +103,8 @@
101103 //! @return 成功:0 失敗:1
102104 int BlockDataInterface::LoadFiledata(const char *fname)
103105 {
106+ if( fname == NULL ){ return 1; }
107+
104108 FILE *fp;
105109 unsigned char bdata_header[2];
106110 float bdata_main[80];
@@ -118,9 +122,7 @@
118122
119123 //ファイルを読み込む
120124 fp = fopen(fname, "rb");
121- if( fp == NULL ){
122- return 1;
123- }
125+ if( fp == NULL ){ return 1; }
124126
125127 //テクスチャを取得
126128 for(int i=0; i<TOTAL_BLOCKTEXTURE; i++){
@@ -274,6 +276,7 @@
274276 int BlockDataInterface::GetTexture(char *fname, int id)
275277 {
276278 if( data == NULL ){ return 1; }
279+ if( fname == NULL ){ return 2; }
277280 if( (id < 0)||((TOTAL_BLOCKTEXTURE -1) < id) ){ return 2; }
278281
279282 //ポインタにテクスチャ名をコピー
@@ -289,6 +292,7 @@
289292 int BlockDataInterface::Getdata(blockdata *out_data, int id)
290293 {
291294 if( data == NULL ){ return 1; }
295+ if( out_data == NULL ){ return 2; }
292296 if( (id < 0)||((datas -1) < id) ){ return 2; }
293297
294298 //ブロックデータを取得
@@ -413,6 +417,8 @@
413417 //! @return 成功:0 失敗:1
414418 int PointDataInterface::LoadFiledata(const char *fname)
415419 {
420+ if( fname == NULL ){ return 1; }
421+
416422 FILE *fp;
417423 unsigned char pdata_header[2];
418424 float pdata_mainf[4];
@@ -431,9 +437,7 @@
431437
432438 //ファイルを読み込む
433439 fp = fopen( fname, "rb" );
434- if( fp == NULL ){
435- return 1;
436- }
440+ if( fp == NULL ){ return 1; }
437441
438442 //データ数を取得
439443 fread( pdata_header, 1, 2, fp );
@@ -496,6 +500,8 @@
496500 //! @return 成功:0 失敗:1
497501 int PointDataInterface::LoadMSGFiledata(char *fname)
498502 {
503+ if( fname == NULL ){ return 1; }
504+
499505 FILE *fp;
500506
501507 #ifdef ENABLE_PATH_DELIMITER_SLASH
@@ -545,6 +551,7 @@
545551 int PointDataInterface::Getdata(pointdata *out_data, int id)
546552 {
547553 if( data == NULL ){ return 1; }
554+ if( out_data == NULL ){ return 2; }
548555 if( (id < 0)||((datas -1) < id) ){ return 2; }
549556
550557 //データをポインタにコピー
@@ -581,6 +588,7 @@
581588 //! @return 成功:0 失敗:1
582589 int PointDataInterface::GetMessageText(char *str, int id)
583590 {
591+ if( str == NULL ){ return 1; }
584592 if( (id < 0)||((MAX_POINTMESSAGES -1) < id) ){ return 1; }
585593
586594 //ポインタにメッセージをコピー
@@ -696,6 +704,8 @@
696704 //! @return 成功:0 失敗:1
697705 int MIFInterface::LoadFiledata(const char *fname)
698706 {
707+ if( fname == NULL ){ return 1; }
708+
699709 #ifdef ENABLE_DEBUGLOG
700710 //ログに出力
701711 OutputLog.WriteLog(LOG_LOAD, "MIF", fname);
@@ -796,6 +806,8 @@
796806 //! @return 成功:0 失敗:1
797807 int MIFInterface::LoadDefaultTextFiledata(const char *fname)
798808 {
809+ if( fname == NULL ){ return 1; }
810+
799811 FILE *fp;
800812 char str[64];
801813
@@ -864,6 +876,8 @@
864876 //! @return 成功:0 失敗:1
865877 int MIFInterface::LoadMissionInfoFiledata(const char *fname)
866878 {
879+ if( fname == NULL ){ return 1; }
880+
867881 FILE *fp;
868882 char str[64];
869883
@@ -945,6 +959,8 @@
945959 //! @return 成功:0 失敗:1
946960 int MIFInterface::LoadAddSmallObjectFiledata(const char *fname)
947961 {
962+ if( fname == NULL ){ return 1; }
963+
948964 FILE *fp;
949965 char str1[_MAX_PATH];
950966 char str2[_MAX_PATH];
@@ -1042,6 +1058,9 @@
10421058 //! @attention fnameのポインタを直接書き換えます。
10431059 bool MIFInterface::ChangeExePathToFullPath(char *dir, char *fname)
10441060 {
1061+ if( dir == NULL ){ return false; }
1062+ if( fname == NULL ){ return false; }
1063+
10451064 char str[MAX_PATH];
10461065 int index = 0;
10471066
@@ -1105,6 +1124,9 @@
11051124 //! @param *pointfile ポイントデータを受け取るポインタ
11061125 void MIFInterface::GetDatafilePath(char *blockfile, char *pointfile)
11071126 {
1127+ if( blockfile == NULL ){ return; }
1128+ if( pointfile == NULL ){ return; }
1129+
11081130 strcpy(blockfile, blockfile_path);
11091131 strcpy(pointfile, pointfile_path);
11101132 }
@@ -1124,6 +1146,9 @@
11241146 //! @attention 画像を1枚しか使用しない場合、画像ファイルBは「!」を返します。
11251147 void MIFInterface::GetPicturefilePath(char *picturefileA, char *picturefileB)
11261148 {
1149+ if( picturefileA == NULL ){ return; }
1150+ if( picturefileB == NULL ){ return; }
1151+
11271152 strcpy(picturefileA, picturefileA_path);
11281153 strcpy(picturefileB, picturefileB_path);
11291154 }
@@ -1231,6 +1256,8 @@
12311256 //! @brief .mifファイルを取得
12321257 void AddonList::GetMIFlist(const char *dir)
12331258 {
1259+ if( dir == NULL ){ return; }
1260+
12341261 char SearchDIR[_MAX_PATH];
12351262 HANDLE hFind;
12361263 WIN32_FIND_DATA FindFileData;
@@ -1256,6 +1283,8 @@
12561283 //! @brief ミッション名を取得
12571284 void AddonList::GetMissionName(const char *dir)
12581285 {
1286+ if( dir == NULL ){ return; }
1287+
12591288 for(int i=0; i<datas; i++){
12601289 char str[_MAX_PATH];
12611290 MIFInterface mifdata;
@@ -1276,6 +1305,8 @@
12761305 //! @brief ミッション名をソートする
12771306 void AddonList::Sort()
12781307 {
1308+ if( datas <= 1 ){ return; }
1309+
12791310 char mission_name_c[MAX_ADDONLIST][24];
12801311 char temp[_MAX_PATH];
12811312 int cmp;
@@ -1315,6 +1346,8 @@
13151346 //! @return addonの総数
13161347 int AddonList::LoadFiledata(const char *dir)
13171348 {
1349+ if( dir == NULL ){ return 0; }
1350+
13181351 datas = 0;
13191352
13201353 //.mifファイルを取得
@@ -1342,6 +1375,7 @@
13421375 //! @return ミッション名
13431376 char* AddonList::GetMissionName(int id)
13441377 {
1378+ if( (id < 0)||((MAX_ADDONLIST -1) < id ) ){ return NULL; }
13451379 return mission_name[id];
13461380 }
13471381
@@ -1350,6 +1384,7 @@
13501384 //! @return ファイル名
13511385 char* AddonList::GetFileName(int id)
13521386 {
1387+ if( (id < 0)||((MAX_ADDONLIST -1) < id ) ){ return NULL; }
13531388 return filename[id];
13541389 }
13551390
@@ -1371,6 +1406,7 @@
13711406 //! @attention 既にINIファイルを読み込んでいる場合、ReleaseINIFile()関数を使うまで本関数は失敗します。
13721407 bool INIFileInterface::LoadINIFile(const char *fname)
13731408 {
1409+ if( fname == NULL ){ return true; }
13741410 if( inifp != NULL ){ return true; }
13751411
13761412 #ifdef ENABLE_PATH_DELIMITER_SLASH
@@ -1393,9 +1429,13 @@
13931429 //! @return エラーコード
13941430 //! @attention ファイルが開かれていないか キーが見つからなければ、デフォルト値を返します。
13951431 //! @attention 取得した文字列が最大文字数を超えている場合、最大文字数まで切り取ります。
1396-//! @note エラーコード 1:ファイルが開かれていない、2:値が見つからない
1432+//! @note エラーコード 1:引数異常、2:ファイルが開かれていない、3:値が見つからない
13971433 int INIFileInterface::GetINIFileString(const char *sectionname, const char *keyname, const char *defaultvalue, char *valuestr, int strbuflen)
13981434 {
1435+ if( valuestr == NULL ){ return 1; }
1436+ if( defaultvalue == NULL ){ strcpy(valuestr, ""); return 1; }
1437+ if( keyname == NULL ){ strcpy(valuestr, defaultvalue); return 1; }
1438+
13991439 int state = 0;
14001440 char readline[512];
14011441 char buf[512];
@@ -1403,7 +1443,7 @@
14031443 //ファイルが読み込まれていなければ失敗
14041444 if( inifp == NULL ){
14051445 strcpy(valuestr, defaultvalue);
1406- return 1;
1446+ return 2;
14071447 }
14081448
14091449 fseek(inifp, 0, SEEK_SET);
@@ -1501,7 +1541,7 @@
15011541
15021542 //値が見つからなければエラーを返す
15031543 strcpy(valuestr, defaultvalue);
1504- return 2;
1544+ return 3;
15051545 }
15061546
15071547 //! @brief int値を取得
@@ -1511,9 +1551,11 @@
15111551 //! @param errorcode エラーコードを取得するポインタ(NULL可)
15121552 //! @return 値
15131553 //! @attention ファイルが開かれていないか キーが見つからなければ、デフォルト値を返します。
1514-//! @note エラーコード 1:ファイルが開かれていない、2:値が見つからない
1554+//! @note エラーコード 1:引数異常、2:ファイルが開かれていない、3:値が見つからない
15151555 int INIFileInterface::GetINIFileInt(const char *sectionname, const char *keyname, int defaultvalue, int *errorcode)
15161556 {
1557+ if( keyname == NULL ){ return defaultvalue; }
1558+
15171559 char defaultint[64];
15181560 char buf[64];
15191561 int error;
@@ -1531,9 +1573,11 @@
15311573 //! @param errorcode エラーコードを取得するポインタ(NULL可)
15321574 //! @return 値
15331575 //! @attention ファイルが開かれていないか キーが見つからなければ、デフォルト値を返します。
1534-//! @note エラーコード 1:ファイルが開かれていない、2:値が見つからない
1576+//! @note エラーコード 1:引数異常、2:ファイルが開かれていない、3:値が見つからない
15351577 float INIFileInterface::GetINIFileFloat(const char *sectionname, const char *keyname, float defaultvalue, int *errorcode)
15361578 {
1579+ if( keyname == NULL ){ return defaultvalue; }
1580+
15371581 char defaultfloat[64];
15381582 char buf[64];
15391583 int error;
@@ -1555,9 +1599,11 @@
15551599 //! @param errorcode エラーコードを取得するポインタ(NULL可)
15561600 //! @return 値
15571601 //! @attention ファイルが開かれていないか キーが見つからなければ、デフォルト値を返します。
1558-//! @note エラーコード 1:ファイルが開かれていない、2:値が見つからない
1602+//! @note エラーコード 1:引数異常、2:ファイルが開かれていない、3:値が見つからない
15591603 bool INIFileInterface::GetINIFileBool(const char *sectionname, const char *keyname, bool defaultvalue, int *errorcode)
15601604 {
1605+ if( keyname == NULL ){ return defaultvalue; }
1606+
15611607 char defaultbool[64];
15621608 char buf[64];
15631609 int error;
@@ -1595,8 +1641,10 @@
15951641 //! @brief fgets()用 改行コードを取り除く
15961642 //! @param str 文字列
15971643 //! @return 置き換えあり:0 置き換えなし:1
1598-int DeleteLinefeed(char str[])
1644+int DeleteLinefeed(char *str)
15991645 {
1646+ if( str == NULL ){ return 1; }
1647+
16001648 char *pstr;
16011649 bool flag = false;
16021650
@@ -1624,6 +1672,9 @@
16241672 //! @warning Windows環境しか想定されていません。
16251673 bool CheckFullPath(const char *path)
16261674 {
1675+ if( path == NULL ){ return false; }
1676+ if( strlen(path) < 2 ){ return false; }
1677+
16271678 if( path[1] == ':' ){ return true; }
16281679 return false;
16291680 }
@@ -1633,6 +1684,9 @@
16331684 //! @param dir ディレクトリ名を受け取るポインタ
16341685 void GetFileDirectory(const char *path, char *dir)
16351686 {
1687+ if( path == NULL ){ return; }
1688+ if( dir == NULL ){ return; }
1689+
16361690 strcpy(dir, path);
16371691
16381692 //終端から'\\'か'/'を探し、'\0'に置き換える
@@ -1649,6 +1703,8 @@
16491703 //! @attention 拡張子は"."込みで指定してください。大文字・小文字は区別しません。
16501704 bool CheckFileExtension(const char *filepath, const char *checkstr)
16511705 {
1706+ if( filepath == NULL ){ return false; }
1707+ if( checkstr == NULL ){ return false; }
16521708 if( strlen(filepath) >= MAX_PATH ){ return false; }
16531709 if( strlen(checkstr) >= 16 ){ return false; }
16541710 if( strlen(filepath) < strlen(checkstr) ){ return false; }
--- trunk/datafile.h (revision 304)
+++ trunk/datafile.h (revision 305)
@@ -237,7 +237,7 @@
237237 void ReleaseINIFile();
238238 };
239239
240-int DeleteLinefeed(char str[]);
240+int DeleteLinefeed(char *str);
241241 bool CheckFullPath(const char *path);
242242 void GetFileDirectory(const char *path, char *dir);
243243 bool CheckFileExtension(const char *filepath, const char *checkstr);
--- trunk/debug.cpp (revision 304)
+++ trunk/debug.cpp (revision 305)
@@ -53,9 +53,7 @@
5353 FILE *fp;
5454
5555 fp = fopen(fname, "a");
56- if( fp == NULL ){
57- return;
58- }
56+ if( fp == NULL ){ return; }
5957
6058 fprintf(fp, "</table>\n");
6159 fprintf(fp, "</body>\n");
@@ -100,9 +98,7 @@
10098
10199
102100 fp = fopen(fname, "w");
103- if( fp == NULL ){
104- return true;
105- }
101+ if( fp == NULL ){ return true; }
106102
107103 //ヘッダー
108104 fprintf(fp, "<html>\n");
@@ -144,6 +140,8 @@
144140 //! @attention WriteLog(int tag, const char* title, const char* text)関数をオーバーロードします。
145141 bool DebugLog::WriteLog(int tag, const char* title, int id)
146142 {
143+ if( title == NULL ){ return true; }
144+
147145 //出力フラグを有効なければ処理しない
148146 if( OutputFlag == false ){ return true; }
149147
@@ -163,6 +161,9 @@
163161 //! @attention すなわち、初期化か読み込みを記録した場合、次に完了が記録されなければ、自動的にエラーとして記録します。
164162 bool DebugLog::WriteLog(int tag, const char* title, const char* text)
165163 {
164+ if( title == NULL ){ return true; }
165+ if( text == NULL ){ return true; }
166+
166167 //出力フラグを有効なければ処理しない
167168 if( OutputFlag == false ){ return true; }
168169
@@ -214,9 +215,7 @@
214215 }
215216
216217 fp = fopen(fname, "a");
217- if( fp == NULL ){
218- return true;
219- }
218+ if( fp == NULL ){ return true; }
220219
221220 //現在のミリ秒
222221 fprintf(fp, "<tr><td> %d </td>", GetTimeMS());
--- trunk/event.cpp (revision 304)
+++ trunk/event.cpp (revision 305)
@@ -262,6 +262,11 @@
262262 //! @attention SetMessageID は、メッセージイベントが実行された場合に true になります。<b>前回から変更されたとは限りません。</b>
263263 int EventControl::Execution(bool SkipFlag, int *endcnt, bool *complete, int *MessageID, bool *SetMessageID)
264264 {
265+ if( endcnt == NULL ){ return 0; }
266+ if( complete == NULL ){ return 0; }
267+ if( MessageID == NULL ){ return 0; }
268+ if( SetMessageID == NULL ){ return 0; }
269+
265270 pointdata data;
266271 int cnt = 0;
267272
--- trunk/gamemain.cpp (revision 304)
+++ trunk/gamemain.cpp (revision 305)
@@ -60,6 +60,8 @@
6060 //! @brief 基本的な初期化処理
6161 int InitGame(WindowControl *WindowCtrl, int mode, char *MIFpath)
6262 {
63+ if( WindowCtrl == NULL ){ return 1; }
64+
6365 //D3DGraphicsクラス初期化
6466 if( d3dg.InitD3D(WindowCtrl, "data\\char.dds", GameConfig.GetFullscreenFlag()) ){
6567 WindowCtrl->ErrorInfo("Direct3Dの作成に失敗しました");
@@ -140,6 +142,8 @@
140142 //! @attention 通常は、描画処理に失敗した場合に限り呼び出してください。
141143 int ResetGame(WindowControl *WindowCtrl)
142144 {
145+ if( WindowCtrl == NULL ){ return -1; }
146+
143147 //リストを正しく解放するため、予め呼ぶ。
144148 Resource.CleanupHumanTexture();
145149
@@ -2125,6 +2129,8 @@
21252129 //! @param MouseSensitivity 視点の移動量計算
21262130 void maingame::InputPlayer(human *myHuman, int mouse_x, int mouse_y, float MouseSensitivity)
21272131 {
2132+ if( myHuman == NULL ){ return; }
2133+
21282134 int PlayerID = ObjMgr.GetPlayerID();
21292135
21302136 if( myHuman->GetHP() > 0 ){
@@ -3508,6 +3514,9 @@
35083514 //! @return 取得:true 判定外:false
35093515 bool maingame::GetCommandNum(const char *cmd, int *num)
35103516 {
3517+ if( cmd == NULL ){ return false; }
3518+ if( num == NULL ){ return false; }
3519+
35113520 //コマンド名を調べる
35123521 if( memcmp(NewCommand, cmd, strlen(cmd)) != 0 ){ return false; }
35133522 if( NewCommand[strlen(cmd)] != ' ' ){ return false; }
@@ -4718,6 +4727,13 @@
47184727 //! @brief screen派生クラスの初期化(クラスの設定)
47194728 void InitScreen(WindowControl *WindowCtrl, opening *Opening, mainmenu *MainMenu, briefing *Briefing, maingame *MainGame, result *Result)
47204729 {
4730+ if( WindowCtrl == NULL ){ return; }
4731+ if( Opening == NULL ){ return; }
4732+ if( MainMenu == NULL ){ return; }
4733+ if( Briefing == NULL ){ return; }
4734+ if( MainGame == NULL ){ return; }
4735+ if( Result == NULL ){ return; }
4736+
47214737 Opening->SetClass(&GameState, WindowCtrl, &d3dg, &inputCtrl, &GameSound);
47224738 MainMenu->SetClass(&GameState, WindowCtrl, &d3dg, &inputCtrl, &GameSound);
47234739 Briefing->SetClass(&GameState, WindowCtrl, &d3dg, &inputCtrl);
@@ -4728,6 +4744,13 @@
47284744 //! @brief screen派生クラスの実行
47294745 void ProcessScreen(WindowControl *WindowCtrl, opening *Opening, mainmenu *MainMenu, briefing *Briefing, maingame *MainGame, result *Result, unsigned int framecnt)
47304746 {
4747+ if( WindowCtrl == NULL ){ return; }
4748+ if( Opening == NULL ){ return; }
4749+ if( MainMenu == NULL ){ return; }
4750+ if( Briefing == NULL ){ return; }
4751+ if( MainGame == NULL ){ return; }
4752+ if( Result == NULL ){ return; }
4753+
47314754 int error;
47324755
47334756 switch(GameState.GetState()){
@@ -4932,6 +4955,11 @@
49324955 //! @return 成功:0 失敗(ゲーム続行):1 失敗(ゲーム終了):2
49334956 int ChangeWindowMode(WindowControl *WindowCtrl, D3DGraphics *d3dg, InputControl *inputCtrl, scene *RecoveryScene, bool fullscreen)
49344957 {
4958+ if( WindowCtrl == NULL ){ return 2; }
4959+ if( d3dg == NULL ){ return 2; }
4960+ if( inputCtrl == NULL ){ return 2; }
4961+ if( RecoveryScene == NULL ){ return 2; }
4962+
49354963 int returncode = 0;
49364964 bool ErrorFlag = false;
49374965
--- trunk/gui-object.cpp (revision 304)
+++ trunk/gui-object.cpp (revision 305)
@@ -204,6 +204,8 @@
204204 //! @attention 「合計アイテム数<表示するアイテム数」の場合、ノブは表示されません。
205205 void ScrollbarObject::Draw(class D3DGraphics *d3dg)
206206 {
207+ if( d3dg == NULL ){ return; }
208+
207209 int color, color2;
208210
209211 //エリア描画
--- trunk/input.cpp (revision 304)
+++ trunk/input.cpp (revision 305)
@@ -81,6 +81,8 @@
8181 //! @return 成功:0 失敗:1
8282 int InputControl::InitInput(WindowControl *WindowCtrl)
8383 {
84+ if( WindowCtrl == NULL ){ return 1; }
85+
8486 #ifdef ENABLE_DEBUGLOG
8587 //ログに出力
8688 #if INPUT_INTERFACE == 0
@@ -423,6 +425,8 @@
423425 //! @return 押されてない:false 押されている:true
424426 bool InputControl::CheckKeyNow(int id)
425427 {
428+ if( (id < 0)||(256 <= id) ){ return false; }
429+
426430 //現在押されていれば
427431 if( keys[id]&0x80 ){ return true; }
428432 return false;
@@ -432,6 +436,8 @@
432436 //! @return 押された瞬間でない:false 押された瞬間である:true
433437 bool InputControl::CheckKeyDown(int id)
434438 {
439+ if( (id < 0)||(256 <= id) ){ return false; }
440+
435441 //前回は押されておらず、現在押されていれば
436442 if( ((keys_lt[id]&0x80) == 0)&&(keys[id]&0x80) ){ return true; }
437443 return false;
@@ -441,6 +447,8 @@
441447 //! @return 離された瞬間でない:false 離された瞬間である:true
442448 bool InputControl::CheckKeyUp(int id)
443449 {
450+ if( (id < 0)||(256 <= id) ){ return false; }
451+
444452 //前回を押されており、現在押されていなければ
445453 if( (keys_lt[id]&0x80)&&((keys[id]&0x80) == 0) ){ return true; }
446454 return false;
@@ -452,6 +460,8 @@
452460 //! @attention 値は直前に実行した GetInputState() への引数に影響される。
453461 void InputControl::GetMouseMovement(int *x, int *y)
454462 {
463+ if( (x == NULL)||(y == NULL) ){ return; }
464+
455465 //マウス座標を代入
456466 *x = mx;
457467 *y = my;
@@ -744,6 +754,8 @@
744754 //! @return 成功:true 失敗:false 
745755 bool GetDoubleKeyCode(int id, int *CodeL, int *CodeR)
746756 {
757+ if( (CodeL == NULL)||(CodeR == NULL) ){ return false; }
758+
747759 #if INPUT_INTERFACE != 2
748760 //未使用引数対策
749761 UNREFERENCED_PARAMETER(id);
--- trunk/main.cpp (revision 304)
+++ trunk/main.cpp (revision 305)
@@ -263,6 +263,8 @@
263263 //! @attention 次の引数を判定します。>/[引数]、-[引数]、/[引数(小文字)]、-[引数(小文字)]
264264 bool CheckCommandParameter(const char *param, const char *cmd)
265265 {
266+ if( param == NULL ){ return false; }
267+ if( cmd == NULL ){ return false; }
266268 if( strlen(param) >= 16 ){ return false; }
267269 if( strlen(cmd) >= 16 ){ return false; }
268270 if( strlen(param) != strlen(cmd) ){ return false; }
--- trunk/object.cpp (revision 304)
+++ trunk/object.cpp (revision 305)
@@ -407,9 +407,7 @@
407407 //! @return 成功:1 失敗:0
408408 int human::PickupWeapon(class weapon *in_weapon)
409409 {
410- if( in_weapon == NULL ){
411- return 0;
412- }
410+ if( in_weapon == NULL ){ return 0; }
413411
414412 if( weapon[selectweapon] == NULL ){
415413 //武器を正しく拾えれば、所持武器として登録
@@ -637,6 +635,9 @@
637635 //! @attention ゲーム上から直接呼び出すことは避け、ObjectManagerクラスから呼び出してください。
638636 bool human::ShotWeapon(int *weapon_paramid, int *GunsightErrorRange)
639637 {
638+ if( weapon_paramid == NULL ){ return false; }
639+ if( GunsightErrorRange == NULL ){ return false; }
640+
640641 int param_id;
641642
642643 //武器切り替え中なら失敗
@@ -942,6 +943,8 @@
942943 //! @param ry 縦軸を取得するポインタ
943944 void human::GetRxRy(float *rx, float *ry)
944945 {
946+ if( (rx == NULL)||(ry == NULL) ){ return; }
947+
945948 *rx = rotation_x;
946949 *ry = armrotation_y;
947950 }
@@ -1141,6 +1144,8 @@
11411144 //! @return 静止した死体:4 倒れ終わった直後:3 倒れている最中:2 倒れ始める:1 何もしない:0
11421145 int human::CheckAndProcessDead(class Collision *CollD)
11431146 {
1147+ if( CollD == NULL ){ return 0; }
1148+
11441149 if( hp <= 0 ){
11451150 //腕の角度
11461151 if( armrotation_y < 0.0f ){
@@ -1491,6 +1496,9 @@
14911496 //! @attention 空中の場合など足元にブロックがない場合、ブロックIDと面番号は -1 を返します。
14921497 void human::CollisionMap(class Collision *CollD, class BlockDataInterface *inblockdata, bool AddCollisionFlag, bool player, int *underblock_id, int *underblock_face)
14931498 {
1499+ if( CollD == NULL ){ return; }
1500+ if( inblockdata == NULL ){ return; }
1501+
14941502 float pos_x2, pos_y2, pos_z2;
14951503 float dist_x, dist_y, dist_z;
14961504 float speed;
@@ -1768,6 +1776,8 @@
17681776 //! @return 成功:true 失敗:false
17691777 bool human::CollisionBlockScratch(class Collision *CollD, class BlockDataInterface *inblockdata, float *px, float *py, float *pz, float px_old, float py_old, float pz_old, float in_vx, float in_vy, float in_vz, int mode)
17701778 {
1779+ if( CollD == NULL ){ return false; }
1780+ if( inblockdata == NULL ){ return false; }
17711781 //if( (*px == px_old)&&(*py == py_old)&&(*pz == pz_old) ){ return false; }
17721782
17731783 float px2, py2, pz2;
@@ -1842,6 +1852,7 @@
18421852 int human::RunFrame(class Collision *CollD, class BlockDataInterface *inblockdata, bool AddCollisionFlag, bool player, bool F5mode, int *underblock_id, int *underblock_face)
18431853 {
18441854 if( CollD == NULL ){ return 0; }
1855+ if( inblockdata == NULL ){ return 0; }
18451856 if( EnableFlag == false ){ return 0; }
18461857
18471858 //F5を使用していれば、強制的に上昇
@@ -1967,6 +1978,7 @@
19671978
19681979 //正しく初期化されていなければ、処理しない
19691980 if( d3dg == NULL ){ return; }
1981+ if( Resource == NULL ){ return; }
19701982 if( EnableFlag == false ){ return; }
19711983
19721984 //モーション取得
@@ -2256,6 +2268,7 @@
22562268 {
22572269 //初期化されていなければ、失敗
22582270 if( EnableFlag == false ){ return false; }
2271+ if( Resource == NULL ){ return false; }
22592272
22602273 //指定された設定値へ上書き
22612274 id_parameter = id_param;
@@ -2798,6 +2811,8 @@
27982811 //! @return 爆発:2 バウンド・跳ね返り:1 それ以外:0
27992812 int grenade::RunFrame(class Collision *CollD)
28002813 {
2814+ if( CollD == NULL ){ return 0; }
2815+
28012816 //初期化されていなければ処理しない
28022817 if( EnableFlag == false ){ return 0; }
28032818
@@ -2978,6 +2993,8 @@
29782993 //! @param mz Z軸移動量を受け取るポインタ
29792994 void effect::GetMove(float *mx, float *my, float *mz)
29802995 {
2996+ if( (mx == NULL)||(my == NULL)||(mz == NULL) ){ return; }
2997+
29812998 *mx = move_x;
29822999 *my = move_y;
29833000 *mz = move_z;
@@ -3377,12 +3394,12 @@
33773394 //! @param legmodel 足のモデル認識番号を取得するポインタ
33783395 void HumanMotionControl::GetRenderMotion(float *arm_rotation_y, float *leg_rotation_x, int *upmodel, int *armmodel, int *legmodel)
33793396 {
3380- *arm_rotation_y = armmodel_rotation_y;
3381- *leg_rotation_x = legrotation_x;
3397+ if( arm_rotation_y != NULL ){ *arm_rotation_y = armmodel_rotation_y; }
3398+ if( leg_rotation_x != NULL ){ *leg_rotation_x = legrotation_x; }
33823399
3383- *upmodel = id_upmodel;
3384- *armmodel = armmodelid;
3385- *legmodel = legmodelid;
3400+ if( upmodel != NULL ){ *upmodel = id_upmodel; }
3401+ if( armmodel != NULL ){ *armmodel = armmodelid; }
3402+ if( legmodel != NULL ){ *legmodel = legmodelid; }
33863403 }
33873404
33883405 //! @brief 歩き・走りモーションのカウント値取得
--- trunk/objectmanager.cpp (revision 304)
+++ trunk/objectmanager.cpp (revision 305)
@@ -637,6 +637,9 @@
637637 //! @attention 両クラスは自動的にAddPosOrder()を用いて、お互いを押し合います。
638638 bool ObjectManager::CollideHuman(human *in_humanA, human *in_humanB)
639639 {
640+ if( in_humanA == NULL ){ return false; }
641+ if( in_humanB == NULL ){ return false; }
642+
640643 float h1_x, h1_y, h1_z;
641644 float h2_x, h2_y, h2_z;
642645 float angle, length;
@@ -669,6 +672,8 @@
669672 //! @attention 判定に限らず、ダメージ計算や効果音再生まで一貫して行います。
670673 bool ObjectManager::CollideBullet(bullet *in_bullet)
671674 {
675+ if( in_bullet == NULL ){ return false; }
676+
672677 //使用されていない弾丸ならば、処理せずに返す。
673678 if( in_bullet->GetEnableFlag() == false ){ return false; }
674679
@@ -1030,6 +1035,8 @@
10301035 //! @attention ダメージ判定に限らず、ダメージ計算や効果音再生まで一貫して行います。
10311036 bool ObjectManager::GrenadeExplosion(grenade *in_grenade)
10321037 {
1038+ if( in_grenade == NULL ){ return false; }
1039+
10331040 bool returnflag = false;
10341041
10351042 //座標を取得
@@ -1270,6 +1277,10 @@
12701277 //! @return 付着する:true 付着しない:false
12711278 bool ObjectManager::CollideBlood(effect *in_effect, int *id, int *face, float *pos_x, float *pos_y, float *pos_z)
12721279 {
1280+ if( in_effect == NULL ){ return false; }
1281+ if( (id == NULL)||(face == NULL) ){ return false; }
1282+ if( (pos_x == NULL)||(pos_y == NULL)||(pos_z == NULL) ){ return false; }
1283+
12731284 //無効なエフェクトならば処理しない
12741285 if( in_effect->GetEnableFlag() == false ){ return false; }
12751286 if( in_effect->GetCollideMapFlag() == false ){ return false; }
@@ -1317,6 +1328,9 @@
13171328 //! @attention 人の種類が ゾンビ の場合、この関数は失敗します。
13181329 void ObjectManager::PickupWeapon(human *in_human, weapon *in_weapon)
13191330 {
1331+ if( in_human == NULL ){ return; }
1332+ if( in_weapon == NULL ){ return; }
1333+
13201334 //無効な人ならば処理しない
13211335 if( in_human->GetEnableFlag() == false ){ return; }
13221336 if( in_human->GetHP() <= 0 ){ return; }
@@ -1655,6 +1669,8 @@
16551669 //! @return データ番号 (エラー:-1)
16561670 int ObjectManager::GetHumanObjectID(human* object)
16571671 {
1672+ if( object == NULL ){ return -1; }
1673+
16581674 for(int i=0; i<MAX_HUMAN; i++){
16591675 if( &(HumanIndex[i]) == object ){
16601676 return i;
@@ -1696,6 +1712,8 @@
16961712 //! @return データ番号 (エラー:-1)
16971713 int ObjectManager::GetBulletObjectID(bullet* object)
16981714 {
1715+ if( object == NULL ){ return -1; }
1716+
16991717 for(int i=0; i<MAX_BULLET; i++){
17001718 if( &(BulletIndex[i]) == object ){
17011719 return i;
@@ -2036,6 +2054,9 @@
20362054 //! @attention この関数の呼び出しタイミングを誤ると、銃口に対してマズルフラッシュが合いません。
20372055 void ObjectManager::ShotWeaponEffect(int humanid)
20382056 {
2057+ //値の範囲をチェック
2058+ if( (humanid < 0)||(MAX_HUMAN <= humanid) ){ return; }
2059+
20392060 float pos_x, pos_y, pos_z;
20402061 float rotation_x, armrotation_y;
20412062 int weapon_paramid;
@@ -2373,6 +2394,7 @@
23732394 //! @param EnemyHuman 攻撃を受けた人オブジェクトのポインタ
23742395 void ObjectManager::HitZombieAttack(human* MyHuman, human* EnemyHuman)
23752396 {
2397+ if( MyHuman == NULL ){ return; }
23762398 if( EnemyHuman == NULL ){ return; }
23772399
23782400 //使用されていないか、死亡していれば処理しない。
@@ -2538,6 +2560,9 @@
25382560 //! @return 表示情報あり:true 表示情報なし:false
25392561 bool ObjectManager::GetObjectInfoTag(float camera_x, float camera_y, float camera_z, float camera_rx, float camera_ry, int *color, char *infostr)
25402562 {
2563+ if( color == NULL ){ return false; }
2564+ if( infostr == NULL ){ return false; }
2565+
25412566 float dist = 50.0f;
25422567 float px, py, pz;
25432568 float rx, ry;
@@ -2870,6 +2895,8 @@
28702895 bool ObjectManager::GetHumanShotInfo(int id, float *ontarget, int *kill, int *headshot)
28712896 {
28722897 if( (id < 0)||(MAX_HUMAN-1 < id) ){ return false; }
2898+ if( (ontarget == NULL)||(kill == NULL)||(headshot == NULL) ){ return false; }
2899+
28732900 *ontarget = Human_ontarget[id];
28742901 *kill = Human_kill[id];
28752902 *headshot = Human_headshot[id];
@@ -3125,6 +3152,7 @@
31253152 //! @param str 文字列 (改行コード:<b>不可</b>)
31263153 void ObjectManagerLog::InfoLog(const char *str)
31273154 {
3155+ if( str == NULL ){ return; }
31283156 AddTextLog(MAX_OBJECTMANAGER_LOGCNT, str, d3dg->GetColorCode(0.0f,1.0f,0.0f,1.0f));
31293157 }
31303158
@@ -3219,6 +3247,8 @@
32193247 //! @return 1行上書き:true 追加のみ:false
32203248 bool ObjectManagerLog::AddTextLog(int cnt, const char *str, int color)
32213249 {
3250+ if( str == NULL ){ return false; }
3251+
32223252 //空いている行があるなら、その行に書いて終了
32233253 for(int i=0; i<MAX_OBJECTMANAGER_LOGLEN; i++){
32243254 if( TextCnt[i] == -1 ){
--- trunk/parameter.cpp (revision 304)
+++ trunk/parameter.cpp (revision 305)
@@ -1780,6 +1780,7 @@
17801780 //! @return 成功:0 失敗:1
17811781 int ParameterInfo::GetHuman(int id, HumanParameter *out_data)
17821782 {
1783+ if( out_data == NULL ){ return 1; }
17831784 if( (id < 0)||((TOTAL_PARAMETERINFO_HUMAN -1) < id ) ){ return 1; }
17841785
17851786 *out_data = Human[id];
@@ -1792,6 +1793,7 @@
17921793 //! @return 成功:0 失敗:1
17931794 int ParameterInfo::GetHumanTexturePath(int id, char *out_str)
17941795 {
1796+ if( out_str == NULL ){ return 1; }
17951797 if( (id < 0)||((TOTAL_HUMANTEXTURE -1) < id ) ){ return 1; }
17961798
17971799 strcpy(out_str, HumanTexturePath[id]);
@@ -1804,6 +1806,7 @@
18041806 //! @return 成功:0 失敗:1
18051807 int ParameterInfo::GetWeapon(int id, WeaponParameter *out_data)
18061808 {
1809+ if( out_data == NULL ){ return 1; }
18071810 if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){
18081811 #ifdef ENABLE_BUG_HUMANWEAPON
18091812 return GetBugWeapon(id, out_data);
@@ -1825,6 +1828,7 @@
18251828 //! @attention バグ武器を追加する場合は、ResourceManagerクラスの GetBugWeaponModelTexture() 関数も編集してください。
18261829 int ParameterInfo::GetBugWeapon(int id, WeaponParameter *out_data)
18271830 {
1831+ if( out_data == NULL ){ return 1; }
18281832 if( (id == 23)||(id == 24)||(id == 30)||(id == 53) ){
18291833 *out_data = BugWeapon[0];
18301834 return 0;
@@ -1842,6 +1846,7 @@
18421846 //! @warning 追加小物の情報は取得できません。追加小物の情報は MIFInterfaceクラス から取得してください。
18431847 int ParameterInfo::GetSmallObject(int id, SmallObjectParameter *out_data)
18441848 {
1849+ if( out_data == NULL ){ return 1; }
18451850 if( (id < 0)||((TOTAL_PARAMETERINFO_SMALLOBJECT -1) < id ) ){ return 1; }
18461851
18471852 *out_data = SmallObject[id];
@@ -1854,6 +1859,7 @@
18541859 //! @return 成功:0 失敗:1
18551860 int ParameterInfo::GetBullet(int id, BulletParameter *out_data)
18561861 {
1862+ if( out_data == NULL ){ return 1; }
18571863 if( (id < 0)||((TOTAL_PARAMETERINFO_BULLET -1) < id ) ){ return 1; }
18581864
18591865 *out_data = Bullet[id];
@@ -1889,6 +1895,7 @@
18891895 //! @return 成功:0 失敗:1
18901896 int ParameterInfo::GetAIlevel(int level, AIParameter **out_AIlevel)
18911897 {
1898+ if( out_AIlevel == NULL ){ return 1; }
18921899 if( (level < 0)||((TOTAL_PARAMETERINFO_AILEVEL -1) < level ) ){ return 1; }
18931900 *out_AIlevel = &(AIlevel[level]);
18941901 return 0;
--- trunk/resource.cpp (revision 304)
+++ trunk/resource.cpp (revision 305)
@@ -348,6 +348,9 @@
348348 //! @return 成功:0 失敗:1
349349 int ResourceManager::GetWeaponModelTexture(int id, int *model, int *texture)
350350 {
351+ if( model == NULL ){ return 1; }
352+ if( texture == NULL ){ return 1; }
353+
351354 if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){
352355 #ifdef ENABLE_BUG_HUMANWEAPON
353356 return GetBugWeaponModelTexture(id, model, texture);
@@ -369,6 +372,8 @@
369372 int ResourceManager::GetBugWeaponModelTexture(int id, int *model, int *texture)
370373 {
371374 if( d3dg == NULL ){ return 1; }
375+ if( model == NULL ){ return 1; }
376+ if( texture == NULL ){ return 1; }
372377
373378 if( id == 23 ){
374379 *model = human_upmodel[0];
@@ -519,6 +524,8 @@
519524 //! @return 成功:0 失敗:1
520525 int ResourceManager::GetSmallObjectModelTexture(int id, int *model, int *texture)
521526 {
527+ if( model == NULL ){ return 1; }
528+ if( texture == NULL ){ return 1; }
522529 if( (id < 0)||((TOTAL_PARAMETERINFO_SMALLOBJECT + MAX_ADDSMALLOBJECT -1) < id ) ){ return 1; }
523530
524531 *model = smallobject_model[id];
@@ -605,6 +612,9 @@
605612 {
606613 if( d3dg == NULL ){ return 1; }
607614 if( SoundCtrl == NULL ){ return 1; }
615+ if( modelpath == NULL ){ return 1; }
616+ if( texturepath == NULL ){ return 1; }
617+ if( soundpath == NULL ){ return 1; }
608618 if( (id < 0)||(MAX_ADDSMALLOBJECT-1 < id) ){ return 1; }
609619
610620 int dataid = TOTAL_PARAMETERINFO_SMALLOBJECT + id;
@@ -665,6 +675,8 @@
665675 //! @return 成功:0 失敗:1
666676 int ResourceManager::GetBulletModelTexture(int id, int *model, int *texture)
667677 {
678+ if( model == NULL ){ return 1; }
679+ if( texture == NULL ){ return 1; }
668680 if( (id < 0)||((TOTAL_PARAMETERINFO_BULLET -1) < id ) ){ return 1; }
669681
670682 *model = bullet_model[id];
@@ -739,6 +751,9 @@
739751 //! @brief 背景空のモデルとテクスチャを取得
740752 void ResourceManager::GetSkyModelTexture(int *model, int *texture)
741753 {
754+ if( model == NULL ){ return; }
755+ if( texture == NULL ){ return; }
756+
742757 *model = skymodel;
743758 *texture = skytexture;
744759 }
--- trunk/sound-directsound.cpp (revision 304)
+++ trunk/sound-directsound.cpp (revision 305)
@@ -57,6 +57,8 @@
5757 //! @return 成功:0 失敗:1
5858 int SoundControl::InitSound(WindowControl *WindowCtrl)
5959 {
60+ if( WindowCtrl == NULL ){ return 1; }
61+
6062 #ifdef ENABLE_DEBUGLOG
6163 //ログに出力
6264 OutputLog.WriteLog(LOG_INIT, "Sound", "DirectSound");
@@ -148,6 +150,7 @@
148150 int SoundControl::LoadSound(const char* filename)
149151 {
150152 if( pDSound == NULL ){ return -1; }
153+ if( filename == NULL ){ return -1; }
151154
152155 #ifdef ENABLE_DEBUGLOG
153156 //ログに出力
--- trunk/sound-ezds.cpp (revision 304)
+++ trunk/sound-ezds.cpp (revision 305)
@@ -68,6 +68,8 @@
6868 //! @return 成功:0 失敗:1
6969 int SoundControl::InitSound(WindowControl *WindowCtrl)
7070 {
71+ if( WindowCtrl == NULL ){ return 1; }
72+
7173 #ifdef ENABLE_DEBUGLOG
7274 //ログに出力
7375 OutputLog.WriteLog(LOG_INIT, "Sound", "ezds.dll");
@@ -164,6 +166,7 @@
164166 int SoundControl::LoadSound(const char* filename)
165167 {
166168 if( lib == NULL ){ return -1; }
169+ if( filename == NULL ){ return -1; }
167170
168171 #ifdef ENABLE_DEBUGLOG
169172 //ログに出力
--- trunk/soundmanager.cpp (revision 304)
+++ trunk/soundmanager.cpp (revision 305)
@@ -308,6 +308,8 @@
308308 //! @return 返す(サウンドリストの)音源の数
309309 int SoundManager::GetWorldSound(float pos_x, float pos_y, float pos_z, int teamID, soundlist *psoundlist)
310310 {
311+ if( psoundlist == NULL ){ return 0; }
312+
311313 int lists;
312314 soundlist *getlist = NULL;
313315 int newlists = 0;
--- trunk/window.cpp (revision 304)
+++ trunk/window.cpp (revision 305)
@@ -65,6 +65,9 @@
6565 //! @warning 先にSetParam()関数で設定しておく必要があります。
6666 bool WindowControl::InitWindow(const char* title, int width, int height, bool fullscreen)
6767 {
68+ if( title == NULL ){ return false; }
69+ if( (width <= 0)||(height <= 0) ){ return false; }
70+
6871 WNDCLASS wc;
6972 int x, y;
7073 RECT Rect;
@@ -213,6 +216,8 @@
213216 //! @param *str メッセージ
214217 void WindowControl::ErrorInfo(const char *str)
215218 {
219+ if( str == NULL ){ return; }
220+
216221 MessageBox(hWnd, str, "error", MB_OK);
217222 }
218223
@@ -256,6 +261,8 @@
256261 //! @return fps数
257262 float GetFps(int getcnt)
258263 {
264+ if( getcnt <= 0 ){ return 0.0f; }
265+
259266 static unsigned int ptimeg = 0;
260267 unsigned int nowtime;
261268 static float pfps = 0.0f;
@@ -318,6 +325,8 @@
318325 //! @param str 文字列を受け取るポインタ
319326 void GetTimeName(char *str)
320327 {
328+ if( str == NULL ){ return; }
329+
321330 time_t timer;
322331 struct tm *local;
323332
@@ -338,6 +347,8 @@
338347 //! @return 0〜num-1
339348 int GetRand(int num)
340349 {
350+ if( num <= 0 ){ return 0; }
351+
341352 return rand()%num;
342353
343354 //return rand() / (RAND_MAX/num);
@@ -366,6 +377,8 @@
366377 //! @note '\'を'/'へ置き換えます。
367378 char* ChangePathDelimiter(char *str)
368379 {
380+ if( str == NULL ){ return NULL; }
381+
369382 static char newstr[MAX_PATH];
370383 strcpy(newstr, str);
371384