Skip to content

halts count curve in citylist_frame#508

Open
simupoppo wants to merge 4 commits into
teamhimeh:OTRP-KUTAv6from
simupoppo:OTRP-KUTA-RC_halt_count
Open

halts count curve in citylist_frame#508
simupoppo wants to merge 4 commits into
teamhimeh:OTRP-KUTAv6from
simupoppo:OTRP-KUTA-RC_halt_count

Conversation

@simupoppo

Copy link
Copy Markdown
Collaborator

駅数の変遷を記録し、citylist_frame_tに駅数推移グラフを描画できます

@teamhimeh teamhimeh left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude による自動コードレビューです。

Diff 全体と周辺コードを分析した結果、セーブ/ロード互換性に関する問題を1件検出しました。

Comment thread simworld.cc
}
}
// WORLD_HALTS added in OTRP v56; older files have no recorded data
if( file->get_OTRP_version() > 55 ) {

@teamhimeh teamhimeh May 16, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

セーブ/ロードのバージョン判定が不一致 — ファイル破壊バグ

save() 側では WORLD_HALTS の 24 個の sint64 値(年×12 + 月×12)を無条件に書き込んでいます。そのため現在の OTRP_VERSION_MAJOR == 55 でセーブしたファイルには、バージョンスタンプ 55 の状態で WORLD_HALTS データが含まれます。

しかし load() 側のこのガードは > 55(v56 以上)でしか読まないため、v55 のセーブファイルをロードすると 192 バイト分を読み飛ばしてしまい、以降のシナリオ・motd・チャットログ等のデータ読み込み位置がずれてゲームが破壊されます。

修正: > 55>= 55 に変更してください。これにより、現在の v55 バイナリが書いたファイルも正しく読めるようになります。

save側もguardしてください

(Claude による自動レビュー)

Comment thread simworld.cc
file->rdwr_longlong(finance_history_month[month][cost_type]);
}
}
// WORLD_HALTS added in OTRP v56; older files have no recorded data

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このコメントは「OTRP v56 で追加」と書いてありますが、save() 側(新 4934 行目付近)のコメントには「OTRP v55 で追加」と書かれており、矛盾しています。

上の > 55>= 55 に修正した場合、「v55 以降のファイルに記録されている」という意味になるので、こちらのコメントも「v55 で追加」に統一してください。

(Claude による自動レビュー)

@simupoppo

Copy link
Copy Markdown
Collaborator Author

コメントを修正し、v56以降でのセーブ・ロードに対応しました

@teamhimeh teamhimeh left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

前回のレビューで指摘されたセーブ/ロードのバージョン不整合は修正されました(save() 側にも get_OTRP_version()>55 ガードが追加)。

残り1件の軽微な不整合を検出しました。

Comment thread simworld.h Outdated
WORLD_MAIL_GENERATED, ///< all letters generated
WORLD_GOODS_RATIO, ///< ratio of chain completeness
WORLD_TRANSPORTED_GOODS, ///< all transported goods
WORLD_HALTS, ///< total number of halts (recorded from OTRP v55)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WORLD_HALTS のコメントに「recorded from OTRP v55」とありますが、実際には file->get_OTRP_version() > 55 でガードされているため、データがセーブファイルに書き込まれるのは OTRP v56 以降です。simworld.cc のコメントは正しく「WORLD_HALTS added in OTRP v56」と記載されており、不整合が生じています。

/// total number of halts (recorded from OTRP v55)/// total number of halts (recorded from OTRP v56) に修正してください。

(Claude による自動レビュー)

@teamhimeh teamhimeh left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメントだけ直してもらえれば大丈夫だと思います

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants