VC++2017
メンバ関数の引数で他のクラスの構造体は使えますか?
enemy.hをincludeした以下のクラスで500近くのエラーが出る原因はこのコードだけで予測できますでしょうか?
C++
1#pragma once 2#include "Task.h" 3#include "EnemyBullet.h" 4#include "Define.h" 5#include "Enemy.h" 6 7class EnemyBulletPattern : public Task 8{ 9 std::shared_ptr<EnemyBullet> Bullet_; 10 eDifficulty difficulty; 11 12 // 行動なし 13 void shot_pattern00(Enemy::enemy_t enemy); 14 // 向いてる方向にショットを撃つ 15 void shot_pattern01(Enemy::enemy_t enemy); 16 // プレイヤーの方にショットを撃つ 17 void shot_pattern02(Enemy::enemy_t enemy); 18 // ランダムで下のほうに撃つ 19 void shot_pattern03(Enemy::enemy_t enemy); 20 // ランダムで上のほうに撃つ 21 void shot_pattern04(Enemy::enemy_t enemy); 22 // 左右交互に撃つ 23 void shot_pattern05(Enemy::enemy_t enemy); 24 // 青スライム 25 void shot_pattern06(Enemy::enemy_t enemy); 26 // 大炎 27 void shot_pattern07(Enemy::enemy_t enemy); 28 // ミニドラゴン 29 void shot_pattern08(Enemy::enemy_t enemy); 30 // キマイラ 31 void shot_pattern09(Enemy::enemy_t enemy); 32 // プレイヤーにビーム 33 void shot_pattern10(Enemy::enemy_t enemy); 34 // プレイヤーにビーム 3本 35 void shot_pattern11(Enemy::enemy_t enemy); 36 // 連続ビーム 37 void shot_pattern12(Enemy::enemy_t enemy); 38 // 小炎 39 void shot_pattern13(Enemy::enemy_t enemy); 40 // ヘビ娘 41 void shot_pattern14(Enemy::enemy_t enemy); 42 // ドラゴン(ショット) 43 void shot_pattern15(Enemy::enemy_t enemy); 44 // ドラゴン(ファイアー) 45 Enemy::enemy_t shot_pattern16(Enemy::enemy_t enemy); 46 // ドラゴン(ブレス) 47 void shot_pattern17(Enemy::enemy_t enemy); 48 49 void shot_pattern18(Enemy::enemy_t enemy); 50 51 void shot_pattern19(Enemy::enemy_t enemy); 52 53 void shot_pattern20(Enemy::enemy_t enemy); 54 55 56public: 57 EnemyBulletPattern(); 58 virtual ~EnemyBulletPattern(); 59 60 bool update() override; 61 void draw() const override; 62 63 // 敵の弾幕を登録する 64 Enemy::enemy_t enemy_shot_manager(Enemy::enemy_t enemy); 65}; 66 67
C++
1// enemy.hの中身 2#pragma once 3#include <memory> 4#include "Task.h" 5#include "Define.h" 6#include "Item.h" 7#include "EnemyBulletPattern.h" 8 9class Enemy : public Task 10{ 11public: 12 typedef struct 13 { 14 game_object_t data; 15 bool screen_flag; // 画面内フラグ 16 int jump_flag; // ジャンプフラグ 17 bool hp_bar_flag; // HPバーを表示するかどうかのフラグ 18 int count_r; // 初期値がランダムなカウンタ 19 int pattern; // 移動パターン 20 int shot_pattern; // 攻撃パターン 21 int shot_kind; // 弾の種類 22 int muki; // 向き 23 int kind; // 敵の種類 24 float out_damage; // 接触ダメージ 25 int muteki; // 無敵時間 26 int item; // 落とすアイテム 27 int img; // 画像 28 int d_effect; // やられた時のエフェクトの種類(0=なし 29 int back_kind; // 背景のエフェクトの種類(0=なし 30 float back_size; // 背景のエフェクトの追加の大きさ 31 float speed; // スピード 32 float jump; // ジャンプ力 33 float gravity; // 重力 34 float dr_lx, dr_rx; // キャラの描画サイズ X 35 float dr_upy, dr_uny; // キャラの描画サイズ Y 36 float laser_angle[10]; // レーザーの角度 37 } enemy_t; 38 39private: 40 enemy_t enemy_[Define::ENEMY_MAX]; 41 static enemy_t base_parameter[100]; // 各敵の詳細パラメータ 42 static bool load_flag; // パラメータを読み込んだかどうか 43 static int parameter_max; // 基本パラメータの種類の数 44 45 std::shared_ptr<Item> Item_; 46 std::shared_ptr<EnemyBulletPattern> EnemyBulletPattern_; 47 48 // 敵をパターンに沿って動かす 49 void enemy_move_pattern(int n); 50 51 int debug_flag[20] = { 1 }; 52 53public: 54 Enemy(); 55 virtual ~Enemy(); 56 57 bool update() override; 58 void draw() const override; 59 60 // 引数の情報の敵情報を登録する 61 void set_enemy(float X, float Y, int Kind, int Level, int Muki); 62 // 敵にダメージを与える 63 void add_damage_to_enemy(int n, game_object_t dat); 64};
エラー↓(一部)
重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
エラー C3646 'shot_pattern16': 不明なオーバーライド指定子です th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 45
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 45
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 64
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 45
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 64
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 45
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 64
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 45
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 64
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 45
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 64
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 45
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 64
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 45
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 64
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 45
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 64
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 45
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 64
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 45
エラー C2238 ';' の前に無効なトークンがあります。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\gamelib.cpp 2319
エラー C2653 'Enemy': 識別子がクラス名でも名前空間名でもありません。 th_act_remake c:\users\nicoyou\documents\visual studio 2017\projects\th_act_remake\th_act_remake\enemybulletpattern.h 13
エラー C2653 'Enemy': 識別子がクラス名でも名前空間名でもありません。

回答1件
あなたの回答
tips
プレビュー