Commit graph

552 commits

Author SHA1 Message Date
Fernando Rozenblit
721e4fefe0
Refactor Item states to be explicit instead of implicit (#919)
* extend tests

* more tests for world save

* explicit handle the special layers in wornitem

* add Location variant and relocate() methods

* refactor GottenItem and ensure Chr, not wornitems, is saved

* deflake escript watch test

* dropitem and undo refactoring

* uomod changes

* add more item tests (buy, sell, hair...)

* use location for undoing trade container properly

* rewrite loaddata to use relocate, fixing startup crashes

* do remaining location changes

* fix CI tests

* remove container pointer from item and add wearer() reference

* remove layer writes and explicit intrinsic weapon handling

* add preparing state for fresh items without serial number

* move wornitems to detached state only when it has a serial number

* load corpse items into the correct layer

* do not set a layer on load before the item is equipped

* add more tests to equipped and intrinsic items

* remove layer and substitute with the location()

* add core-changes summary

* mark items as being worn on corpse if they only moved within the corpse

* block Preparing from being reached, just to be sure

* added integrity sweep check

* Reduce direect changes to item location

* Add Item::move_into() and rewrite calling sites

* Fix container slots

* get rid of the slot_index on the item, because Location() already has it

* fix race in test leading to macos issues

* fix dangling pointer

* remove corpse can_equip_list and rely on the GottenItem rules to dress the corpse again

* let item->destroy() detach the item

* make integrity checks fail the tests

* use place_at(item, newpos) for changing item position InWorld

* add boat test for item moved out of boat that should not be visible anymore

* use place_at() in more places

* ensure CreateItemAtLocation really does

* fix Claude instructions

* remove state we didn't need

* fine tuning

* reduce test flakiness
2026-08-10 18:17:53 +00:00
Kevin Eady
c5f4b88e3e
Allow large custom housing by sending floor as multiple planes (#778)
* wip migrate to vector-based CustomHouseDesign::Compress

* make CustomHouseDesign::Compress multi-plane

* fix nopch compilation

* use thread_local std::array for uncompressed buffer

* docs
2026-08-10 08:09:58 +02:00
turleypol
1aaba509c8
Repsys tests (#926)
* initial repsys tests

* prevent division by zero, dont build statmsg when char is offline and cleanup

* fixed race in auxconnection transmity the order wasnt guaranteed

* fixed datastore loading
2026-08-08 11:43:01 +02:00
turleypol
ea1cf0c6f3
map tests (#925) 2026-08-06 06:42:53 +02:00
turleypol
1f68d36171
spell tests added (#924)
* spell tests

* try to force the badge of coveralls to reload
2026-08-05 22:14:01 +02:00
turleypol
890a7251a6
Customhouse tests (#923)
* client adaptions

* added stair multi

* commithook

* extend offline tests

* fixed flanky list_equipment like list_objs
extended client communication
activated hook

* restarttest

* helper

* closehook

* client tests

* secured version by mutex

* missing mutable

* fixed movement logic, was flanky before

* fixed bug #1

* client check and correct order of error checks (#5,#8)

* remaining bugs, left except 10 and 11

* docs

* tests

* fixed wording
2026-08-04 20:53:57 +00:00
turleypol
2f18e7497c
Packet/Packethook tests (#922)
* fixed out-of-bounds reads/writes

* tests

* adapted docs

* fixed watch test (timeout was to low to compile all scripts)
2026-08-03 08:22:06 +02:00
turleypol
50130a3d6b
Xmlfile and file tests (#921)
* xml and binaryfile tests
fixed small bugs

* fixed platform specifics

* fixed use-after-free when the document went out of scope.The document is
now shared accross all objects
2026-08-02 19:55:50 +02:00
turleypol
248c71553c
added tests for trade and speech (#918)
fixed crash in trade and missing param in speech
2026-07-31 20:04:23 +02:00
turleypol
e6abc8fcfe
Attackable item (#884)
* introduced Attackable wrapper class for opponents to be able to also
attack items

* changed set_opponent to use Attackable
moved first logic into Attackable

* added dynamic property which returns a pointer of the object instead of
a copy like the current imp.
needed to be able to eg store a vector

* send engage/disengage events
send hp status bar

* send attackable item flag in world item pkt

* apply damage for items + evid_damaged

* react to statrequests

* adapted is_attackable and do attack_effects

* fixed clear_opponent_of

* fixed clear_opponent_of

* allow attack pkt

* apply damage

* items need to keep track of the opponents to be able to cleanup on
destroy

* updated dynproperties

* updated dynprops a bit more.
made the structs trivial copyable
updated concept to not repeat the types

* run hitscript, cleanup

* listhostiles and attack_once accept now Attackable

* set opponent when dblclicked

* dont let hp underflow

* only attack if you are in warmode

* evid_opponent_moved for attackable items

* if its the same opponent dont send engaged events again
added test for listhostiles with two mobs

* allow attackable item for setopponent

* some tests npc vs item

* missing files

* fixed clang tidy complain

* test for enter/left area

* do not send hp updates while char gets created and not yet added to the
  world

* testclient fight packets

* client event constants

* added client tests for attacking npc and item

* increase damage

* removed leftover comment

* when an attackable item was destroyed the opponents where not correctly cleared

* orphan check for is_attackable

* moved statmsg for items

* init member

* moved send_hightlight back into if statement
check before dereferencing

* use range version of statmsg

* adapted em params

* comparison operator
made explicit constructors
for symmetry return damage in Item::apply_damage

* get rid of bools

* split attack method a bit

* use constants for F3 flag

* destroy item on hit if hp reaches 0 if no controlscript exists

* only toplevel items are attackable
small refactoring
more tests

* more tests

* even more tests

* docs
2026-07-30 20:27:36 +02:00
Fernando Rozenblit
883a2ee90c
Refactor network code and improve hostname resolving (#916)
* simplify winsock init

* improve hostname resolving

* refactor ip checks into an IpMatch class

* remove default constructor and do formatting

* tighten corechanges text
2026-07-30 17:33:40 +02:00
murderinc
4139651bba
Only insert title separators for title parts that are set (#914)
The AOS tooltip applied the ServSpecOpt title separators to parts a mobile does
not have, and skipped the race and guild separators in the combinations that
needed them. With the default single space this was invisible, but it made the
options unusable: TitleSuffixSeparator=", " gave every suffix-less mobile a
dangling "Name, ". The paperdoll was already correct, so both renderers now
build the title through Character::displayed_title( bool with_guild ).

The tooltip pads any cliloc 1050045 argument that would be empty with a space,
since clients drop a zero-length argument and shift the rest; output with the
default separators is therefore unchanged. The new shard test covers all 16
combinations of set title parts against both renderers under three separator
configurations.

Co-authored-by: murderinc <3738856+murderinc@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-28 21:42:45 +02:00
Fernando Rozenblit
76c9c025b3
Improve single threaded login (#913)
* avoid looping over all clients for each accept

* improve singlethreaded login polling performance

* convert delays to chrono literals
2026-07-28 09:18:22 +02:00
Fernando Rozenblit
08338e5a21
Add new stalled peer timeout config and refactor (#912)
* Use std::chrono for socket timeouts

* fix POL threads being stuck at the end

* add pol.cfg setting for stalled peer timeout
2026-07-27 23:21:44 +02:00
Fernando Rozenblit
cd822e7cc2
Nonblocking send for aux and web (#911)
* make aux nonblocking

* fix webserver stall if client stops reading

* add StallBudget and make web sockets also non-blocking

* set small buffer size before accepting

* increase payload to force send waits
2026-07-27 19:19:51 +02:00
turleypol
12b7fe03ea
Customhouse fixed negative offset for add/erase (#909)
* fixed offset int types

* use also negative offsets

* docs
2026-07-25 23:00:47 +02:00
murderinc
d083bed430
Add configurable title separators (ServSpecOpt) (#907)
* Add configurable title separators (ServSpecOpt)

The core assembles a mobile's displayed title (paperdoll + AOS tooltip) as
title_prefix + " " + name + " " + title_suffix, with a " " before "(race)"
and "[guild]". Those separating spaces were hardcoded, so a shard whose
title_prefix/title_suffix already carry their own separator (a trailing
space, or a leading ", ") ends up with a doubled space or a " ,".

Add four ServSpecOpt string options - TitlePrefixSeparator,
TitleSuffixSeparator, TitleRaceSeparator, TitleGuildSeparator - each
defaulting to a single space, so existing output is byte-for-byte
unchanged. Setting one empty lets the title strings supply their own
separator (e.g. a suffix of ", Guildmaster" rendered directly against
the name).

Docs (configfiles.xml) and corechanges.xml updated.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Title separators: source changelog + bare-distro template

Follow-up to the ServSpecOpt title-separator change:
- move the changelog entry to its source pol-core/doc/core-changes.txt and
  regenerate docs/.../corechanges.xml via doctools/buildcorechanges.py
  (the .xml is generated, not hand-authored)
- document the four options in the bare-distro servspecopt.cfg template
  (poltool/baredistrofiles.cpp)
- bump configfiles.xml datemodified

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: murderinc <3738856+murderinc@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-25 13:22:00 +02:00
turleypol
eeebc0f060
Customhouse: addhousepart/erasehousepart mass version (#901)
* mass customhouse add/erase + tests

* fixed argument check

* docs
2026-07-24 13:34:55 +00:00
Fernando Rozenblit
239652925a
Fix uoconvert bug with UOPs and refactor code (#902)
* isolate uofile globals into a singleton

* refactor singleton into object instance in uoconvert

* get rid of lazy loading and singleton, move singleton to uotool

* move files

* fix includes

* delete dead code

* relocate singleton

* move functions into uotool

* move uotool only static functions

* get rid of uofilei.h

* get rid of uofile.h

* extract tiledatacache class

* extract staticscache class and file handle UniqueFile

* clean map reading

* fix uoconvert errors with map2

* fix line length

* C style to std::array

* light modernization
2026-07-23 22:39:39 +02:00
turleypol
56ebd666e6
Fix ShortCircuit jump optimization corrupting assignments (#904)
* Fix ShortCircuit jump optimization corrupting assignments

The short-circuit jump optimizer threaded a logical jump past an
opposite-type logical jump (offset++). That target pops the value on
fall-through (Executor::ins_logical_jump), so skipping it left a stray
value on the stack, which corrupts a following stack-addressed assignment:

    var x := ( a && b ) || ( c && d );

left x uninitialized whenever the first clause was false (i.e. the
deciding clause is not the first operand). The same chain works as an
if() condition or when declaration and assignment are split
( var x; x := ... ).

Only thread same-type logical jumps; keep targeting opposite-type ones so
their fall-through pop still runs.

Adds testsuite/escript/opt/shortcircuit7 exercising the value / assignment
context (companion to shortcircuit6's if()-condition tests).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* removed other unsafe jump merges
additional test

* adapted testdata

* core changes xml

---------

Co-authored-by: Oleksii Rebreniuk <oleksii.rebreniuk@shopit.se>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 12:02:39 +02:00
turleypol
5738840f3b
Fixed shortcircuit optimization for consecutive jumps (#898)
* added test which will fail

* disabled short-circuit jump combiner

* docs

* reactivating logical convert remove

* dedicated step to optimize jumps based on instructions

removed disabled ShortCircuit code

* added more tests, adapted corechanges

* added dedicated CodeSection optimizer
2026-07-22 12:58:56 +02:00
Fernando Rozenblit
cc64a44d36
Improve uoconvert correctness and speed (#897)
* fix old Tokuno map issue

* quick fixes

* restructure mapwriter to store files in memory until a write is needed

* add dirty flag to only flush files which changed

* change uoconvert use of mapwriter to a stack variable

* added detailed timers to uoconvert map

* precalculate lowest adjacent z so we dont need to calculate again for each tile

* syntax formatting

* read landtiles directly instead of using safe_getmapinfo

* encapsulate the solid block processing result for a single block

* make processing parallel - 5 sec to 2,7 sec for britannia

* add changelog entry

* reduce redundant per-tile work in the solid-block loop

* bucket each static block once instead of rescanning it per tile

readstatics_block() presorts a block's statics by cell in a single pass
(storage order preserved); each tile's bucket then serves directly as the
per-tile scratch, dropping the 64x whole-block rescan and the per-tile copy.
Outputs byte-identical (SHA256 gate, map+maptile, both realms).

* extract merge_shapes and flatten the water-type lookup

- the shape-consolidation loop moves verbatim into merge_shapes(), with
  its invariants and comments; ComputeSolidBlock now reads as
  collect -> filter -> sort -> merge -> emit
- DiscardedWaterTypes is snapshotted into a flat per-graphic table after
  config load; the hot per-static probe drops the tree lookup
Outputs byte-identical (SHA256 gate, map+maptile, both realms).

* name the conversion's magic numbers

MAX_LANDTILE_ID joins LANDTILE_COUNT in plib; wall height, water-discard
window and sand-over-water gap become named constexprs. Landtile classifiers become constexpr in
terrainplane.h with their id lists sourced. Outputs byte-identical.

* unify the block-index math into one helper per layout

realm_block_index (8x8 row-major: base.dat/solidx1/statics.dat),
maptile_index (64x64, rounded-up stride), and staticblock_from_coords
(client mul column-major, reused in RawMap::rawinfo) replace eight
hand-rolled copies of the stride dance. SOLIDX_* macros become constexpr;
dead mapblob.h (wrong 16x16 sizes, never included) is deleted.
Outputs byte-identical; unittest_pol+escript suites pass.

* refactor file writing

* add file RAII

* fix macos

* document uofiles and MORE_SOLIDS flag

* modernize: span for extract_planes, set contains, const/constexpr fixes

* update changelog

* probe landtile classes through a compile-time table and change push_back to emplace_back

* fix corechanges.xml mismatch

* add erorr handling to ReadEntireFile
2026-07-20 07:59:08 +02:00
Fernando Rozenblit
d3a55230bd
Multiple network improvements (#894)
* add DNS resolver to OpenConnection() and proper timeout handling

* use _WIN32 instead of other headers

* add option to bind with localhost only, use it for DebugLocalOnly

* Make WebServerLocalOnly also bind to localhost-only

* only let webserver settings be loaded at the initial load to avoid race conditions
2026-07-13 06:47:24 +02:00
Fernando Rozenblit
49230d0050
Improve webserver performance and add more tests (#891)
* Improve webserver performance and add more tests

* add more tests and use fmt library

* attempt MacOS fix for OpenConnection

* add changelog for connection fix
2026-07-05 20:38:10 +02:00
turleypol
7ff9d877a8
Funcrefs do not detect pid change (#889)
* test for sending a function to the same program

* store executor pid inside funcrefs and classes

* docs
2026-05-31 11:45:35 +02:00
turleypol
552248917b
Fixed leak when a class/funcref is a global (#887)
* store globals as weakptr in class/funcs to prevent memleak when stored
as global WIP

* let it crash if globals are no longer valid?

* typo

* removed debug prints

* let only the current executor crash

* fixed logic

* added and corrected tests

* cleanup

* use emplace_back

* classes also need to switch to weakptr

* docs
2026-05-27 08:02:19 +02:00
Kevin Eady
6d748af2df
Add module function party::ListParties() (#886)
* implementation

* tests

* docs
2026-05-23 08:27:16 +02:00
turleypol
19f1049973
fixed problem when sending vitals bigger then 0xffff to other clients (#877)
* fixed problem when sending vitals bigger then 0xffff to other clients.
The percent value was calculated based on the already capped values

* directly use the correct type

* docs
2026-05-14 11:41:09 +02:00
AsY!um-
04a8a2ba11
Restore NPC cold_resist_cap from its own orig value on refresh_ar (#880)
* Restore NPC cold_resist_cap from its own orig on refresh_ar - tests

* Restore NPC cold_resist_cap from its own orig on refresh_ar - actual fix

* Update core-changes and make comments more concise
2026-05-10 15:43:03 +00:00
turleypol
2451034279
print starting line number when loading fails (#876) 2026-04-22 20:42:20 +02:00
turleypol
71c77723b6
Don't send statmsg pkt on every equipped item when refreshing ar (#875)
* do not send full_statmsg for each equipped item while refreshing armor

* added test

* docs
2026-04-22 14:52:48 +02:00
turleypol
a1864581a0
Use mariadb connector as a replacement for mysqlconnector (#872)
* silence cppdap lib

* refornat curl flags for readabilty

* zlib was build with the wrong runtime mode. Updated version

* use mariadb connector instead of mysql

* removed mysql define

* removed mysql

* removed installation of mysqlclient in workflow runs

* fixed curl install dir

* missing zstd on macos

* fixed module parsing for cmake 4.x

* docs

* added mariadb build to tidy_pr_check

* test sql on all platforms
some plugins need to included on windows
2026-03-30 22:50:24 +02:00
turleypol
5bd71ae8ee
Non blocking gump cmd (#871)
* refactor gump pkt creation

* testclient returns buttonid 1 pressed when 'button' is contained in the
commands

* extended test

* cleanup destructor mess a bit

* store gumps as pair to decide if the executor needs to be revived
more refactoring

* disallow copy, if used creates nasty bugs

* helper method to convert imp to character

* gumpevent

* new non-blocking dialog function, sends event instead

* test closegump

* test if serialnumber gets correctly converted and invalid entries get
skipped

* removed unused BApplicPtr class
added BApplicObjBase to impptrIf convert function

* use impptrIf

* CloseGump accepts now also an array of characters
extended tests

* moved deleted copy constructor to the public part

* by default clang tidy will check .inc files, removed this filter

* the last tidy run with modernize-loop wasnt added to the PR check

* keep vector with chr and gumpid per uomod
to prevent growing dont add to the cache if same chr with same id
already exists.

* docs

* core-changes
2026-03-16 08:11:43 +01:00
Kevin Eady
a4ef957803
Fix handling of AlternateMultiID in boat item descriptor structs (#869) 2026-03-09 17:22:13 +01:00
turleypol
f1787dea78
dont use a static buffer for reading cfgfile to be threadsafe (#868)
* dont use a static buffer for reading cfgfile to be threadsafe

eg config/www.cfg can load in the background
cleanup the file: deleted ancient define, simplified logic

* docs
2026-03-07 13:01:56 +01:00
turleypol
97fb7ffb04
Uoconvert the wrong coordinates where shown when a block contains more then the allowed number of items (#866)
* uoconvert: fixed wrong coordinates error msgs when too many static items exist in a
block

* fix gcc?

* since we have it.. use the correct literal

* fixed wrong format and warning

* docs and slightly changed msgs

* addressed comments
2026-02-23 06:59:08 +01:00
turleypol
593f547b73
active development is now 100.3 (#865) 2026-02-16 20:37:42 +00:00
turleypol
db532435d2
Release Pol v100.2.0 (#864) 2026-02-16 19:40:49 +00:00
turleypol
da2943acb8
Tidy copy initialization (#859)
* trigger tidy

* copy&move BApplicPtr obj
always commit tidy changes

* move PolObject

* fix house add_component

* Automated clang-tidy change: performance-unnecessary-copy-initialization,performance-unnecessary-value-param

* Revert "Automated clang-tidy change: performance-unnecessary-copy-initialization,performance-unnecessary-value-param"

This reverts commit bb6aab13dbdfa4aaf420cdaafaf22940f241fc5b.

* performance-unnecessary-value-param gives some weird suggestions

* Automated clang-tidy change: performance-unnecessary-copy-initialization

* minor performance improvements

* added used tidy check

* missing dependency

* renamed build so its no longer requires?

* better add docs for the sneaky fix

* silence pr check, not all headers can be compiled seperatly

---------

Co-authored-by: Clang Tidy <clang-tidy@users.noreply.github.com>
2026-01-19 08:17:28 +01:00
Lukáš Novotný
cf0346780b
do not include full program in funcref memory estimate (#856) 2026-01-17 18:44:02 +01:00
turleypol
0259f11475
Class method if it's a method_id call now works if parameters are given (#849)
* modifed test to trigger the failure

* getParams modifies the ValueStack and thus cannot be called twice.

* docs
2026-01-10 18:12:09 +01:00
turleypol
37bbf0acd2
Fixed method_id call for class methods (#840)
* method-id calls on classes need to be redirected to non-id instruction

* added corechanges

* fixed compiler warning
2026-01-10 10:18:58 +00:00
turleypol
9daf269db5
Dynamic items with height 0 didn't block los like the static version (#848)
* dynamic items with height 0 (floor) didnt blocked LOS like static items
does
optimized los check by using multimap for faster lookup of dynamic items
added test

* revert multimap usage, benchmark showed that the original solution is
way faster

* docs
2026-01-10 10:52:03 +01:00
turleypol
bf4ec1951d
Write filenames and lines into ecompile .lst files (again) (#846)
* ListingWriter prints filepath, filelineno and source line
the old compiler did it, now again in the new compiler
since shortcircuit the original sourcelines are available during compilation

* remove listfile.inc function from test result

* prefix output

* custom formatting

* docs
2026-01-07 22:19:25 +01:00
turleypol
58a6db75be
Integer overflow when using GetConfigInt (#844)
* impptr_if now accepts also const BObjectImp*

* cfg::GetConfigInt returns error if the value would produce an overflow
code cleanup of cfgmod
added tests

* increase test coverage

* added comment why the exception should be catched without reaction
fixed member_id test

* added corechanges
its 2026
removed else
2026-01-04 13:22:11 +01:00
Lukáš Novotný
ec90c8e669
do not send warmode change to clients who cant see the character (#839)
* do not send warmode change to clients who cant see the character

* update corechanges
2026-01-01 12:10:07 +01:00
Fernando Rozenblit
c9eeba30f7
Add https to docs links (#838) 2025-12-29 09:46:15 +01:00
Kevin Eady
0790397c8a
Fix parsing issue introduced with regular expressions when using floating-point dividends (#832)
* do not allow regex after a float token

* docs
2025-12-14 19:44:13 +01:00
Reloecc
d0df64becf
DiscardedWaterTiles config for uoconvert (#830) (#831)
Added uoconvert.cfg element StaticOptions extended by DiscardedWaterTiles. Lists
the tiles that will be discarded during the processing of solid statics, where
the map is at or below the same Z level as the static, allowing boats to bump
into shores. Defaults to tiles in the range from 0x1796 to 0x17B2 if not present
in the config file.
2025-12-14 17:55:55 +01:00
turleypol
e6340689d7
Fix sending of new objects for boat travellers and observers (#829)
* added debugs for boatmove

* log component send

* added option to resend components

* compilation fix

* activate by default

* cleanup fix no1
more debug logs

* test client now ignores/removes objects out of range
lets see what explodes

* syntax fix

* syntax fix..

* need a copy of the keys

* handle equipped items

* handle server side view range change

* test char on boat and move to npc

* compilation fix?

* more logs

* corrected logs

* the boat needs to move more

* change order, first smooth move then new objects

* correct fix I think
send new objects for all newer clients on the boat after the boat pkt is
send (which also updates the position for the client)

* cleanup, fixed first test by sending also the playerposition when a new
obj appears

* test for item on boat

* need to move the boat further so that components are in range

* is the test wrong or is it a bug?

* move further

* ability to disable auto delete of objects to be able to test serverside
remove pkts

* change start position of the boat

* cleanup and fixed tests?

* more cleanup

* docs
2025-12-14 11:58:48 +01:00