Skip to content
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

Update to current version of D compiler, integrated code from stewart.zip #2

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c665d02
Stewart version from stewart.zip: non .d files, see Fix log.txt for d…
NikitaZ Jul 17, 2022
d25e38b
Stewart version from stewart.zip: comment changes and whitespace-like…
NikitaZ Jul 17, 2022
2f44ea7
Stewart version from stewart.zip: eplayer.d make some functions retur…
NikitaZ Jul 17, 2022
a95ec8e
Stewart Gordon version from stewart.zip: init() instead of memset
NikitaZ Jul 17, 2022
8c7aac2
Stewart Gordon version from stewart.zip: var.d -- sea and land are no…
NikitaZ Jul 17, 2022
62b096c
Stewart Gordon version from stewart.zip: move.d, sub2.d -- slight ref…
NikitaZ Jul 17, 2022
f3831c8
Stewart Gordon version from stewart.zip: path.d bool ok.. arrays, ite…
NikitaZ Jul 17, 2022
40f7877
Stewart Gordon version from stewart.zip: init.d whitespace change.
NikitaZ Jul 17, 2022
d90dd4b
Stewart Gordon version from stewart.zip: string related refactorings.
NikitaZ Jul 17, 2022
54ed443
Stewart Gordon version from stewart.zip: display.d string related ref…
NikitaZ Jul 17, 2022
9fd2644
Stewart Gordon version from stewart.zip: twin.d auto-detect location …
NikitaZ Jul 17, 2022
85edf23
Stewart Gordon version from stewart.zip: eplayer.d --
NikitaZ Jul 17, 2022
80b08cf
Stewart Gordon version from stewart.zip: eplayer.d - added magic cur…
NikitaZ Jul 17, 2022
d017ae2
Stewart Gordon version from stewart.zip: display.d -- clear dirty fla…
NikitaZ Jul 17, 2022
343f72c
Stewart Gordon version from stewart.zip: changes related to Save AS, …
NikitaZ Jul 17, 2022
6875f98
Stewart Gordon version from stewart.zip: winmain.d -- highlight curre…
NikitaZ Jul 17, 2022
055bc37
Stewart Gordon version from stewart.zip: winmain.d -- deselected pens…
NikitaZ Jul 17, 2022
9dbf05f
Stewart Gordon version from stewart.zip: newdisplay.d -- refactored t…
NikitaZ Jul 17, 2022
77d871e
Stewart Gordon version from stewart.zip: eplayer.d - whitespace change
NikitaZ Jul 17, 2022
319048f
Fixed an apparent return value typo in val::resgam().
NikitaZ Jul 15, 2022
e277c52
Revert back empire2.BMP
NikitaZ Jul 17, 2022
f9271e9
Bump version to 2.04.
NikitaZ Jul 17, 2022
fe0a6ea
changed "body" to "do"
NikitaZ Jul 17, 2022
e002238
final switches
NikitaZ Jul 18, 2022
f6f3479
Fixed "Error: instead of C-style syntax, use D-style int[3] d0", impo…
NikitaZ Jul 17, 2022
5427374
display.d got rid of ' d = this'.
NikitaZ Jul 15, 2022
f714e35
empire.d: upgraded to up to date random generator.
NikitaZ Jul 15, 2022
9faa7aa
windows related compilation fixes.
NikitaZ Jul 18, 2022
3e3502d
sleep replaced by Thread.sleep() hope it is true that sleep() used va…
NikitaZ Jul 18, 2022
53c232a
winmain.d: fix goto skipping variable declarations together with some…
NikitaZ Jul 18, 2022
b37afa2
winmain.d: resolve ambiguity for abs() in favor of maps.abs()
NikitaZ Jul 18, 2022
a4ee2d3
compilation fixes: mostly related to strings, arrays, pointers, this …
NikitaZ Jul 18, 2022
ea04f0e
version(NewDisplay), fixing some bugs in non NewDisplay code.
NikitaZ Jul 19, 2022
a47eee8
Build files for resource, windows and macOs to windows cross-build.
NikitaZ Jul 17, 2022
3deea7b
Compiled resources (empire.rc rarely changes) to allow easy cross-pla…
NikitaZ Jul 17, 2022
7be6cf5
Report ignored exceptions.
NikitaZ Jul 17, 2022
343fca6
Replaced vararg vsmes with vsmes(format(..))
NikitaZ Jul 18, 2022
e990eac
removed .* from %.*s in format() strings - it leads to access violation.
NikitaZ Jul 18, 2022
a2f0fd8
use version(idiotproof) for display::rusure() in display.d (similar t…
NikitaZ Jul 19, 2022
0fc313f
remove unnecessary display declaration from eplayer::cmove().
NikitaZ Jul 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 34 additions & 0 deletions Empire bugs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Fixed bugs
----------
File _open_ dialog used to _save_ a file
Leaks resources like crazy
Bogus highlight at end of turn
Need separate save/save as commands
Prompt to replace
Prompt to save on exit/new/open
Cannot find help.txt if directory has been changed e.g. when opening/saving
Immediately quits if cannot find help.txt
Status display blank after restoring from minimized
If no opponents, game doesn't respond at all (removed one-player option from UI)
Bits of status display often out of date
Starting a demo first thing causes AV
Help window cannot be scrolled by dragging the slider

Outstanding bugs
----------------
Status display blank after opening file
Scroll bars in help window should have a page size
Save/Save As needs to be disabled when no game is active
Setting of dirty flag wants work
Takes two timeslices to increment human player's turn, but only one for computer player (noticeable at beginning of the game)
Change POV is unresponsive for more than two players
Asking for 5 opponents, i.e. 6 players, delivers a 5-player game

Interface quirks
----------------
Should scroll to scene of attack (?)
Should show blast graphic when attacking cities

Possible enhancements
---------------------
Survey with mouse
69 changes: 69 additions & 0 deletions Fix log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Extracted some missing resource files from the exe:

empire.ico
blastmas.bmp
unknown1.bmp
cursor.bmp

----------
makefile

Fixed filenames in clean - winemp not empire
Removed dependence on winemp.lnk, and used DMD to link so that debugging information can be is linked in

----------
empire.rc

Set Win9x dialog style
Put the menu shortcut keys in the right place
In InitBox, fixed 'Demo' to be a checkbox
Removed option of 0 opponents from InitBox - it doesn't work and apparently isn't meant to
Added Save As command

----------
winmain.d

Cleaned up workaround to DMD 0.86 bug in std.c.windows.windows
Fixed IDM_NEW so that cancelling works
Set correct open/save dialogs and appropriate flags
Deselected pens so that they're actually deleted, eliminating resource leaks
Create the dashed pen only once on startup
Clear filename on new game
Implemented separate Save and Save As commands
Implemented prompt to save on exit, new or open
Highlight current square only if POV player's turn (still needs some work)

----------
move.d

Added invalidateLoc calls to update current square highlight
(works for 2 players, stuck for 3 or more)

----------
eplayer.d

Fixed debugging calls to non-existent functions
Added magic cursor position LOC_HIDDEN, to avoid a misleading highlight at the end of the player's turn
Disabled cwatch - it either does nothing or causes Empire to hang

----------
display.d

Clear dirty flag on loss of game

----------
twin.d

Auto-detect location of exe, and look for help file there
Catch file not found error

----------
newdisplay.d

Refactored the text display engine to make more sense for D and for a GUI app.

----------
help.txt

Run through spellchecker
Removed an anachronism or two
Binary file added blastmas.bmp
Binary file not shown.
5 changes: 5 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rm *.obj

rm winemp.exe

dmd -g -version=NewDisplay newdisplay empire init maps move path eplayer sub2 printf var mapdata winmain twin Winmm.lib empire.res user32.lib gdi32.lib comdlg32.lib -ofwinemp.exe
28 changes: 28 additions & 0 deletions build_mac_to_win.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
rm *.obj *.exe
# to build with newdisplay
../d-compiler/ldc2-1.30.0-beta1-osx-arm64/bin/ldc2 -g -mtriple=i686-windows-msvc -d-version=NewDisplay newdisplay empire init maps move path eplayer sub2 printf var mapdata winmain twin Winmm.lib empire.res -ofwinemp.exe
exit
# to build with older display and text
../d-compiler/ldc2-1.30.0-beta1-osx-arm64/bin/ldc2 -d-debug -g -mtriple=i686-windows-msvc display text empire init maps move path eplayer sub2 printf var mapdata winmain twin Winmm.lib empire.res -ofwinemp.exe
exit

etc/ldc2.conf should contain:
"i686-.*-windows-msvc":
{
switches = [
"-defaultlib=phobos2-ldc,druntime-ldc",
];
lib-dirs = [
"%%ldcbinarypath%%/../lib-winx86",
];
};

same command as above works on windows as well:
c:\d\bin\ldc2 newdisplay empire init maps move path eplayer sub2 printf var mapdata winmain twin Winmm.lib empire.res -ofwinemp.exe

but NOT on shared drives where ldc2 gives cryptic error:

lld-link: error: cannot open output file winemp.exe: function not supported

so better use dmd on windows:
dmd newdisplay empire init maps move path eplayer sub2 printf var mapdata winmain twin Winmm.lib empire.res user32.lib gdi32.lib comdlg32.lib -ofwinemp.exe
1 change: 1 addition & 0 deletions compile_rc.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\RC" /i"C:\Program Files\Microsoft SDKs\Windows\v7.1\Include" empire.rc