编辑:我没有正确解释自己。再试一次。
我正在写一个保存游戏编辑器。编辑器在保存游戏中加载,检查版本。版本信息保存在各种"数据"语句,一旦检查版本,加载了正确的偏移量。然后将偏移分配给变量。 以下是两个游戏版本(Sensible World of Soccer)的偏移量示例:
Swos_Beta_09 = { # _update: 95/96
'num_players_pos': 56717, # - Number of players in the team
'team_name_pos': 55429, # - Team Name
'mgr_forename_pos': 54987, # - Managers forename
'mgr_surname_pos': 54996, # - Managers Surname
'mgr_fullname_pos': 55460, # - Managers Full Name (Yes it is stored twice!!)
'plr1_Position_pos': 55500, # - Position of the first player in the file. This is then 38 bytes of data
'money_pos': 54742, # - Money
'tact_pos': 88374, # - First Tactic
'first_team': 90635, # - First team in the file
'CJOffset': 90614, # - File position of the version number
'CJ': "CJ281112", # - This is the version we are expecting
'version_pos': "Sensible World of Soccer v0.09 - 28/11/1994 11.00am" # - And this is the version
Swos_Release_v10 = # _update: 95/96
'num_players_pos': 56719, # - Number of players in the team
'team_name_pos': 55431, # - Team Name
'mgr_forename_pos': 54989, # - Managers forename
'mgr_surname_pos': 54998, # - Managers Surname
'mgr_fullname_pos': 55462, # - Managers Full Name (Yes it is stored twice!!)
在python中我使用了字典,然后一旦检查了版本(例如CJ031223),它就将正确的偏移复制到另一个字典(或列表)中,允许我访问数据。
注意:我将为球队和球员使用课程,我在这里并不关心。我正在寻找在c ++中做到这一点的最好方法。