Commit Graph

110 Commits

Author SHA1 Message Date
est31 f9b09368f0 Time: Remove serverside getter, and use atomic operations
It isn't possible to use atomic operations for floats, so don't use them there.

Having a lock is good out of other reasons too, because this way the float time
and the integer time both match, and can't get different values in a race,
e.g. when two setTimeofDay() get executed simultaneously.
2015-11-03 19:07:45 +01:00
kwolekr c56d7fe0eb Add DISABLE_CLASS_COPY macro (and use it)
Use this macro to disallow copying of an object using the assignment
operator or copy constructor.  This catches otherwise silent-but-deadly
mistakes such as "ServerMap map = env->getMap();" at compile time.

If so desired, it is still possible to copy a class, but it now requires
an explicit call to memcpy or std::copy.
2015-10-27 22:05:08 -04:00
est31 ca8e56c15a Environment: Time of day fixes and add serverside getter
-> Put access to time variables under the time lock.
-> Merge both time locks, there is no point to have two locks.
-> Fix the lock being released too early in Environment::setTimeOfDay
-> Add serverside getter so that you don't have to get
	the environment if you only have the server
2015-10-27 23:19:17 +01:00
paramat 3b9f99e0d6 ABMs: Make catch-up behaviour optional
Default is true for backwards compatibility
Update lua_api.txt
2015-10-18 16:42:59 +01:00
Loic Blot 596484da4f Save and remove player by pointer
Why doing things simple ? Use pointer instead of strings to save players and remove them.
Saving players by name does a lookup to find pointer we already have ! Idem with removePlayer
Also remove unused removePlayer(peer_id), it's never called
2015-09-23 19:37:05 +02:00
Loic Blot 9c635f28ac Little optimization on getAdded/Removed activeobjects per player loop.
Use std::queue instead of std::set, we don't need such a heavy container.
Don't convert position to int to convert it back to float in the next function.
2015-09-19 20:57:07 +02:00
Loic Blot 1f1e14ab7f Change m_client_event_queue's type to std::queue
As indicated in its name, m_client_event_queue should be a queue.
Change std::list to std::queue to improve the queue's performance.
2015-09-08 21:23:09 +02:00
ShadowNinja e4bff8be94 Clean up threading
* Rename everything.
    * Strip J prefix.
    * Change UpperCamelCase functions to lowerCamelCase.
  * Remove global (!) semaphore count mutex on OSX.
  * Remove semaphore count getter (unused, unsafe, depended on internal
    API functions on Windows, and used a hack on OSX).
  * Add `Atomic<type>`.
  * Make `Thread` handle thread names.
  * Add support for C++11 multi-threading.
  * Combine pthread and win32 sources.
  * Remove `ThreadStarted` (unused, unneeded).
  * Move some includes from the headers to the sources.
  * Move all of `Event` into its header (allows inlining with no new includes).
  * Make `Event` use `Semaphore` (except on Windows).
  * Move some porting functions into `Thread`.
  * Integrate logging with `Thread`.
  * Add threading test.
2015-08-23 22:04:06 -04:00
kwolekr bcf38a2ad1 SEnv: Remove static_exists from ActiveObjects in deleted blocks 2015-08-16 15:55:07 -04:00
est31 3b50b2766a Optional reconnect functionality
Enable the server to request the client to reconnect.

