Commit Graph

587 Commits (d78f5ba384a17409ec88ba54b23836071d837007)

Author SHA1 Message Date
Alexander Gavrilov 415cdad489 Make using new for allocating DF objects with vtables a compile-time error.
When done from plugins, it doesn't correctly initialize the vtable
because of some weird things MSVC does, so the only safe way is to
use df::allocate<df::foo>(). For consistency, it is also enforced
for code in the main library. It reveals the issue in the digging
invaders plugin, first found by warmist.

This change is linked to a modification in df-structures codegen.
2014-04-30 21:28:02 +04:00
Alexander Gavrilov 98325757e2 Fix signed-unsigned mismatch warnings in the new item value code.
Unsigned comparison allows catching negatives in the same check too.
Also, it didn't check the values in getValue.
2014-04-30 20:44:22 +04:00
Quietust 0f4684f29d Add Items::getItemBaseValue and Items::getValue, available from Lua 2014-04-25 11:04:21 -05:00
Quietust 57fbb1004b Assorted cleanup 2014-04-23 08:23:34 -05:00
Quietust c3d45c3a1e Add Job::getName(job *), also available from Lua 2014-04-23 08:03:10 -05:00
Alexander Gavrilov 6bef167f83 Add a couple of useful scripts and fix two missing NULL checks.
- A script to unstick jobs trying to build walls from the same tile.
- A devel script for viewing the path a unit is currently following.
2014-04-21 09:24:05 +04:00
Alexander Gavrilov c27c38e4c0 Remove tired or hungry siege operators from duty when at peace.
The threshold is set at the level when they start to blink - normally
they would continue on with the job until they get a thirsty/hungry
thought, but immediately run off to eat if they lose the job (thus
refusing to load the engine after firing it). The code checks for
active sieges and whether there is a free replacement unit.
2014-04-15 21:52:39 +04:00
Alexander Gavrilov fc9826389b Account for meandering movement when predicting unit path in siege engine.
The movement is random, but there is an average slowdown coefficient.
2014-04-15 19:50:23 +04:00
Alexander Gavrilov 7844907204 Add new API functions for creating announcements and combat reports.
Allow specifying the announcement flags directly, and adding unit
combat reports. Also, make announcement functions write the message
to the game log.
2014-04-15 19:50:23 +04:00
Alexander Gavrilov b56c3a95a6 Fix some signed/unsigned mismatch warnings and whitespace in Job module. 2014-04-15 19:50:23 +04:00
Alexander Gavrilov 7aecffe0cd Update structures and fix broken things. 2014-04-04 22:34:39 +04:00
Quietust e620ae765c Add missing import/export info for MersenneRNG::unitvector<> 2014-03-25 13:30:21 -05:00
jj 387cc983f9 Merge branch 'osx_shenanigans' of git://github.com/tareqak/dfhack 2014-02-02 23:50:21 +01:00
Tareq A Khandaker f0eeba93ce DFHack compiles under OS X now. 2014-01-25 03:21:56 -05:00
jj ce33973f0f Merge branch 'master' of github.com/quietust/dfhack 2013-12-24 14:07:08 +01:00
Alexander Gavrilov 53bd112515 Hide fake historical figures from legends xml export. 2013-11-07 12:27:53 +04:00
jj 04dce1aa7f MaterialInfo: fix decoding for COAL subtypes 2013-11-05 00:31:32 +01:00
expwnent 329741f235 EventManager: added EQUIPMENT_CHANGE event and exposed it to lua. 2013-10-24 19:32:52 -04:00
expwnent 4dbcee9560 EventManager: be smarter about removing things while iterating. 2013-10-20 23:16:21 -04:00
expwnent c409289ee4 EventManager: TICK events should unregister correctly when requested and after they fire, other tweaks.
- fixed unregister to allow unregistering individual TICK events
 - make registerTick return the resulting freq you have to put back in to the handler in order for it to be unregisterable
- when TICK events fire, they now automatically remove themselves from handlers[TICK], as they should
- make sure manageTickEvent fires once per tick
2013-10-20 22:54:25 -04:00
expwnent 3594dc2eb8 EventManager: fixed the TICK event, and a few tweaks.
- redo tick event management to work with world->frame_counter
 - the freq of a TICK EventHandler is now ignored
 - unregistering for an individual TICK event is still broken
  - you would have to know the modified freq to even begin removing it
  - it is only removed from handleres[TICK], not from tickQueue
- redo unregisterAll to be more efficient
- use the map loaded/unloaded events instead of world loaded/unloaded for initializing/clearing event monitoring data
- get rid of silly unsigned variables
2013-10-20 21:48:28 -04:00
expwnent 9bf004d07f Several EventManager fixes and improvements.
- handle loading and unloading of saves better
  - made sure it never triggers bogus events on loading a save
    - plugins should now handle loading themselves with onStateChange
  - special case to make Buildings module keep track of all buildings correctly on load
- fixed syndrome detection
  - was broken because of the switch from ticks-since-the-dawn-of-time to world->frame_counter
  - added lastSyndromeTime global
- fixed possible off by one error when looking for new created items
- got rid of the unread lastTick global
- const'ed the function pointer array of eventManagers
2013-10-20 20:12:42 -04:00
expwnent f69fd1d528 EventManager: prevent eventspam just after loading a save. 2013-10-20 17:39:54 -04:00
expwnent d78a111f02 EventManager: Fixed the death event, fixed another problem with construction event, and made EventManager use world->frame_counter for scheduling event checking in order to make it work in arena mode. 2013-10-20 14:41:39 -04:00
expwnent 39553cfb6d EventManager: fixed a problem with constructionHandler. 2013-10-20 14:14:02 -04:00
expwnent ee056f4422 Merge remote-tracking branch 'angavrilov/master' into 0.34.11-r4
Conflicts:
	NEWS
2013-10-20 11:09:40 -04:00
expwnent 9d3ee11349 Merge branch 'diggingInvaders' into 0.34.11-r4
Conflicts:
	scripts/devel/invasion-now.lua
2013-10-19 21:26:50 -04:00
expwnent 57fc0f3e89 Merge remote-tracking branch 'angavrilov/master' into 0.34.11-r4
Conflicts:
	NEWS
	library/xml
	plugins/CMakeLists.txt
	plugins/autoSyndrome.cpp
2013-10-19 20:19:29 -04:00
Alexander Gavrilov 78de739d75 Update aquifers when generating 3D vein layout. 2013-10-11 19:23:32 +04:00
Alexander Gavrilov 63d8267606 Decode ice under constructions if possible, but never write it out. 2013-10-10 12:15:50 +04:00
Alexander Gavrilov f36041f6bd Implement a MapCache api for writing base layer tiles of arbitrary stone.
Precompute some tables in TileTypes for extremely efficient
conversion between tiles of most important material types.
2013-10-10 12:15:50 +04:00
Alexander Gavrilov 68b6e10b2c Implement writing veins tile by tile through MapCache.
Unlike changevein, which changes the material in an existing vein
object, with this feature you can set the material for individual
tiles, and the cache will write it out as vein objects.

The array inside the cache data is changed from layer material to
vein material, because layer material is easy to compute.
2013-10-08 18:17:36 +04:00
Alexander Gavrilov 9442e8ea1f Make biome information more explicit in MapCache. 2013-10-07 16:58:10 +04:00
Alexander Gavrilov ea36233dff Split MapCache code from Maps.cpp 2013-10-07 16:58:10 +04:00
Alexander Gavrilov e175efa689 Implement a template-based classical Perlin noise generator.
The mask argument of the Impl template is there because apparently
an inner template cannot be fully specialized, so there needs to be
some argument besides i.
2013-10-01 18:58:04 +04:00
Alexander Gavrilov 599af0a4d9 Fix linux and windows build issues.
- Linux makefile overrides and removes the optimization flags.
- Old linux gcc doesn't understand lambdas.
- MSVC doesn't like extern and explicit instantiation in same file.
2013-09-30 22:51:29 +04:00
Alexander Gavrilov 9e81d27cd1 Implement the same random generator as DF uses for DFHack. 2013-09-30 19:46:39 +04:00
Alexander Gavrilov df2e04db26 Update xml definitions. 2013-08-16 18:25:16 +04:00
expwnent ba73de5e35 EventManager: use units.all instead of units.active. 2013-06-20 21:34:32 -04:00
Alexander Gavrilov 49409d4630 Follow xml changes. 2013-06-11 16:10:42 +04:00
expwnent 57c42e3927 Maps.ensureTileBlock: fixed temperature issues, and properly added blocks to the world.map.map_blocks vector to prevent weird glitches. 2013-06-10 15:43:14 -04:00
expwnent 08114cf574 diggingInvaders: more fixes. Still a few issues with ramps probably. 2013-05-31 20:39:43 -04:00
expwnent f8261348ff Merge branch 'master' into diggingInvaders
Also make edgeCost.cpp compile because I stopped midsentence for some reason.

Conflicts:
	library/modules/Maps.cpp
2013-05-31 16:28:05 -04:00
expwnent 3403146461 Merge remote-tracking branch 'peterix/master'
Conflicts:
	plugins/CMakeLists.txt
	plugins/autoSyndrome.cpp
2013-05-25 20:08:56 -04:00
expwnent 638b2e974c EventManager: cleaned up manageEvents considerably, using a function pointer array. 2013-05-25 12:19:54 -04:00
expwnent bcaaa72387 EventManager should use a CoreSuspender just in case. 2013-05-25 11:50:43 -04:00
expwnent b44cd86dc9 EventManager: completely overhauled JOB_COMPLETED event detection, and tweaked Job::cloneJobStruct. 2013-05-25 09:44:17 -04:00
expwnent 29b5e20575 autoSyndrome should now work with syndromeTrigger. 2013-05-11 16:46:37 -04:00
jj e5fd918b0c job: unk2 -> subtype 2013-05-05 03:55:08 +02:00
Petr Mrázek 6a907e3584 Fix issue #195 - off by one error in building dimensions 2013-04-24 17:41:25 +02:00