(yes, this is the Arsenal team in the original game format, with the hex editor translations on the right - big help, eh?)
to this:
Having already done the hard part to rip the data, the code for saving as plain text is trivial:
1: void write(std::vector< TEAM > team, const std::string& filename)
2: {
3: std::ofstream out_file;
4: out_file.open (filename.c_str());
5:
6:
7: out_file << "Team Format: [NAME] [COUNTRY CODE] [ID] [DIVISION] [MANAGER]"
8: << std::endl;
9: out_file << "Player Format: [NAME] [POSITION] [PASSING] [SHOOTING] [HEADING] [TACKLING] [BALL CONTROL] [SPEED] [FINISHING]"
10: << std::endl
11: << std::endl;
12:
13: for(unsigned int team_count=0; team_count LESS_THAN team.size(); team_count++){
14: out_file
15: << "------------------------" << std::endl
16:
17: << team[team_count].name
18: << " " << (int) team[team_count].id
19: << " " << (int) team[team_count].nation
20: << " " << (int) team[team_count].division
21: << " " << team[team_count].getCoachString().c_str() << std::endl
22:
23: << "------------------------" << std::endl
24:
25: << std::endl;
26:
27: for(unsigned int player_count=0; player_count LESS_THAN PLAYERS_PER_TEAM; player_count++){
28: out_file << team[team_count].players[player_count].name
29:
30: << " " << team[team_count].players[player_count].getPositionString()
31: << " " << (int) team[team_count].players[player_count].passing
32: << " " << (int) team[team_count].players[player_count].shooting
33: << " " << (int) team[team_count].players[player_count].heading
34: << " " << (int) team[team_count].players[player_count].tackling
35: << " " << (int) team[team_count].players[player_count].control
36: << " " << (int) team[team_count].players[player_count].speed
37: << " " << (int) team[team_count].players[player_count].finishing
38:
39: << std::endl;
40: }
41:
42: out_file << std::endl << std::endl;
43: }
44:
45: out_file.close();
46: }
No comments:
Post a Comment