Commit graph

58 commits

Author SHA1 Message Date
Kevin Eady
ecd07dbe48
poc of templating background connect 2024-07-20 03:20:28 +02:00
turleypol
d848deae18
POLLOG* macros use the new formatting (#598)
* POLLOG* macros use the new formatting
removed all old logging functions

* removed old fmt lib from everything except StreamWriter
removed unneeded functions

* fixed review comments
2024-01-16 17:55:42 +01:00
turleypol
43b776b94d
New format lib version (#592)
* renamed include guard to be able to use both format lib versions in
parallel

* build Fmt lib and link it into clib

* use std::string instead of format Writer for logging
added variant "2" for logging with new fmt lib

* use new logging variant for two logs

* always add \n to flush log, lets see if the assumption holds

* use new lib for tostring

* replaced all INFO_PRINTS in clib

* formatter for Token, BObject and BObjectImp

* started with bsccript

* use function instead of actual object for logging

* remaining bscript, started plib

* logvariant without newline added, more template magic

* format support for base types, added test for format padding
new version for fdump

* chanhed ecompile/runecl fixed compilation with ESCRIPT_PROFILE

* rewrite INFO_PRINT in plib,poltool/uoconvert/uotool

* replaced remaining INFO_PRINTS, renamed macros INFO_PRINT for logging
without newline, INFO_PRINTLN for newline addition.
Replaced also INFO_PRINT_TRACE and renamed it to INFO_PRINTLN_TRACE

* gitignore for fmt lib

* cleanup vim leftovers
2024-01-10 18:29:10 +01:00
Kevin Eady
79273d2719
Fix storage area usage in module functions (#551)
* Fix storage area usage in module functions

* Address review comments
- Add OT_STORAGEAREA
- Remove remaining TODOs

* Really fix todos
2023-10-16 12:33:54 -04:00
turleypol
6d73472029
Testsuite reorganization, new feature to call exported functions (#237)
* restructured pol testscripts
pkg based (dedicated pkgroot)
runs per pkg:
setup.ecl if exists
all scripts starting with "test"
cleanup.ecl if exists

return 1 for success everything else is an error

* Scripts can now be loaded and exported functions called
adapted testscripts to use this feature
critical script handling missing

* added support for used in critical scripts

* use weakptr instead of pid
moved keep_alive flag to uoexecutor

* Function and nethod accept now a argument list

* added docs

* missing docs

* faster shutdown time

* fixed typo

* fixed weird cornercase

* shorter test functions names, the length is limited, renamed
loadexported test script to have a dedicated testscript

* generate tiledata/multi for small boat
added generate scripts for generation..
adapted testdata set

* boat tests

* extended scripttests
scheduler will now always know about the loaded script
secured scheduler api

* cleanuo scripts for boat and npc

* shorter function for error return
fixed cleanup: npcs have gravestones, chars was one off and scripted
create of a char made it permanent logged in (until next restart),
which also means that it cannot be deleted

* bypass windows specific ecompile.cfg logic

* fix for parallel execution

* on windows its called .exe ..

* use target binary directly, so cmake can replace it with the actual path
use absolute path to testsuite
disabled temporary the copy of ecompile

* configure ecompile.cfg to add absolute path

* early sleepms calls can lead to endless waiting

* Code coverage (#260)

* play with coverage reports

* fix yml

* use 0 as default for gcov cmake var

* fixed used cov version, hopefully fixed now cmake

* demangle function names

* removed debug msg

* added a few polcore tests (basically just for coverage)
first set executor to noncritical before blocking

* added https://coveralls.io/github/polserver/polserver

* added a stackable item
added a few backpack insert tests
do coverage build only on push events not also for PR merge builds

* added storage tests..
docs need fixes, the Imps are not working at all

* fixed storage test to really move items

* added a house
corrected static/dynamic flag
created a few house tests

* updated yml file to new github api

* corrected coverage discord job name

* always put to runlist even if not necessary

* extended aos prop tests

* equip/unequip aos mod

* extra ci step for shard test fixtures and activated verbose shard test

* use extra ci step for all build configs, sorted testscripts for
execution

* fixed sorting

* added param to syslog to not print the context (cleaner testscript
visualization)

* added build targets for tests

* sleep api cleanup

* more aos property tests

* build for coveralls also on pullrequest

* readded debug state reset on schedule

* updated checkout ci action

* updated checkout in all ci runs
2020-12-16 18:56:10 +01:00
Eric Swanson
2cae8137f3
Enable building on OSX (clion) (#318)
* Build on OSX

* Add macos-latest to build matrix

* Fix case sensitivity checks/tests

* On osx builds, cope with unpacking a double that might be followed by either an exponent or an error (as part of an array).

Also, remove static unpack(const char*) forms that were never called.

Co-authored-by: turleypol <turley@polserver.com>
2020-09-26 06:57:10 -07:00
turleypol
902c9cbfde first version of ++i and --i unary operator 2019-09-21 14:56:06 +02:00
turleypol
ea9f5afd45 moved default deconstructors into header to let them count as trivial. 2018-11-03 15:00:44 +01:00
turleypol
a5e6206164 Added cmake option to run clang-tidy
used everywhere nullptr
2018-10-09 16:36:35 +02:00
turleypol
0a39af15a1 Changed classes to be final if possible, removed override macro 2018-10-09 09:47:27 +02:00
turleypol
0aea78c405 added array.sorted_insert to insert into an already sorted array.
Added a few finals and defaults
2018-10-07 21:05:02 +02:00
turleypol
3afc41241b
CMake on windows (#48)
CMake can now also be used for windows
2018-02-24 22:34:55 +01:00
turleypol
2ba436bd56 protected functionref to be executed in a different script
added testscripts
2018-02-04 16:08:03 +01:00
turleypol
d7fbb4ac8e cleanup debug prints
fixed funcref implementation
2018-02-04 11:58:26 +01:00
turleypol
0d04d5e19b Current FunctionRef status. Mixed with a few more cmake stuff 2018-02-03 19:05:22 +01:00
turleypol
dbb25bdb62
Include and buildsystem cleanup (#45)
Include cleanup
Reworked buildsystem (Linux only)
Removed dynamic libs, Linux now again uses static linking (like windows)
2018-01-29 21:55:48 +01:00
turleypol
ef2108c9f7 New objecttype Boolean.
create via basic::Boolean(1/0)
only == != ! operators are implemented.
2018-01-05 20:04:01 +01:00
turley
c0db8527ef reworked buildDistWin
find VS installation with vswhere (local if no 2017 is installed)
dont build and link against debug version of curl
automatically insert git revision if git is in path
2018-01-03 10:07:42 +01:00
turleypol
798eda5b63 Cleanup of header includes. 2018-01-01 21:52:14 +01:00
turley
f9c3db9e41 Modules share the same (helper) template base class
Optimize function name search for all modules not only uo by using an additional map, replaced c array with vector for functionsdef.
Simplified pragma pack order. (MSVC version is supported in all
compilers)
Removed compilerassert.h (asserteql,..) replaced with static_assert
Removed some old #ifs
2016-12-20 23:53:32 +01:00
turley
189cad3479 Formating everything
Authors are not forced to use the clang-format setting, but should
atleast be inspired by the style.
The only thing which is now not allowed are tabs for ident/alignment!
2016-02-19 19:26:35 +01:00
turley
ed7b16b233 normalized lineendings 2016-02-11 22:54:43 +01:00
turley
92cc1b4d70 Use weakptr to uoexecutor in the threaded sql call
changed client class from ref_counted to also hold like the uoexecutor a weakptr, use it in the ClientObjImp.
Renamed NPCRef to NpcRef like its been told since years in a TODO comment
fixed some warnings from VS2015
2016-02-10 23:09:05 +01:00
Gabriele Tozzi
f2f03364c1 Documentation: trying to document namespaces 2016-01-29 21:03:54 +01:00
Gabriele Tozzi
fd24da5cd1 Documentation: reformatting some comment blocks 2016-01-25 01:17:56 +01:00
Gabriele Tozzi
530790c8f8 Comparison operators refactor: better handle weird cases, cleaning
- obj.isLesserThan() and obj.ieEqual() are now replaced by < and ==
- Removed obsolete isLT(), isLE(), isGT(), isGE()
- Also implemented comparison operators for BObjectImp
- These operators may now be fully overriden in child classes
- Default implementations are derived from == and < operators
- As a general rule (that fit into "undefined" behavior":
-- Objects are == if having the same address
-- Objects are < based on their type ID, except of Error and Uninit
   that always are < everything else.
-- Objects are supposed to implement their own < and fall back to
   base class. If not implemented, as a last fallback, the object's
   address in memory is used to do the comparison
- Added test case for comparison operators
2016-01-24 22:22:45 +01:00
Gabriele Tozzi
45959b92d2 Small memory improvement: BObjectImp.type_ is now u8 instead of int
It is very unlikely to grow to more than 256 elements any time soon.
This should save 3 bytes for every single object that derived from it.
Also added explicit int conversions and a not, for better robustness.
2015-12-29 03:21:02 +01:00
turley
0293599380 Corrected some virtual overrides, re-activated corresponding warning.
Plus some other warning corrections
2015-12-26 17:39:58 +01:00
turley
b77a13073c corrected several data races 2015-03-14 11:45:14 +01:00
turley
c67d744afb fixed debug build 2014-11-23 15:22:57 +01:00
turley
90f162924d Added override keyword to virtual functions 2014-11-23 15:07:02 +01:00
frozenblit
cc44d08b24 Fixed visual studio warnings
Adding "inline" to the unused template functions removes the warning
about the function not being used (C4505).

Fixed a warning in ExceptionParser.cpp about GetTID() not being used by
not defining it in the first place for WIN32.
2014-11-08 13:24:01 +01:00
frozenblit
943b820eba More and more cleanups
Added some missing include guards, corrected wrong include guard names.
Removed more stl_inc.h includes.
2014-11-02 19:40:40 +01:00
frozenblit
c4cb100279 Some more stl_inc.h cleanups 2014-11-01 19:16:13 +01:00
frozenblit
fb717e2ef3 Even more cleanups.
Removed stl_inc.h from most of the include files. Still have some 200
files to go. I wish I'm done... someday...
2014-11-01 15:43:45 +01:00
frozenblit
d7fe789c65 More cleanups 2014-10-31 23:59:51 +01:00
frozenblit
3bec88c830 Cleaning up includes and adding fully-qualified names 2014-10-31 20:45:30 +01:00
turley
31ee263a45 activated new logging facility 2014-01-18 13:29:38 +00:00
turley
99d7dc3037 namespaces...finally :)
Hard part is finished every file is touched. Namespaces are currently rough named by directory name.
Maybe we could split it more
2013-12-21 09:10:46 +00:00
turley
7085a8470f new StreamSaver class used for saving 2013-10-06 14:45:10 +00:00
turley
90f1fc9248 implemented the std mutex 2013-09-13 19:03:25 +00:00
turley
593bea8cea the first version of the leak fix was of cause to easy... 2013-08-31 16:27:31 +00:00
turley
115dd7b2cc some more threadsafe stuff 2012-01-04 13:11:43 +00:00
turley
fac3213f2a finally support for +=,-=,*=,/=,%= with objectmembers, like who.resist_fire_mod+=1 2012-01-03 14:53:36 +00:00
turley
65d51103fa major rewrite of primitive operators
major speedup of +=,-=,...
2012-01-03 11:32:26 +00:00
turley
4e7e400254 64bit compilation.. 2011-12-23 13:28:38 +00:00
turley
b35cbd463d finished pkt refactoring
gave threads names under windows for better debugging
fixed memoryleak in ItemGivenEvent
2011-12-19 16:34:21 +00:00
muaddib_pol
db9bb96212 * Fixed a script breaker caused by inserting new TypeOfInt() constants in the middle of the Enum. Moved SQL Types to end of list.
+ Added SQL entries to the Basic.EM since were missing.
2011-11-30 02:23:08 +00:00
KevinEady
25c1b0ccb8 11-22-2011 kevin:
Added:	pol/sqlscrobj.cpp pol/sqlscrobj.h
  Changed:	pol/module/sqlmod.cpp pol/module/sqlmod.h
  			Add preliminary MySQL database support.
  			New eScript objects: BSQLConnection, BSQLResultSet, BSQLRow 
  			Added several new sql module functions:
  				mysql_connect(host,username,password);
				mysql_query(connection,query);
				mysql_fetch_row(result);
				mysql_affected_rows(result);
				mysql_num_fields(result);
				mysql_num_rows(result);
				mysql_select_db(connection,database);
				mysql_field_name(result,column_index);
				mysql_free_result(result);
				mysql_close(connection);
			In order to build with MySQL support, define the HAVE_MYSQL preprocessor directive in your build configuration.
			You must have the MySQL headers and libraries installed. 
			Only really tested with dynamically linking mysql libraries on Linux.
			
	Added:	pol/network/auxclient.h
  Changed:	pol/network/auxclient.cpp pol/module/osmod.cpp pol/module/osmod.h clib/socketsvc.cpp clib/socketsvc.h
  			Moved AuxClient-related classes to its own header file (shared between auxclient.cpp and osmod.cpp)
  			Implemented os::OpenConnection() to create outgoing TCP/IP connections. 
  			
  Changed:	runecl/runecl.cpp
  			Added the sql module to runecl to allow quick testing

  Changed:	pol/uoscrobj.cpp pol/mobile/charactr.cpp pol/mobile/character.h bscript/parser.cpp bscript/objmembers.h
  			Added read/write property "mountedsteps" for mobiles. Represents number of steps taken while character was mounted.

  Changed:	bscript/parser.cpp
  			Declaring an array only using "{}" will show a compiler warning; please explicitly state 'array', 'struct', or 'dictionary' 
  Changed:	pol/pol.cpp
  			If using Linux, remove pol.pid on shutdown of pol.

  Changed:	pol/uoexec.h pol/scrsched.cpp
  			Added script option "AUXSVC_ASSUME_STRING" which will allow aux service connections to send and receive non-packed strings.

  Changed:	ecompile/ecompile.cpp
  			If using Linux, a slash ("/") cannot be used to define ecompile options to allow support for absolute filenames.

  Changed:	bscript/object.cpp bscript/bobject.h
  			Implemented array operation MultiSubscript. Will return a splice of an array, eg:
  				array{"a","b","c","d","e"}[2,4] will return array{"b","c","d"}
2011-11-23 05:49:30 +00:00
turley
d32cec7d6c Added: basic::TypeOfInt( expr ) + basic.em constants
returns like TypeOf() the type of given parameter, but returns instead of a string an integer (see basic.em constants)
since integer comparison are way faster then string comparison this function should always be used for comparisons
2011-03-12 10:51:10 +00:00