-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
game converter for old linux games to the new unified format for both linux and windows #77
game converter for old linux games to the new unified format for both linux and windows #77
Conversation
On Linux c3.h is supposed to include ctp2_config.h, which includes config.h, but only if HAVE_CONFIG_H has been defined. This is however defined in windows.h, which was included afterwards. ctp2_config.h was already included by ctp2_inttypes.h, since both files have multiple inclusion guards, things that should be defined in the translation unit won't be defined. For instance if you build a debug build, _DEBUG should be defined, but because of this you can't be sure whether it is really defined. This is also true for USE_SDL. Obviously, this small change can change what is compiled at various places. Actually, c3.h is supposed to be a precompiled header that is supposed to be included in every source. However, this is not true, even so it must be done to make sure that config.h is used in every translation unit. ..\ctp2_code\ctp\c3.h ..\ctp2_code\os\include\ctp2_inttypes.h
..\ctp2_code\ctp\c3.h ..\ctp2_code\os\nowin32\windows.h
…Include-Order-In-c3.h
…Include-Order-In-c3.h
@MartinGuehmann Commits OK for you? Can you do 3.? For that just add a remote to my fork:
and add your changes onto that and create a PR to my fork and I can include it in this PR or you can create a new PR or use your maintainer power and directly push the new branch to https://github.com/civctp2/civctp2. Or you can do this: https://help.github.com/articles/checking-out-pull-requests-locally/#modifying-an-inactive-pull-request-locally |
You could have left out citydata.h, UnitData.h, and Vision.h, but if they do not confuse you anymore then they can be left in. I figured out how to create a new branch in the repository via the GitHub interface. So I changed the merge target of this pull request. I can do 3. The files to modify are: c3.h Player.cpp is the harder one, so probably, not today. Probably, I can still use #70 as a test PR. |
As I understood your explanation, they do concern that commit, so I left them in.
That's great, looks good.
Sure, you can just push to #70 and I can then cherry-pick your commit on to this PR. |
Hm, wouldn't it suffice to revert changes from afb53bf since it fully reverts to the old style?
|
OK, with ef5d674 I can still load the old games and save the to a new format but that can neither be opened with the same exe nor with that from master, so I guess ef5d674 is missing some changes, possibly differentiating the GUID on save and load. @MartinGuehmann any ideas? |
It's the GUID that makes the trouble. |
@MartinGuehmann Do you have an idea how to solve that for the load-old save-new format commit? |
14152d5
to
3382865
Compare
Squashed your new commits to #70 and separated the white space changes into their own commit, that way it is far easier to rule out commits for future debugging. Works perfectly, can now convert old Linux save-games to the new unified format, see e.g. fd25b12. Many thanks @MartinGuehmann for this special effort! @MartinGuehmann What do you think? From my side ready for the game-converter tag/release. |
fd25b12
to
8d135e5
Compare
Well, the white space, it is simply done by the way. So it goes in by the way.
From my side it is done two and could go to its dedicated branch. Unless you still wanna update the readme. Which we could also do in principle in a later pull request. |
…n-c3.h Make c3.h to includes what it is supposed to include
Good point, better now than later (or never). |
…Converter release): This commit basically reverts back to the state before 22dd180 concerning the save-game format for linux created from the commits of civctp2#70 with: git merge --squash b475d51 git diff -U0 -w --no-color | git apply --cached --ignore-whitespace --unidiff-zero - Squashed commit of the following: commit b475d51 Author: Martin Gühmann <guehmann@t-online.de> Date: Sun Jan 27 21:10:40 2019 +0100 Fix the last incompatibility for loading Linux games in the old format ..\ctp2_code\gs\gameobj\CityData.cpp Adds some test code that is not so trivial to generate. It is however outcommented. ..\ctp2_code\gs\gameobj\UnitData.h ..\ctp2_code\gs\gameobj\Vision.h ..\ctp2_code\gs\gameobj\citydata.h Just a style change, no functional change, is for now also outcommented ..\ctp2_code\os\nowin32\windows.h commit dcd2f41 Merge: dbd2603 57f0b0d Author: Martin Gühmann <guehmann@t-online.de> Date: Sun Jan 27 00:20:27 2019 +0100 Make it compile ctp2_code/os/nowin32/windows.h commit dbd2603 Author: Martin Gühmann <guehmann@t-online.de> Date: Sun Jan 27 00:04:54 2019 +0100 Make games load that have been created before the format fix, the games are saved in the same format ..\ctp2_code\ctp\c3.h ..\ctp2_code\gs\fileio\GameFile.cpp ..\ctp2_code\os\nowin32\windows.h commit 57f0b0d Author: Martin Gühmann <guehmann@t-online.de> Date: Sun Jan 27 00:04:54 2019 +0100 Make games load that have been created before the format fix, the games are saved in the same format ..\ctp2_code\ctp\c3.h ..\ctp2_code\gs\fileio\GameFile.cpp ..\ctp2_code\os\nowin32\windows.h
…ompatible with Win (for gameConverter release): Squashed commit of the following (from civctp2#70, without white space changes): commit 1b096f4e8eccb6bdc295fd1943507f7daaddc957 Author: Martin Gühmann <guehmann@t-online.de> Date: Wed Jan 30 23:05:21 2019 +0100 Make games saved indeed in the Windows format Also k_SCENARIO_NAME_MAX is defined as _MAX_PATH, which makes it hard to catch. ..\ctp2_code\gs\fileio\GameFile.cpp commit 19ea18f397807ff7b481d0847af1a54846788e43 Author: Martin Gühmann <guehmann@t-online.de> Date: Wed Jan 30 20:26:54 2019 +0100 Make CTP2 load games in the old Linux format and save them in the Windows format ..\ctp2_code\gs\fileio\GameFile.cpp ..\ctp2_code\gs\gameobj\CityData.cpp ..\ctp2_code\gs\gameobj\Player.cpp ..\ctp2_code\os\nowin32\windows.h
04fd563
to
abe0128
Compare
Rebased on to current master. |
So merged and released: https://github.com/civctp2/civctp2/releases/tag/GameConverter, via the GitHub web interface. I can still edit the release, if you don't like the text, which I mainly took from the readme, or wanna have some binaries added. |
Looks good, thanks @MartinGuehmann |
@MartinGuehmann Sorry, commented to quickly, just noticed that the tag does not point to the right commit. It should point to 77ad5c2 |
That's odd, I expect if I select the correct branch that it contains the last thing I added. So deleted the release and tag and readded it. The odd thing is when I tried to select a commit, it did not appear there. But then it worked. Maybe these annoying messages "...added an hour from now." have some meaning. You know when I read it it means too me that the time is in the future, even so it is in the past. Maybe I have to wait an hour until I can select it. |
Perfect now. |
PR relating to #70, with the following commits:
revert to load and save the old style format for linux
linux save-game in the old format that loads, and if saved should be loadable again.
Changes to save in the new format but still load the old, i.e. the converter version of ctp2 for old linux save-games to the new format that is then compatible with windows save-games.
the save-game from 2. should still be loadable, but if saved the new version should not be loadable any more (but instead with ctp2 from master), so just as a reference, the newly saved game is added as a commit.
Note: This PR is then intended to not be merged into master but instead into a new branch that then gets a tag to be the converter release.