Commit Graph

14110 Commits (eb742a603dcc945a09181662c9ea9138b78f81ba)
 

Author SHA1 Message Date
Josh Cooper bc32d15bea [Release] cxxrandom v2.0
Major Revision
update v2.0
=-=-=-=-=
Native functions(exported to lua):
-GenerateEngine:  returns engine id              (args: seed)
-DestroyEngine:   destroys corresponding engine  (args: rngID)
-NewSeed          re-seeds engine                (args: rngID, seed)
-rollInt          generates random integer       (args: rngID, min, max)
-rollDouble       generates random double        (args: rngID, min, max)
-rollNormal       generates random normal[gaus.] (args: rngID, avg, stddev)
-rollBool         generates random boolean       (args: rngID, chance)
-MakeNumSequence  returns sequence id            (args: start, end)
-AddToSequence    adds a number to the sequence  (args: seqID, num)
-ShuffleSequence  shuffles the number sequence   (args: rngID, seqID)
-NextInSequence   returns the next number in seq.(args: seqID)

Lua plugin functions:
-MakeNewEngine    returns engine id              (args: seed)

Lua plugin classes:
-crng
    methods:
        -init(id, df, dist)     :: constructor
            id                           - Reference ID of engine to use in RNGenerations
            df (optional)                - bool indicating whether to destroy the Engine when the crng object is garbage collected
            dist (optional)              - lua number distribution to use
        -__gc()                 :: destructor
        -changeSeed(seed)       :: alters engine's seed value
        -setNumDistrib(distrib) :: set's the number distribution crng object should use
            distrib                      - number distribution object to use in RNGenerations
        -next()                 :: returns the next number in the distribution
        -shuffle()              :: effectively shuffles the number distribution
-normal_distribution
    methods:
        -init(avg, stddev)      :: constructor
        -next(id)               :: returns next number in the distribution
            id                           - engine ID to pass to native function
-real_distribution
    methods:
        -init(min, max)         :: constructor
        -next(id)               :: returns next number in the distribution
            id                           - engine ID to pass to native function
-int_distribution
    methods:
        -init(min, max)         :: constructor
        -next(id)               :: returns next number in the distribution
            id                           - engine ID to pass to native function
-bool_distribution
    methods:
        -init(min, max)         :: constructor
        -next(id)               :: returns next boolean in the distribution
            id                           - engine ID to pass to native function
-num_sequence
    methods:
        -init(a, b)             :: constructor
        -add(num)               :: adds num to the end of the number sequence
        -shuffle()              :: shuffles the sequence of numbers
        -next()                 :: returns next number in the sequence

Adds missing function exports.

Fixes numerous problems I won't go into
2018-04-29 21:08:44 -07:00
Josh Cooper 23b2d5eba5 Merge branch cxxrandom
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
2018-04-29 21:08:44 -07:00
Ben Lubar 69373e367c
Merge pull request #1261 from BenLubar/pull-request-test
Replace submodule URLs with relative URLs so they will be downloaded via the same transport as the main repo (HTTPS or SSH, usually)
2018-04-24 11:41:21 -05:00
Ben Lubar 8f609d0ddf
Replace submodule URLs with relative URLs
They will be downloaded via the same transport as the main repo (HTTPS or SSH, usually)
2018-04-23 18:56:29 -05:00
AtomicChicken c58ffdb922
Added function to remove syndrome wound data
The presence of syndrome data in unit.syndromes.active generates corresponding wound data in unit.body.wounds. This wound data acts to produce all of the syndrome's actual effects, including but not limited to flag changes, interaction abilities, body transformation and display name alterations. Wound data persists when syndrome data is cleared from unit.syndromes.active. Since syndrome-util did not touch wound data at all, the erase function was completely ineffective at actually removing syndromes.

