solves the confusing behavior when both automaterial and buildingplan
are enabled for constructions. the two plugins now communicate with each
other over the Lua layer to negotiate consistent behavior.
if neither plugin is enabled, the standard DF UI acts as normal
if automaterial is enabled but buildingplan is not, then automaterial
behavior is unchanged.
if buildingplan is enabled and automaterial is not then behavior is
the same as other buildings with buildingplan (no material selection
screen, screen stays on building placement screen after placement).
this commit fixes a bug, though, where buildingplan would only lay
down a single tile of contruction instead of a solid block when a
block is requested.
if both plugins are enabled but buildingplan is not enabled for the
building type then automaterial is unchanged from previous behavior,
execpt for an additional header showing the separation between
automaterial hotkeys and buildingplan hotkeys.
finally, if both plugins are enabled and buildingplan is enabled for the
building type then buildingplan behavior prevails, but the box select and
hollow designations features of automaterial are still usable and
useful. the 'Auto Mat-select', 'Reselect Type', and "Open Placement"
automaterial hotkeys are hidden in the UI and ignored in the feed. This
is because buildingplan takes over material selection, so 'Auto
Mat-select' doesn't make sense. Buildingplan also already stays on the
placement screen after placement, so 'Reselect Type' is not necessary.
And all buildingplan-placed buildings have relaxed placement
restrictions (e.g. they can be built in mid-air) so 'Open Placement' is
also not necessary. The missing options are replaced with blank lines so
the vertical alignment of all other options stays constant.
we also remove a few extra lua_pop() calls that are made superfluous by
the StackUnwinder.
Replace C++ building construction code with lua constructBuilding so we can get the proper job_item filters set. these filters will be used when we replace the core buildingplan algorithm in the next PR.
- Confirmed that libexpat is built statically and linked with xlsxreader
- May need da7cda3a85 for Windows
- Although libexpat's CMake options are all prefixed with LIBEXPAT_, it also adds some cache entries like SIZE_T (from expat/ConfigureChecks.cmake). Unsure if these affect other libs.
- xlsxio may need additional reconfiguration after moving to add_subdirectory() to find libexpat/libzip on non-Linux platforms.
- no API or logic changes, just moving code around
- split buildingplan-lib into planner and rooms files
- move business logic from .h files to .cpp files
This makes jsoncpp a submodule that can be build directly from git
sources. This changes depends/jsoncpp to depends/jsoncpp-sub to avoid
filename conflict if someone tries to use git bisect.
jsoncpp library name changes to jsoncpp_lib_static.
jsoncpp version is the latest tagged release.
Implements helper functions for random number generation.
Implemented using C++11 <random> library.
Exported Lua Functions:
- seedRNG(seed)
- rollInt(min, max)
- rollDouble(min, max)
- rollNormal(mean, std_deviation)
- rollBool(chance_for_true)
- resetIndexRolls(string, array_length) --String identifies the instance of SimpleNumDistribution to reset
- rollIndex(string, array_length) --String identifies the instance of SimpleNumDistribution to use
--(Shuffles a vector of indices, Next() increments through then reshuffles when end() is reached)
On branch cxxrandom-rel
Changes to be committed:
modified: plugins/CMakeLists.txt
new file: plugins/cxxrandom.cpp
new file: plugins/lua/cxxrandom.lua
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Squashed commit of the following:
commit 3a7ef70d45f3e0c2fe367141dd0349dddaaff60d
Merge: fd9f1982 7aa0608c
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date: Fri Dec 22 22:17:27 2017 -0800
Merge remote-tracking branch 'origin/temp' into cxxrandom
commit 7aa0608cb85dcf82686193db7a6e9d1318f5f2a5
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date: Thu Dec 21 21:43:35 2017 -0800
Revises cxxrandom plugin
New functions:
- seedRNG(ushort seed)
--lua exported
- GetDistribContainer()
--internal singleton
- RNG()
--internal singleton
Summary:
- Removed class CXXRNG
--Refactored functions that used CXXRNG
Changes to be committed:
modified: plugins/cxxrandom.cpp
commit b42979818a01c1121eace7b1ac14676f5ad5d8b2
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date: Wed Dec 20 13:21:49 2017 -0800
Fixes plugin_init()
Misread the lines indicated by lethosor to be excluded, had broken the plugin in the process.
Changes to be committed:
modified: plugins/cxxrandom.cpp
commit 753a00a14d9e6519d299638e014abf30509940af
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date: Wed Dec 20 12:36:17 2017 -0800
Cleans up cxxrandom.cpp
DFHack contributions specifies:
-spaces instead of tabs, so tabs were converted.
-C++ headers before dfhack stuff, so it was done
*Also added author name, creation date, and last updated date.
Changes to be committed:
modified: plugins/cxxrandom.cpp
commit 498ebe4b8fdccc01ac1f169269f3093c830a8a10
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date: Tue Dec 19 22:51:58 2017 -0800
Updates cxxrandom, fixes instance leak
deleted header
moved definition to cpp file #lethosor
fixed singleton instance, no longer a pointer
commented out dfhack commands, now only init/shutdown and exported lua functions
modified: cxxrandom.cpp
deleted: cxxrandom.h
commit 821044bef2a0201d0d74192e445c7b29766b42a1
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date: Sun Dec 17 04:01:11 2017 -0800
Fixes RollIndex and Renames RollNormal
Renamed the Normal Distribution RNG function to fit the standard.
Now named RollNormal(m,s)
Fixed some wonky white space in the lua macro export block.
Fixed a stupid mistake with the RollIndex output. (it was outputting 0's)
Updated usage details.
Changes to be committed:
modified: plugins/cxxrandom.cpp
commit 1536f43d137b6bc55d55759b43bdccf6ff429b33
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date: Fri Dec 15 08:50:08 2017 -0800
Fixes/Improves cxxrandom
Modified return types
Corrected index distribution code
commit 8629c7e1509522cb0cc4b649914b90d033cb4763
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date: Thu Dec 14 19:02:29 2017 -0800
Implements SimpleNumDistribution
Exported additional functions to lua.
Functions allow the generation of random 0-N index values.
Generation promises all unique values [0,N] will be returned once each when generation is run N times.
On branch cxxrandom
Changes to be committed:
modified: plugins/cxxrandom.cpp
modified: plugins/cxxrandom.h
commit f035f3d20415790542cf83e5e696261661d911f3
Author: Josh Cooper <cooper.s.josh@gmail.com>
Date: Wed Dec 13 23:55:39 2017 -0800
Implements cxxrandom
cxxrandom was implemented using a singleton.
This singleton provides an interface for generating uniform numbers, or numbers in a normal distribution, and also booleans(given the probability for the true outcome)
The singleton interface is wrapped in functions which are exposed for lua usage.
Integrated into plugins/CMakeLists.txt
On branch dev
Changes to be committed:
modified: CMakeLists.txt
new file: cxxrandom.cpp
new file: cxxrandom.h
new file: lua/cxxrandom.lua