Skip to content

Commit

Permalink
互換モードの種類を整理
Browse files Browse the repository at this point in the history
小田急線向け ATS プラグインと東京メトロ準拠 TASC プラグインは
メトロ総合プラグインと部分的に共通の仕様を有しているが、
それぞれの固有の機能に関しては互換性がなく、
メトロ総合プラグイン互換モードだけでこれらを全てサポートしようとすると
仕様の衝突・矛盾が起きる場合があるので別々の互換モードに分ける。
  • Loading branch information
magicant committed Apr 29, 2023
1 parent 8028b68 commit 30b5dfe
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 12 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
- [x] 独自地上子
- [x] 汎用 ATS プラグインの地上子
- [x] δ ナックニスタさんの TASC プラグインの地上子
- [ ] 小田急線向け ATS プラグインの地上子
- [x] 小田急線向け ATS プラグインの地上子
- [x] Unicorn さんの東京メトロ準拠 TASC プラグインの地上子
- [x] 計器パネルへの動作状態の表示
- [x] ブレーキノッチ
- [x] 停止位置までの残距離
Expand Down
2 changes: 1 addition & 1 deletion bve-autopilot/ato.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ namespace autopilot
}
}

if (状態.互換モード() == 互換モード型::小田急PI) {
if (状態.互換モード() == 互換モード型::小田急d_ats_p) {
switch (地上子.Type) {
case 4: //制限速度設定
if(地上子.Optional % 100 == 0)//制限解除
Expand Down
8 changes: 5 additions & 3 deletions bve-autopilot/tasc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ namespace autopilot {
停止位置を追加(static_cast<m>(地上子.Optional), 状態);
break;
case 200: // TASC 目標停止位置設定(追加:小田急PIのATO互換)
if (状態.互換モード() == 互換モード型::メトロ総合 || 状態.互換モード() == 互換モード型::小田急PI) {
if (状態.互換モード() == 互換モード型::小田急d_ats_p ||
状態.互換モード() == 互換モード型::小田急cs_atc)
{
停止位置を追加(static_cast<m>(地上子.Optional / 10), 状態);
}
break;
Expand All @@ -108,9 +110,9 @@ namespace autopilot {
switch (地上子.Type)
{
case 21:
//case 22:(小田急PIのATSと干渉するため暫定コメントアウト)
case 22:
case 23:// TASC 目標停止位置設定(追加:メトロ対応TASC互換)
if (状態.互換モード() == 互換モード型::メトロ総合) {
if (状態.互換モード() == 互換モード型::メトロtasc) {
次駅停止位置を設定(
static_cast<m>(地上子.Optional % 1000), 直前位置, 状態);
}
Expand Down
12 changes: 6 additions & 6 deletions bve-autopilot/信号順守.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,14 @@ namespace autopilot
}
break;
case 12: // ORP 起動 (メトロ総合プラグイン互換)
if (状態.互換モード() == 互換モード型::メトロ総合) {
if (cs_atc互換モードである(状態.互換モード())) {
if (_現在閉塞.信号指示 == orp::orp信号インデックス) {
_現在閉塞.orp.設定(地上子.Optional, 直前位置);
}
}
break;
case 22: // 信号現示受信(小田急PI互換)
if (状態.互換モード() == 互換モード型::小田急PI) {
if (状態.互換モード() == 互換モード型::小田急d_ats_p) {
ATS_BEACONDATA Option;
Option = 地上子; //代入する
switch (地上子.Optional)
Expand All @@ -460,7 +460,7 @@ namespace autopilot
}
break;
case 31: // 信号現示受信 (メトロ総合プラグイン互換)
if (状態.互換モード() == 互換モード型::メトロ総合) {
if (cs_atc互換モードである(状態.互換モード())) {
信号現示受信(地上子, 直前位置, 状態, false);
}
break;
Expand Down Expand Up @@ -533,7 +533,7 @@ namespace autopilot
}
}

if (状態.互換モード() == 互換モード型::メトロ総合) {
if (cs_atc互換モードである(状態.互換モード())) {
// ORP の出力ノッチを取り込む
ノッチ = std::min(ノッチ, _現在閉塞.orp.出力ノッチ());
ノッチ = std::accumulate(
Expand All @@ -554,7 +554,7 @@ namespace autopilot

bool 信号順守::orp照査中(const 共通状態 &状態) const noexcept
{
return 状態.互換モード() == 互換モード型::メトロ総合 &&
return cs_atc互換モードである(状態.互換モード()) &&
_現在閉塞.orp.制御中();
}

Expand Down Expand Up @@ -612,7 +612,7 @@ namespace autopilot
auto 閉塞 = 対応する閉塞(受信した閉塞始点のある範囲, _前方閉塞一覧);
閉塞->状態更新(地上子, _信号速度表, 信号インデックスを更新する);

if (状態.互換モード() == 互換モード型::メトロ総合) {
if (cs_atc互換モードである(状態.互換モード())) {
const auto &直前閉塞 =
閉塞 == _前方閉塞一覧.begin() ? _現在閉塞 : *std::prev(閉塞);
閉塞->orp状態更新(直前閉塞.信号速度);
Expand Down
15 changes: 14 additions & 1 deletion bve-autopilot/共通状態.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,22 @@ namespace autopilot {
汎用ats,
メトロ総合,
swp2,
小田急PI,
小田急d_ats_p,
小田急cs_atc,
メトロtasc,
};

constexpr bool cs_atc互換モードである(互換モード型 互換モード) noexcept {
switch (互換モード) {
case autopilot::互換モード型::メトロ総合:
case autopilot::互換モード型::小田急cs_atc:
case autopilot::互換モード型::メトロtasc:
return true;
default:
return false;
}
}

class 共通状態
{
public:
Expand Down

0 comments on commit 30b5dfe

Please sign in to comment.