Commit Graph

184 Commits

Author SHA1 Message Date
Konrad Kuśnierz 7ea6c46b2c Add binary operations for lua
This is something I was always missing - posibbility to operate on
binary files or streams in pure lua. In most cases we do only need to
read simple variables from files such as integers with different amount
of bytes. This "class" will provide that ability.

It's a simple implementation of following C module for lua:
http://www.inf.puc-rio.br/~roberto/struct/

It has much less, though. Following elements have been implemented:

">" flag to set mode to big endian.
"<" flag to set mode to little endian.
"b" a signed char.
"B" an unsigned char.
"h" a signed short (2 bytes).
"H" an unsigned short (2 bytes).
"i" a signed int (4 bytes).
"I" an unsigned int (4 bytes).
"l" a signed long (8 bytes).
"L" an unsigned long (8 bytes).
"s" a zero-terminated string.

An example how to use it:

```lua
local packed = Struct.pack('<LIhBsb', 123456789123456789, 123456789,
-3200, 255, 'Test message', -1)
-- packed is now a lua string we can save to file as binary data
local L, I, h, B, s, b = Struct.unpack('<LIhBsb', packed)
print(L, I, h, B, s, b)
```

You can use g_resources.readFileContents as function to read binary
files and parse them via this class.
2015-05-18 21:38:05 +02:00
TheSumm 8e5bbcd3a1 Add tab-spacing tag to MoveableTabBars 2015-04-20 03:32:32 +02:00
TheSumm 84f6cdec86 Fix #576, PopupMenus close when leaving the game 2015-04-19 13:56:03 +02:00
TheSumm 6961492e00 Fix console tabs not blinking, closes #627 2015-01-30 19:56:56 +01:00
TheSumm 1c3cfddab0 Removed tr() from UIHeader 2015-01-28 00:01:53 +01:00
TheSumm 64e9406488 Fixed 'widget destroyed but still have 1 reference left' related to console module 2015-01-27 21:14:38 +01:00
TheSumm cb7cea6809 Tiny signalcall fix 2015-01-25 21:20:48 +01:00
TheSumm da2762dac3 Market now highlights offers which differ from the average price 2015-01-25 13:41:00 +01:00
TheSumm eb3c244023 More Market fixes
* Fixed NextButton and PreviousButton style
* Little update to SpinBox including dontSignal
* Market cleanup and more check to be safe
* Limit Market amountWindow by player balance
* Set proper maximum amount when creating offers
* Fixed fee label not calculating the correct fee sometimes
2015-01-25 02:28:53 +01:00
TheSumm 607dab01d6 Added Market column sorting (fixes #429), updated UITable and fixed not working methods 2015-01-21 23:40:15 +01:00
TheSumm b5cea41f87 Market fixes
- Market now works after reloading
- Fixed button / tab styles
- MarketRightTabBarButton now inherits the base style
- Fixed amountWindow buttons being hardly clickable
- "All" search filter is now on by default
2015-01-20 14:34:45 +01:00
Konrad Kusnierz c49a6f3bf2 Fix for #596 2014-11-19 07:25:36 +01:00
Shawak 939e16c59a string:contains() 2014-07-31 20:25:31 +02:00
BenDol a52c938fef Added missing protocol versions & made some style fixes. 2014-07-30 19:58:34 +12:00
BenDol 0b5654f870 Style fixes and added dontSignal to UIRadioGroup. 2014-07-13 07:38:44 +12:00
BenDol f7531383f3 Fix an issue with the spinbox buttons. 2014-07-13 03:57:38 +12:00
BenDol 7724b8059d Forgot this from previous commit. 2014-07-13 02:10:30 +12:00
BenDol 2ada93db9c Should use the set minimum for these! 2014-07-13 02:08:33 +12:00
BenDol d070711409 When reaching max or min scroll allow other scroll areas to scroll. 2014-07-13 02:06:36 +12:00
BenDol 5909634837 Avoid ending mouse scroll chain when scroll bar is 'off'.
Also added mouse-scroll style to UISpinBox.
2014-07-13 01:46:47 +12:00
BenDol 12b3bd4ee0 Fix table.equals 2014-07-09 17:00:10 +12:00
BenDol 9e30c39035 Pointless storing a reference to super. 2014-07-09 05:51:17 +12:00
BenDol 3dbcb1daee Added basic table.equals, dontSignal param to combobox calls & spell methods. 2014-07-09 04:07:02 +12:00
Sam a9d4fd5e1e Scrollmenu for Comboboxes, fixes #480 2014-07-03 18:15:38 +02:00
BenDol ce9e443c60 Remove redundant classes & added some Position methods. 2014-06-10 01:44:03 +12:00
BenDol c083d02bef Some fixes for class names and queue (added base class). 2014-06-07 04:10:14 +12:00
BenDol 00253e46b3 Added Queue class for event queuing (see CandyBot for examples of this). 2014-06-04 02:17:49 +12:00
BenDol 2df51622ba Some improvements to some things. 2014-06-02 10:04:56 +12:00
BenDol 1baad726ae Just use g_configs.unload(config) to unload config files.
Avoids concurrent modification errors.
2014-04-06 15:29:02 +12:00
BenDol 3ce37dacbd Removed onUnload from corelib and added more lua bindings for resources. 2014-04-02 05:20:18 +13:00
BenDol 5204e3ac03 Proper termination and initialization of the ConfigManager. 2014-04-02 00:30:17 +13:00
BenDol 4b24c78f0f Fix to the makesingleton function. 2014-04-01 17:22:00 +13:00
BenDol 994f49b3c1 Better implementation for forming the singleton wrapper. 2014-04-01 17:08:07 +13:00
BenDol 79ee0e34ea Keep g_settings as a 'static' variable rather than a direct object. 2014-04-01 16:51:38 +13:00
BenDol b295053662 Finished stable implementation (as far as tested), still requires more testing. 2014-04-01 16:27:33 +13:00
BenDol 61059e66ec Started implementing ability to load custom config files (currently unstable).
Feel free to help out with this if you like :)
2014-04-01 05:43:31 +13:00
Jacek Wielemborek e6c9e78935 Get rid of trailing whitespace.
Commit generated by command:

