Commit graph

3932 commits

Author SHA1 Message Date
Kevin Eady
ecd07dbe48
poc of templating background connect 2024-07-20 03:20:28 +02:00
Kevin Eady
68bad65741
move sqlitemod from runecl to pol 2024-07-19 23:21:14 +02:00
Kevin Eady
3bc28a1c12
github actions cache sqlitecpp 2024-07-19 11:48:09 +02:00
Kevin Eady
5d8850618c
maybe fix windows build? 2024-07-19 11:44:29 +02:00
Kevin Eady
8e66a6600f
add sqlitecpp test 2024-07-19 11:27:58 +02:00
Kevin Eady
a983c05a9d
add skeleton new module 2024-07-19 11:27:58 +02:00
Kevin Eady
55e9830a7b
add SQLiteCpp library 2024-07-19 11:27:58 +02:00
Kevin Eady
0b1bb4c2bf
Add source location to Print() messages sent to debugger (#664)
* Implementation

* Tests

* Update core-changes
2024-07-16 20:23:17 +02:00
Kevin Eady
271722af13
Send Print() messages to attached debugger (#663)
* Implementation

* Tests

* Update core-changes

* Implementation fixup
- do not copy message from executor
2024-07-16 12:41:55 +02:00
turleypol
774a9349f3
rewrite Decay system (#660)
* rewrite Decay system
removed setting to switch to multithread decay
Syshook:: call_long treats true/false as 1/0
can_decay hook if it returns 2 skip multicheck

* sleeptime is used outside of PolLock, guarded via atomic

* updated docs

* renamed syshook private methods
added corechanges
2024-07-14 17:34:17 +02:00
Kevin Eady
2589457275
Attack when character (defender) unhides (#661)
* Implementation

* tests

* core changes
2024-07-13 18:28:50 +02:00
turleypol
7c3498bb36
Realm::area and gridarea return now const ref instead of a copy (#659) 2024-07-13 09:15:38 +02:00
Kevin Eady
fa70dbd1d3
Attack when character unhides honoring swing timer (#658)
* implementation

* tests

* core changes

* add debugging for tests

* Revert "add debugging for tests"

This reverts commit 3b9f4a6d2b.

* adjust test scope
2024-07-11 18:14:18 +02:00
Kevin Eady
e80d5a8074
fix locals state after initforeach instruction (#657) 2024-07-10 20:01:59 +02:00
turleypol
f526ef17bd
Boat refactor Part 3 of N (#656)
* refactored boat move, fixed truncation of position when switching realm.
more simplifications
added more tests

* move_multi now accepts oldlocation like the other move functions

* added corechanges
2024-07-10 19:54:31 +02:00
turleypol
cd51ccebd0
simplified move functions further, added move_boat_item/move_boat_mobile (#655)
to get rid of duplicate code
2024-07-10 07:08:50 +02:00
turleypol
0d00a675d0
Boat refactor Part 1 of N (#654)
* test for traveller movement due to turn/move
check relative position of a component

* refactor BoatComponents, turn/move
2024-07-08 11:35:25 +02:00
turleypol
b216a16d36
refactored npcmod,decay to use Pos classes, removed all wrappers from Realm (#652)
* refactored npcmod,decay to use Pos classes
get rid of some realm methods used to wrap Pos

* all wrappers in Realm are now gone

* review comments
2024-07-07 15:32:29 +02:00
turleypol
a88d76acc3
refactor uomod to use pos classes (#651)
* refactor uomod to use pos classes

* fixed ambiguous call
2024-07-06 07:56:02 +02:00
Lukáš Novotný
f4b9be4314
Improve held weight computations (#650) 2024-06-17 09:56:40 +02:00
Kevin Eady
4e8b3bf6aa
Update efsw to 1.4.0 (#649)
* Update efsw to 1.4.0

* Use llvm 18.1.5 on windows

* set path for clang

* Use llvm 18.1.5 on windows

* Remove windows clang-cl build from CI

* trigger CI
2024-06-09 13:56:45 +02:00
Kevin Eady
d916f86408
Update container OnRemove, CanRemove program parameters (#647)
* Implementation
- Add `amount` to CanRemove script
- Add `split_from` to OnRemove script

* Tests

* Add docs and core-changes

* Fix tests... maybe?

* Restore testing for client events in container event tests
2024-05-16 22:49:51 +02:00
Kevin Eady
9ebf0a0572
Fix client issue with stacks not updated correctly in containers (#648) 2024-05-15 16:59:32 +02:00
Kevin Eady
c4f6e32e88
Add held_weight_multiplier for containers; Fix missing tooltip updates (for weight) (#646)
* Implementation

* wip testing

* allow setting held weight mod to long value

* more tests

* address github actions warnings
- unary minus operator applied to unsigned type, result still unsigned

* Add docs, core-changes

* fix GetItemDescriptor() for HeldWeightMultiplierMod; update tests

* update docs a bit more

* Remove mod suffix
2024-05-14 08:24:19 +02:00
turleypol
9d2bf0ec60
replaced all uppercase hex formatting with lowercase variant (#645) 2024-05-05 09:13:12 +02:00
turleypol
c864e37e6d
dont use abort() when fail to open a socket. (#643)
passert() before calling abort() waits now until the logger is done
2024-04-26 23:11:14 +02:00
Reloecc
0c51385614
Add servspecopt NpcMinimumMovementDelay (#642)
Co-authored-by: jan.cernin <jan.cernin@3it.cz>
2024-04-24 17:02:13 +02:00
Kevin Eady
09bb6d97f3
Add servspecopt BoatSailsCollide (#640)
* Implementation

* Add tests

* Update docs

* Rename test function

* Tweak boat cleanup if test fails

* Address review comments
- check objtype passable in boat unregself
2024-04-18 14:59:23 +02:00
Kevin Eady
b01a6a6ee6
Fix thread-safety on PolConfig (#639)
* Implementation, tests, core-changes

* More decay-based options to atomic
2024-04-14 18:50:15 +02:00
Kevin Eady
1a2668e36b
Trigger WalkOnScript for Boats; Add lastrealm to WalkOnScript (#638)
* Add boat walkon script

* Add tests

* Add lastrealm to walkon script

* Update walkon tests for last position check

* Update docs

* Add core-changes

* Add pre-test cleanup to corpse equipment tests
2024-03-24 14:39:11 +01:00
Kevin Eady
ac97667b3b
Corpse equipment changes; Fix support of MaxItems 0 for containers (#635)
* Implementation

* Add core-changes

* Fix warnings

* Fix support of MaxItems 0 for "unlimited" in containers

* add initial tests

* Update core-changes
2024-03-24 10:17:35 +01:00
Kevin Eady
814f864989
Fix map crash on edges in Tokuno; Introduce Realm Descriptor versioning (#634)
* Update solidx size, shift, cellmask to 8, 3, 7

* Introduce realm descriptor versioning

* Add core-changes

* Update breaking-changes.txt
2024-03-18 20:47:29 +01:00
Kevin Eady
35d16b8e5d
Add item.weight_multiplier_mod (#633)
* Add item.weight_multiplier_mod

* Add test for item.weight_multiplier_mod

* add core-changes and docs

* Address review comments
- Use `Clib::clamp_convert`
- Remove new `weight_of` function
2024-03-16 19:59:53 +01:00
Kevin Eady
62a252ad3a
Add daemon watch mode to ecompile (#630)
* Add libefsw at 3419347

* saving work

* some cleanup

* move to fs::paths

* saving work.. maybe hitting a limit with number of watched dirs?

* migrate to watching only ecompile.cfg specified folders, cleanup/doc

* Display summary between compilations in watch mode; fix cache reuse

* Fix inf loop; some cmake, format changes...

* some windows compilation fixes... tweaks to windows cmake?

* Update Efsw.cmake for build lib changes

* removed debug flag

* silence efsw build
dont add antlr project if it already exists

* Address review comments:
- use std::move on efswwatcher add_*

* add docs

* Add WatchModeByDefault ecompile.cfg option

* iniital work on tests

* Add CI actions

* some changes (passes locally on win, mac, linux)

* Fix fixtures dependency; use ecompile verbose mode

* Add core-changes

* Send ctrl+c instead of killing process

* Proper Python file naming

* Kill ecompile process on windows, SIGINT otherwise

---------

Co-authored-by: turleypol <turley@polserver.com>
2024-03-16 00:08:06 +01:00
Kevin Eady
9f07a2da9b
Set mmap_rnd_bits to 28 to fix sanitizer builds (#632) 2024-03-14 11:35:20 +01:00
turleypol
7849b6cda5
SQL non default port, escape string (#629)
* added sql tests (linux only)

* add mysql_escape_string module function
its now possible to define a port for sql connection. (0 means default
sql port like before)

* escape string can fail, return error in this case

* rebuild antlr

* added docs
2024-03-10 14:31:30 +01:00
turleypol
f3c3958384
Unknown realm in startloc crashes on char creation (#628)
* unknown realm defined in startlocations now stops starting the core

* core changes
2024-03-03 11:51:37 +01:00
turleypol
7627e3d353
"Preview/Initial"- Version sourcecode formatting feature (#626)
* Squash only prettify changes from escript_formating_try

* support of "format-off" / "format-on" comments to mark areas without
formatting

* fix typo

* added FormatterIdentLevel, FormatterMergeEmptyLines cfg entry
better line splits for dicts/arrays

* added several spacing options. the current setting list is now:
//LineWidth
FormatterLineWidth 80
// keep original keyword spelling
FormatterKeepKeywords 0
// number of spaces for ident
FormatterIdentLevel 2
// multiple newlines get merged to a single
FormatterMergeEmptyLines 1
// space between emtpy parenthesis eg foo() vs foo( )
FormatterEmptyParenthesisSpacing 0
// space between emtpy brackets eg struct{} vs struct{ }
FormatterEmptyBracketSpacing 0
// space after/before parenthesis in conditionals
// eg if ( true ) vs if (true)
FormatterConditionalParenthesisSpacing 1
// space after/before parenthesis
// eg foo( true ) vs foo(true)
FormatterParenthesisSpacing 1
// space after/before brackets
// eg array{ true } vs array{true}
FormatterBracketSpacing 1
// add space after delimiter comma or semi in for loops
// eg {1, 2, 3} vs {1,2,3}
FormatterDelimiterSpacing 1
// add space around assignment
// eg a := 1; vs a:=1;
FormatterAssignmentSpacing 1
// add space around comparison
// eg a == 1 vs a==1
FormatterComparisonSpacing 1
// add space around operations
// eg a + 1 vs a+1
FormatterOperatorSpacing 1
// use \r\n as newline instead of \n
FormatterWindowsLineEndings 0

* added tab support
// use tabs instead of spaces
FormatterUseTabs 0
// tab width
FormatterTabWidth 4

* extended example ecompile.cfg with formatter settings

* cleanup

* program args comma is optional...
fixed line comments in group splitting

* since tokenids are now correct no more guessing for linecomments needed

* comments use as start tokenid the whitespace token if its on the same
line

* splitted processing from linebuilding

* renamed TokenPart to FmtToken better matches the purpose.
Comments get directly stored as FmtToken
started with a context enum

* better(?) formatting for groups

* fix eof rawlines
added check that all comments/rawlines got parsed

* const correctness

* datatype adapted to antlr

* fixed warnings

* added InsertNewlineAtEOF

* add newline at the end if the original file had one
dont strip comment whitespace if its somejind of "header block"
use the defined lineending for /* */ comments

* docs

* \r\n is default on windows \n otherwise

* fixed warning

---------

Co-authored-by: Kevin Eady <8634912+KevinEady@users.noreply.github.com>
2024-02-26 21:21:44 +01:00
turleypol
a38d83b140
fixed ascii representation in logs for packets (#625) 2024-02-21 22:13:00 +01:00
Lukáš Novotný
d6bde75dec
Add proxy protocol support (#623)
* Add proxy protocol support

* style fix

* more style changes

* hopefully final style fixes

* Implement AllowProxy instead of UseProxyProtocol

* Style fix

* Fix initialization warning; remove unused header

* Fix boost warning (thanks @KevinEady)
2024-02-21 21:41:17 +01:00
turleypol
a0e5da7c3c
configure ecompile.cfg after all files are copied (#619) 2024-02-06 10:47:57 +01:00
Kevin Eady
2de1995c19
Fix compiler for escaping } correctly in interpolated strings (#620)
* Update grammar; add tests
String literals inside an interpolated string cannot start with `}`, as it must be a DOUBLE_RBRACE `}}`

* Fix interpolate string token reading

* Update core-changes
2024-02-06 10:44:26 +01:00
Kevin Eady
e03ec25b0c
Fix compiler crash on error{} members with no initializer (#618)
* Add crashing test for TDD

* Add fix

* Add core-changes
2024-02-04 15:38:37 +01:00
Kevin Eady
d4850d8049
Tweak parse tree to treat uninit and bools as literals (#616) 2024-02-01 15:21:52 +07:00
turleypol
e7fdfdf795
CMake target cleanup, removed configure options (#614)
* every 3rd party lib is now excluded from "all" build, meaning it gets
only build when actually used.
removed the cmake option to partially build, due to the above changes
this is no more needed, just build the target
streamlined 3rdparty target names, they all start with lib now

* renamed escriptgrammar target to escriptgrammar_codegen for
clarification
fixed dependency name

* corrected sources name

* readded missing include
2024-02-01 08:07:37 +01:00
che666
4cd9137365
Make polserver build on linux distributions that put their 64bit libs into a lib64 subdirectory. (#615)
* Update Fmt.cmake to build properly on linux distributions that place 64bit libraries into lib64 subdirectory instead of lib.

* Update Fmt.cmake - only include GNUInstallDirs when using linux
2024-01-31 18:38:08 +01:00
turleypol
f8f2510c1a
polserver can now be imported as subdirectory (#613)
antlr/fmt build on linux with fPIC
clib publishes global config include dir and pol-core
2024-01-29 18:30:34 +01:00
Kevin Eady
686090d950
Introduce DAP Debugger (#608)
* Add cppdap debugger library and simple server (#508)

* Add cppdap library

* Add cppdap server

* fixup cmake scripts for windows

* Enable caching of cppdap on GitHub actions

* Fix CMake for cppdap target

* Wait 1s for session close before thread ends

* Address review comments
- Remove unnecessary use of wait_for
- Fix wait_for method

* Do not use SocketClientThread for cppdap clients

* Address review comments
- Cleanup object ownership

* Add authorization and event handling (#510)

* Add authorization and event handling [WIP]

* Use std::weak_ptr; Only allow one debugger conn

* Only attach debugger if dbg file exists

* Cleanup weak_ptr; Fix listeners; Add handler stubs

* Address review comments
- PolLock on uoexec and weakptr access
- Use make_shared when creating client thread

* Add ExecutorDebugListener on_destroy callback

* Use cppdap sockets instead of clib sockets

* Update cppdap repository to 2703cf4

* Implement server address binding

* Update cppdap repository to eeca5ce

* Fix warnings

* Use weak_from_this

* Fix stalled executors on disconnect

* Fix stalled executors on re-attach

* Clear uoexec weakptr on all debugger detaches

* Move server to gamestate

* move DapDebugServer into Network namespace

* move DapDebugServer into GameState for storage

* Move DapDebugServer into NetworkManager

* Fix missing memory include

* Add more events (#513)

* Add more events

* Implement dbg_step_out

* Fix breakpoint clearing

* Add even more events (#515)

* add launch request

* Add custom `processes` command

* fixup loop

* Refactoring to move handlers to member functions

* Add VariablesRequest and ScopesRequest

* use std::varaint for Handles

* add pollocks

* refactor Handles to new file

* move custom messages to proto.h

* move clientthread

* some formatting / cleanup

* Add missing PolLock

* move dap variables creation to Handles

* appobj members

* rename ClientThread to DebugClientThread

* rename LaunchRequest args to arg

* Fix compiler error on size_t

* Add support for EvaluateRequest and SetVariableRequest (#519)

* Update grammar for evaluateUnit

* Cleanup various compiler code

* Add support for EvaluateRequest
Only supports values, variables, element access, member access

* Add report clearing to reinitialize state

* Add support for SetVariableRequest

* Fix CI build errors

* Move ExpressionEvaluator to Bscript

* Fix formatting

* Fix include

* Refactor global and frame variable references

* Encapsulate Executor debugging environment; Fix step over (#524)

* Fix step over

* Some cleanup of executor
- Remove unused debug states
- Rename members for consistency

* move debugging environment to new class

* Move instruction inspection to class

* Cleanup slashes on Windows; Add Executor state to processes response (#527)

* Fix backspaces in script names on Windows

* Fix compilation warnings with data loss

* Use boost::icontains for string comparison

* Add Executor state to processes response

* Updates for libfmt

* Fix tests; Fix cppdap build for Mac universal binary (#607)

* fix tests

* fix cppdap build for mac universal binary

* Update cppdap to 2a4c7cf

* Add tests; Modify launch behavior to not stop at entry (redo) (#609)

* Remove unused setExceptionBreakpoints handler

* Add debugger tests

* Launching a script should not set attaching state

* Add launch tests

* Do not check for connection in debugger tests

* Rename `program` to `script` in protocol structs

* Fix launch stopAtEntry; quote string var values

* Fix compilation error on Windows

* Add configfiles doc entry

* Various fixes for finishing touches; Add core-changes (#610)

* switch cmake projects

* simple docs

* cmake move make_directory

* Fix launch request with relative, absolute, package paths

* make relative paths as absolute in source request

* Add true, false, uninit to ExpressionEvaluator

* Re-add setExceptionBreakpoints to avoid unhandled message errors

* Better debug thread logging with instance numbers

* launched scripts should terminate on disconnect (according to DAP spec)

* Properly handle exited event in client thread

* Add core-changes

* Address Discord comments
- Mention vscode-escript in core-changes
- Re-add "cppdap already built" in cmake

* change cmake escriptgrammarlib visibility to public
2024-01-28 09:49:55 +01:00
turleypol
271a1105ba
added explicit targets for every 3rd party lib (#612)
* added explicit targets for every 3rd party lib
these contain include dirs/libs/compiler defs

* moved each 3rd party lib into a version folder, to give each target a
dedicated include directory.
Now noone should add lib root folder as include dir
Used private linking where possible
disabled building of boost, wasnt used at all

* regnerate boost cache
adapted targets for coverity
2024-01-27 09:06:23 +01:00
turleypol
08bd3c7ce5
Savefile rewrite (#601)
* rewrite of saving, replaced operator way with a generic add method, thus
not everywhere the formating of the savefiles is hardcoded.
since its the last spot which uses the old formating lib, remobed the
lib

* removed cmake of old format lib

* testscripts for load/save of UObject,Item,Armor,Weapon

* fixed: member faster_cast_recovery and faster_cast_recovery_mod getter returned
a wrong value

* wrong/missing docs

* test containers, lockable, map, spellbooks
fixed save bug in map and spellbook
removed ancient savestrategy experiments

* added corpse test
splitted testfiles

* fixed loading (ancient bug) and saving (PR bug) of Reportables
added tests for houses, boats, accounts and chars

* fixed include

* fix shutdown leak

* added npc tests
upload complete coretest folder also on failure

* do not write and load RegisteredHouse for NPCs two times
readded extra newline between accounts

* tests for guild, party, realm
added resource cfgs, but a test is not really possible since nothing of
interest is stored

* added datafile, storage test

* activated resource loading, 25year old bug, but since the stored values
are senseless it makes no real difference.
added a few wtf comments
catch all exceptions during formatting of log lines

* replaced .write with explixit .begin, .end and .comment.
for leftovers.txt the StreamSaver was also used, since the format is
different use directly ofstream

* added corechanges
2024-01-24 18:49:06 +01:00