This can be done with the now extended minetest.request_shutdown([reason], [reconnect]) setting.
2015-07-23 07:38:13 +02:00
nerzhul f9dbec6edf Kick players when shutting down server and there is a crash due to a Lua stack exception 2015-07-16 20:27:42 +02:00
est31 dd91b3d6fb Generic CAO cleanups and renames for clarification
* Use enum for GENERIC_CMD_*
* Rename m_attachements to attachement_parent_ids (public member and clearer name)
* Rename GENERIC_CMD_SET_ATTACHMENT to GENERIC_CMD_ATTACH_TO
* USHRT_MAX + 1 buffer sizes to prevent overflows as @kahrl suggested
* Remove unneccessary m_id from GenericCAO (shadowing protected superclass member for no reason) as @kahrl suggested
2015-06-20 03:37:30 +02:00
est31 40226e5274 Make attached objects visible in 3rd person view 2015-06-20 02:59:53 +02:00
nerzhul eec01bc2fa Re-apply 972d17baea81ffe6d508b291ef97207a4822e1da...
but not rename the container. Approved-By est31
2015-04-22 11:47:22 +02:00
kwolekr e0eec201a1 Revert "m_active_object_messages is used like a queue. Use std::queue instead of std::list. Also rename to m_active_object_messages_queue"
This reverts commit 972d17baea.
The commit being reverted was unauthorized.  There had been no discussion,
review, or sign-off prior to submittal to upstream.
2015-04-21 18:12:01 -04:00
Loic Blot 972d17baea m_active_object_messages is used like a queue. Use std::queue instead of std::list. Also rename to m_active_object_messages_queue 2015-04-21 23:28:13 +02:00
Loic Blot 0c634a9719 Use std::vector instead of std::set for Environment::getObjectsInsideRadius
We are only iterating sequentially, we don't need a set here
Also use a vector reference instead of a copy
2015-04-16 18:37:29 +02:00
Loic Blot 365e4ae0fa Performance improvement: Use std::list instead of std::vector for request_media, Server::getModNames, Environment::m_simple_objects.
* Also remove unused Server::m_modspaths
2015-03-05 10:44:48 +01:00
Loic Blot 06f328207f ABMHandler and player_collisions use sequential read/write. Switch from std::list to std::vector
* Also remove dead code Map::unloadUnusedData which is dead since a long time
2015-03-04 17:02:36 +01:00
Loic Blot 7f8f9785d7 ASyncRunStep doesn't need to lock when do setTimeOfDaySpeed.
* setTimeOfDaySpeed already lock a mutex when modify the value, we don't need to lock all environment.
* add a fine grain lock for getTimeOfDay and setTimeOfDay to solve environment multithread modifications on this value
2015-03-04 11:46:31 +01:00
Loic Blot 2079462e62 Change many useless std::list into Environment class (m_players), ABMHandler and ActiveBlockList::update
This improve looping performances.
2015-02-17 16:50:03 +01:00
kwolekr 38bd9e93a2 Fix all warnings and remove -Wno-unused-but-set cflag 2015-01-18 23:29:19 -05:00
Craig Robbins 2b119e1e19 Performance of main client loop up to 2x faster In places, up to 3 times faster
NOTE 1: This does not mean a 2x increase in framerate. Increase in fps may be up to 1-2fps
NOTE 2: This local 'caching' of settings is not optimal and an alternative solution will be worked on after 0.4.11 is released
2014-12-07 00:51:01 +10:00
SmallJoker c40e993ce4 Replace setting unlimited_player_transfer_distance with player_transfer_distance 2014-11-08 14:56:09 +01:00
ShadowNinja 7e6db1b803 Only keep players loaded while they're connected 2014-06-23 15:45:59 -04:00
sapier f6fc39e69a Fix race condition on accessing m_time_of_day_speed causing day night race on some architectures 2014-06-23 00:26:57 +02:00
sapier 35ec3855f6 Speedup attachement handling by replacing vector search by direct array access and secondary child lookup vector 2014-06-23 00:13:41 +02:00
proller 0279f32db7 Remove liquid_finite and weather 2014-04-18 21:56:48 +04:00
Sfan5 118e2ae865 Fix all warnings reported by clang 2014-04-15 21:34:53 +02:00
Ciaran Gultnieks 0643cef09a Update ABM object counts when triggers add objects
Also fixes long-standing accuracy issue due to unknown wider
object count not being incremented.
2014-03-09 11:13:44 +01:00
Novatux 062de11b4c Fix rendering glitches when far from the center of the map 2014-03-04 20:12:10 +01:00
kwolekr 89f7dc1efd ServerEnvironment: Remove direct dependency on EmergeManager 2014-02-09 16:36:30 -05:00
Perttu Ahola 6a3fa9df12 Add player:override_day_night_ratio() for arbitrarily controlling sunlight brightness 2014-02-01 18:38:21 +01:00
Novatux 84b94eb198 Add forceloading 2014-01-11 17:54:00 +01:00
stujones11 d9ef072305 Make line_of_sight return blocking node position 2013-12-12 16:11:00 -05:00
Novatux d879a539cd Add minetest.swap_node 2013-11-30 18:37:56 +01:00
kwolekr 9bccd75e34 Weather: Clean up getHeat/getHumidity somewhat 2013-09-16 23:33:53 -04:00
Kahrl 4e1f50035e Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu 2013-08-14 21:03:33 +02:00
Perttu Ahola 742614180c Fix anticheat 2013-08-03 23:16:37 +03:00
proller 3aedfac968 Weather support 2013-07-27 23:21:48 +04:00
RealBadAngel d19c8b815d Add set_breath and get_breath to lua API. 2013-07-20 20:34:11 +02:00
PilzAdam 53066024f6 Add drowning 2013-06-19 15:47:00 +00:00
sapier ab43377577 Move scriptapi to separate folder (by sapier)
On the lua side, notably minetest.env:<function>(<args>) should now
be replaced by minetest.<function>(<args>).
The old way is and will stay supported for a long time.

Also:
Update and clean up lua_api.txt (by celeron55)
Move EnvRef to lua and remove add_rat and add_firefly (by kahrl)
Add separate src/util/CMakeLists.txt, other minor fixes (by kahrl)
2013-05-25 00:51:02 +02:00
sapier 69367aa799 Add Dijkstra A* and A* without prefetching pathfind algorithms 2013-04-06 11:24:03 -04:00
PilzAdam b0e6806077 Fix nick completion 2013-04-05 02:31:58 +02:00
Ilya Zhuravlev 6a1670dbc3 Migrate to STL containers/algorithms. 2013-03-11 19:08:39 -04:00
kwolekr b9d8e59bbf Add emerge.cpp, initial EmergeThread changes
- Neatly placed all emerge related code into a new file, emerge.cpp
- Greatly cleaned up the code in EmergeThread::Thread()
- Reworked Emerge queue.  Now an actual std::queue of v3s16 block positions
- Removed the completely unnecessary map of peer ids requesting blocks
2013-02-25 22:56:18 -05:00
Sfan5 6d0ea26c2d Update Copyright Years 2013-02-24 20:15:24 +01:00
PilzAdam 497ff1ecd6 Change Minetest-c55 to Minetest 2013-02-24 18:49:03 +01:00
kwolekr 11afcbff69 The new mapgen, noise functions, et al. 2013-01-21 21:41:33 +02:00