find -type f ! -path '*.git*' ! -path '*.png' ! -path '*.ico' ! -path \
    '*.ogg' | xargs -I '{}' sed -i '{}' -e 's/\t*$//g' -e 's/ *$//g'
2014-01-18 15:09:26 +01:00
Kamil Chojnowski b718ae0423 Update tabs navigation to take offscreen tabs into account 2014-01-15 04:56:42 +01:00
Kamil Chojnowski 291960d159 Make tab navigation more intuitive 2014-01-15 02:32:02 +01:00
Sam f615b80fbc Navigation for large tab amounts, closes #211 2013-12-03 20:25:56 +01:00
Joao Pasqualini Costa 719debfeae Fix keyboard unbind
Now this will unbind the right widget
2013-08-17 21:54:16 -03:00
BeniS 5fbb71157d Added enable/disable chat mode (allows for alphabetical key controls), battle window anchoring fixed (thank you River) & more:
* Added better walk key binding (for other uses, like the sample given WASD).
* Made string.ends part of the string meta table rather than parameter based.
2013-07-29 10:42:18 +12:00
Eduardo Bart b43a196eac Minor fixes and add auto resize for images 2013-03-15 21:59:22 -03:00
Eduardo Bart 62921dee9b Fixes in options, hotkeys and viplist 2013-03-02 17:01:52 -03:00
Eduardo Bart dad3026ba0 Optimize terminal buffering 2013-02-28 21:35:35 -03:00
Eduardo Bart b804dd6959 Fixes and new tuned terminal 2013-02-28 18:46:42 -03:00
Eduardo Bart e528fcc8f8 Minor fixes and improvements 2013-02-28 02:43:26 -03:00
Henrique Santiago 46aa0c005f Support to miniwindow margin, fix protocollogin connectCallback, pt translation 2013-02-27 23:45:03 -03:00
BeniS 8e9f65779c Implemented client_serverlist module! Close #200
* Will store servers that are not already in the list when logging in
* Can add servers manually if required too
* Fixed a bug in table.size
2013-02-24 00:41:21 +13:00
Eduardo Bart 9a54bfcc90 Minimap, hotkeys and lot of other changes
* Begin working on a new layout system for UIMinimap and later UIMap,
this new layout system allows to add widgets to the minimap
* Add option to disable motd
* Rework hotkey binding
* Lots of fixes in hotkeys manager
* Add fullmap view using Ctrl+Shift+M
* Prevent some crashs in ThingType draw
* Add function to load minimap from PNG files
* Fixes in minimap saving
* Fixes in Tile::isClickable
* Add UIMapAnchorLayout, new layout for maps
* Fix freezes in win32 when pressing alt key
2013-02-21 17:03:05 -03:00