Commit Graph

134 Commits

Author SHA1 Message Date
mniip
f8586ea3a2 Remove ByteString::Stream 2018-05-04 23:10:39 +03:00
mniip
5ff8cefca4 Replace String::Stream parsing with number splitting 2018-05-03 04:11:43 +03:00
mniip
d1610c5127 Add string partitioning methods 2018-05-02 23:42:34 +03:00
mniip
6c9cb174fb Change some uses of String::Stream to StringBuilder 2018-05-02 22:11:41 +03:00
mniip
a121c62c3b Add some helper methods and rewrite some of the string manipulation code 2018-05-02 01:32:04 +03:00
mniip
ff27d69424 Switch from std::string to String/ByteString in most of the code
Also switch SimulationData from weird arrays to std::vector
2018-04-30 21:13:24 +03:00
jacob1
fbe81baca3 make Platform::ExecutableName return std::string (fixes minor memory leak)
update code is untested
2018-04-21 19:28:47 -04:00
wolfy1339
27f6a6b297 Strip whitespace from files in repo (#553) 2018-04-03 21:46:01 -04:00
jacob1
67bc12de97 Fix issue where TPT was bought by EA 2018-04-01 15:26:13 -04:00
jacob1
40d2850ff7 TPT has now gone free to play! Many elements are unlocked by default, but by using Powdercoins you can unlock new elements and promote your saves to front page! 2018-03-31 22:40:23 -04:00
jacob1
a0a7281cc7 add TOOL_CYCL lua constant, change ID to 7 2018-02-14 22:19:31 -05:00
jacob1
07988147b9 prevent compiling if pmap doesn't have enough space, make lua elements favor 1 byte IDs 2018-01-01 00:31:44 -05:00
jacob1
0c8c4de125 convert all of the rest of the things except GameSave.cpp and pipe/ray elements
also add sim.PMAPBITS and sim.PMAPMASK constants
2017-12-29 21:01:28 -05:00
jacob1
ac24810da5 add some defines to reduce usages of hardcoded r>>8 2017-12-28 12:03:26 -05:00
jacob1
63c13bda89 fix use of deprecated luaL_getn function 2017-11-23 22:34:22 -05:00
LBPHacker
be29fad7e8 Add support for window scale modes other than 1 and 2
Window scale can now be anything between 1 and 10 (suggest something other than 10 for maximum scale?). This required a number of subtle changes:

 * made blit2 (PowderToySDL.cpp) handle scale modes correctly (it really only handled scale:2 correctly before)
 * replaced `bool scale` with `int scale` everywhere in the options view/model/controller
 * replaced the _large screen_ checkbox with a _window scale_ textbox in the options view

The new scale is only checked and applied when the options view is closed. There's no reason to not apply it live, I just chose not to.

This commit does *not* make TPT able to figure out an optimal scale mode at first run. It still suggests using scale:2 if it makes sense though.

I had doubts about using a second loop in blit2 but it doesn't seem to be an issue. If there's a more optimal way of going about what blit2 does, I haven't figured it out.

(Sublime seems to have eaten a few trailing spaces, hence there are a few seemingly identical pairs of lines in the diff.)
2017-11-23 12:24:34 -05:00
jacob1
1b19e042b2 fix crash when using tpt.start_getPartIndex 2017-11-04 13:22:22 -04:00
jacob1
6bd068713e recording improvements
remove 'r' record shortcut
add tpt.record function. Still gives the user a confirm prompt
recordings now go into recordings/<timestamp>/, where timestamp is the time the recording was started. <timestamp> is returned by the tpt.record function. Each new recording starts the filenames over at 0 again.

you probably still need a lua script to use the recording feature, this should make it easier for those
2017-09-04 14:06:28 -04:00
QuanTech0
07e879e74c fix buffer overflow in opt_meth_setoption (#496) 2017-09-03 19:48:28 -04:00
jacob1
c34b54d974 add sim.takeSnapshot lua function 2017-08-31 23:48:00 -04:00
jacob1
1ceae1ba43 fix interface api in lua5.2 2017-08-20 18:13:46 -04:00
jacob1
6931f35520 hold shift when saving or loading stamps to not save / load pressure, closes #491 2017-08-03 00:13:06 -04:00
jacob1
adb39b91a9 attempt to reduce "script is not responding" when debugging (valgrind / breakpoints) 2017-07-28 20:32:46 -04:00
jacob1
8064d3b467 remove useless debug print in !set 2017-07-25 20:11:57 -04:00
jacob1
ad5a2a0972 tpt.parts: only prevent writing to dead particles, not reading 2017-07-16 11:43:50 -04:00
jacob1
b8ce522779 sim.signs.delete() api function 2017-07-16 10:42:53 -04:00
jacob1
6d141b0722 add new PhotonReflectWavelengths property, add reflection color for POLO 2017-07-16 00:07:32 -04:00
jacob1
5ee10d14e4 reduce unnecessary #include dependency chains
for example, elements no longer include Client.h or Graphics.h, and interface stuff won't include Window.h or Graphics.h unless requested
2017-07-13 23:24:35 -04:00
jacob1
f3a7d966d2 potential fix in sim.partCreate, also 2017-07-13 20:55:03 -04:00
LBPHacker
7dd538b82c Fix tpt.parts being unsafe
`tpt.parts` does check whether the particle ID it gets is valid, but it doesn't check whether that particle ID is used. One could potentially modify the life property of dead particles to break the linked list of free particle IDs, thus potentially gaining the ability to read from or write to arbitrary addresses in memory.
2017-07-13 20:33:46 -04:00
jacob1
8e5b0c760e Add logging inside saves which remembers which other saves material was taken from
The logging is saved inside the bson data in all online saves, local saves, stamps, and clipboard pieces. It is loaded back when reloading each of those.

See #474 for the format of the data. It is the same format for the bson data. Note that "links" is an array of objects. It can be recursive.

There is some effort to not duplicate information, we don't care if you loaded a stamp 10 times or if you are using the clipboard in your own save. Extra information is mostly not saved for your own stuff, only when you take material from other saves.

Press ctrl+a in debug builds to show what info it is currently saving in Client. Also enabled in snapshots for now.

There is one unrelated change in here, which fixes a crash pointed out by QuanTech. It was also save related and it was too close to the other changes to separate it into another commit. It fixes a crash when saving signs with invalid unicode. the BSON library doesn't like this, it was returning an error but we ignored it, which caused a crash. It now notices those errors. I also had to update several Serialize calls to check if it actually returned save data, or else it then would have started crashing there instead.
Also some debug prints were removed
2017-07-13 00:19:35 -04:00
jacob1
ec417095b9 add sim.TOOL_MIX, fixes #414 2017-05-09 21:59:15 -04:00
jacob1
ce054bfc3f fix misc. errors reported by clang static analyzer 2017-05-06 20:02:23 -04:00
jacob1
cdc8f64896 fix clang compile warnings, fixes #406
also, sim.ambientAirTemp takes floats now
2017-04-27 23:08:06 -04:00
jacob1
866289c179 remove duplicate function, fix Simulation::GetParticleType, fixes #402 2017-04-21 20:24:24 -04:00
jacob1
e712a8dbec make last 3 arguments to sim.brush optional, for convenience 2017-04-17 23:28:12 -04:00
LBPHacker
e9d80fe52a sizeof(unsigned char) 2017-04-17 23:28:12 -04:00
LBPHacker
5cf3fa3f5b More parameters for sim.brush 2017-04-17 23:28:12 -04:00
Issue tracking bot
d9115fc3fe Fix -Werror=misleading-indentation (#369) 2017-02-20 18:51:10 -05:00
jacob1
51eeaf218d fix crash when doing Textbox.new() 2017-02-13 17:43:48 -05:00
Tamás Bálint Misius
57f5d0f84f Add sim.brush (#350) 2016-11-07 18:00:34 -05:00
jacob1
797f9357ff fix float detection in console, fixes stuff like !set type all 0.8C 2016-09-10 12:46:15 -04:00
jacob1
ecb08952e5 Add SDL_keysym.h, Use official SDL constants 2016-07-19 22:42:10 -04:00
wolfy1339
b65e94900e Use C++ includes (#308)
Replaces stdio.h, stdlib.h, string.h, math.h, time.h, limits.h and othters with their C++ equivalents.
2016-07-17 23:37:24 -04:00
jacob1
eafd8115b0 add onlyEnabled option to tpt.num_menus (probably useless) 2016-07-17 23:36:36 -04:00
jacob1
8a0496e60a another fix for lua key events 2016-07-17 18:19:00 -04:00
jacob1
16b93083d4 Changes to support starcatcher build server with updates
Cherry-picked from 3ddaec7b2a
3ddaec7b2a
3ddaec7b2a
3ddaec7b2a
3ddaec7b2a
3ddaec7b2a
2016-07-09 19:00:54 -04:00
jacob1
b75c8318e4 add tpt.num_menus and tpt.menu_enabled functions 2016-07-08 20:33:01 -04:00
jacob1
9a18338476 remove debugging thing 2016-06-11 23:50:46 -04:00
jacob1
2a541bd2f5 fix for lua keydown events, send 'j' when ctrl+somekey is pressed, not ^J 2016-06-11 15:54:19 -04:00