Note that syndromes also generate a bunch of data in the historical figure information of units. I have observed that this historical data is sufficient to restore the syndrome in a unit following map reload (at least in adventure mode), so its clearance (which needs to also include any corresponding interaction effects) will have to be addressed in a future update. As is, syndrome erasure remains incomplete.
2018-04-20 17:14:03 +02:00
lethosor a708b0b303 Add some includes in DataDefs.h 2018-04-19 21:11:43 -04:00
lethosor 5cd8aa0458 Update downloads to 0.44.09 2018-04-19 12:35:00 -04:00
lethosor 3b2112a56e Update scripts/exterminate 2018-04-19 12:14:08 -04:00
Lethosor 48690a3ea1
Merge pull request #1254 from lethosor/complex-enum
Complex enum metadata
2018-04-18 22:12:17 -04:00
lethosor 2bf9632000 Merge remote-tracking branch 'origin/develop' into complex-enum 2018-04-11 10:23:32 -04:00
Japa 0ea35a6e93 Merge remote-tracking branch 'lethsor/master' into remote_reader 2018-04-11 18:28:41 +05:30
Lethosor c0787f065b
Merge pull request #1253 from BenLubar/warnings-fix
Fix MSVC and GCC warnings in DFHack and core plugins
2018-04-10 18:53:34 -04:00
Ben Lubar f9ad71f682
Fix fencepost error in autolabor/autohauler/labormanager.
https://github.com/DFHack/dfhack/pull/1253#pullrequestreview-110903215
2018-04-10 13:29:00 -05:00
lethosor b0e1ae93ea Add next_item, _complex for complex enums 2018-04-09 19:46:12 -04:00
lethosor 9398262654 Make enum attrs work for complex enums (lever_target_type) 2018-04-09 16:12:03 -04:00
lethosor 7da8793172 Set last_item_value properly for complex enums 2018-04-09 16:11:47 -04:00
lethosor c1dd21730d Fix complex enum ipairs for first element 2018-04-09 11:27:02 -04:00
lethosor 61539bf345 Lua: implement key lookup and ipairs for complex enums 2018-04-09 11:04:37 -04:00
lethosor ae6b8a16e8 Handle most complex enum metadata on the C++ side 2018-04-09 03:00:58 -04:00
lethosor 165167defe Update scripts 2018-04-07 10:47:25 -04:00
Ben Lubar afc2c476bb
Fix remaining warnings on Windows. 2018-04-06 21:22:48 -05:00
Ben Lubar 67de61a1fe
Fix GCC warnings in stonesense. 2018-04-06 18:18:48 -05:00
Ben Lubar 1dd6625270
Fix remaining warnings in supported plugins 2018-04-06 14:17:34 -05:00
Ben Lubar a7dfacd1c5
Fix warnings in supported plugins. 2018-04-06 01:25:21 -05:00
Ben Lubar f3038fef09
Mark static functions in uicommon as "static inline" to remove the warning if they are not used. 2018-04-05 16:51:10 -05:00
Ben Lubar 7aee061258
Ignore warnings in plugin protobufs. 2018-04-05 16:50:28 -05:00
Ben Lubar 51661d7355
Fix -Wswitch warning about UNDERWORLD_GATE in MapCache. 2018-04-05 16:50:04 -05:00
Ben Lubar 565c1e1260
Fix uninitialized pointer being returned from Gui::getAnyUnit when on the pet list with no selection. 2018-04-05 16:49:30 -05:00
Ben Lubar 0a2ec30199
Remove or comment out unused code. 2018-04-05 16:48:11 -05:00
Ben Lubar 2eec5ee78d
Fix signed/unsigned comparison warnings in core. 2018-04-05 16:47:47 -05:00
Ben Lubar 304e1d45f0
Remove unused labels in Console-posix.cpp 2018-04-05 16:46:59 -05:00
Ben Lubar ec5d238e5e
Remove warnings in generated code for core protobufs. 2018-04-05 16:46:04 -05:00
Ben Lubar a37df92656
[labormanager] fix warning about non-virtual destructor in jlfunc 2018-04-05 16:04:14 -05:00
Ben Lubar a44b3b8f98
Move null pointer check from Job module to LuaApi, where it does not invoke undefined behavior. 2018-04-05 16:01:26 -05:00
Ben Lubar 91930a618f
[dwarfvet] Fix infinite loop if an animal is not accepted at a hospital. 2018-04-05 15:01:50 -05:00
Ben Lubar a3d4c586ab
Hide "complex enum" warning for dfhack-specific enums. 2018-04-05 14:48:29 -05:00
Ben Lubar 9cbba0ae01
Hide warnings about non-virtual destructors from df-structures. 2018-04-05 14:46:28 -05:00
Ben Lubar 8a53ad543f
Fix clsocket warnings. 2018-04-05 14:46:02 -05:00
Ben Lubar 5d24aa8b62
Fix memset call in md5.cpp 2018-04-05 14:28:00 -05:00
Ben Lubar 1ec96aa992
Disable pointless warnings in protobuf-generated code. 2018-04-05 13:58:10 -05:00
lethosor 5ee73a5a73 Add an option to generate changelogs for individual versions 2018-04-05 11:55:25 -04:00
lethosor cb463c34d8 Automatically replace search with search-plugin in changelog 2018-04-05 11:21:45 -04:00
lethosor ef7dc06221 Fix search plugin link and block links to search page in changelog 2018-04-05 11:02:17 -04:00
lethosor 1badadf535 search: fix 4/6 keys in unit screen 2018-04-05 10:08:07 -04:00
lethosor 868c032578 liquids: initialize range dimensions 2018-04-05 02:19:04 -04:00
lethosor e9457b9f65 liquids: use unique_ptr properly 2018-04-05 02:15:32 -04:00
lethosor b6311ec6b8 Bump to 0.44.09-r1 2018-04-04 22:45:34 -04:00
lethosor 86e0cb4b32 Update changelog (OS X GCC, bump version) 2018-04-04 20:07:41 -04:00
lethosor ad6a96f2c5 Update Compile.rst for GCC 7 (OS X) 2018-04-04 20:01:52 -04:00
lethosor c8089db5df Install the correct libstdc++ 2018-04-04 20:01:27 -04:00