summaryrefslogtreecommitdiff
path: root/src/game-server
AgeCommit message (Collapse)AuthorFilesLines
2011-03-17Micro-optimizations related to std::stringThorbjørn Lindeijer9-53/+66
* Rely on the fact that a std::string is empty by default * Use std::string::empty() rather than comparing to "" * Construct with std::string() rather than from "" Reviewed-by: Bertram
2011-03-16Path finding: Moved F cost from PathInfo to LocationThorbjørn Lindeijer1-17/+15
The F cost represents the estimate of the total cost from source to destination. It is only relevant to sort the locations to be checked, so there is no point in assigning it to each coordinate of the map. With maps up to 200x200, the memory usage is reduced by 160 kB! :P Reviewed-by: Bertram
2011-03-16Allowed item names instead of IDs in @commandsPhilipp Sehmisch4-41/+84
The @drop and @item commands can now accept an item name instead of an item ID. In addition the amount can be omitted to create a single item.
2011-03-16Allowed monster names in @spawn commandPhilipp Sehmisch4-17/+67
I rewrote the @spawn command to allow two new things: 1. The monster ID can be replaced with the name of the monster. 2. The amount of monsters can be omitted. In that case a single monster is spawned. Reviewed by: Jaxad and Thorbjorn
2011-03-15Some code style cleanups in AutoAttack classThorbjørn Lindeijer3-31/+77
2011-03-15Eliminated one version of Being::performAttackThorbjørn Lindeijer3-14/+12
There was a version taking an attack range, but the range was always the same as the one specified in the Damage class.
2011-03-12Fixed monster flawed movements and client net messages flooding.Yohann Ferreira1-2/+2
The monsters weren't respecting the end of the stroll time before resetting their destination, which made them never cease changing it and flooded the clients with movement messages. Resolves: Mana-Mantis #315. Reviewed-by: Jaxad0127.
2011-03-12Removed a bunch of silly documentationThorbjørn Lindeijer6-30/+0
A C++ developer should be able to recognize a constructor and a destructor by just looking at it, so let's stop writing down the obvious. :)
2011-03-11Moved freeing of map position to Actor destructorThorbjørn Lindeijer6-30/+22
It was done in both the Character and the Monster destructors, but I don't see how any Actor should be excluded from this. Now it also happens for NPC, Effect and Item, though only NPC has a relevant walkmask. Also fixed a small issue introduced in 97e0a9eb170499 and added an assert to freeTile. We should be able to assert that a tile can only be freed if it was blocked. Reviewed-by: Stefan Dombrowski
2011-03-11Split path finding out of the Map classThorbjørn Lindeijer7-176/+176
Extracted the path finding algorithm out of the Map class and introduced a new class called PathInfo that has the path finding information that used to be part of MetaTile. This allows a single vector of path information to be shared between all maps running on the server, significantly reducing the memory overhead per map (for 200x200 maps, the memory reduction is about 1 MB per map). Part of this change is some cleanup, like moving the 'occupation' counts into MetaTile, inlining some methods for performance reasons, and using STL to simplify memory management. Mantis-issue: 106 Reviewed-by: Bertram
2011-03-11Fixed Actor::setPosition to update the blockmask correctlyThorbjørn Lindeijer1-8/+6
It was freeing the new tile rather than the previous tile. Reviewed-by: Stefan Dombrowski
2011-03-11Avoid sqrt and double in circle-to-circle collision detectionThorbjørn Lindeijer1-4/+6
We can just stick with integers by trading a sqrt for a multiplication. Reviewed-by: Bertram
2011-03-10Server-Wrap the open and closed list members in path finding.Yohann Ferreira2-76/+43
This prevents some weird things happening especially on crowded maps. I also removed the unused findSimplePath() function. Reviewed-by: Thorbjorn.
2011-03-09Renamed GameState::insertSafe() to inserOrDelete.Yohann Ferreira4-7/+7
This reflects much more what the function does IMHO. Trivial.
2011-03-06Small fixes coming from my comment on issue #77.Yohann Ferreira4-15/+18
Trivial.
2011-03-04Implemented persistent world and map variablesPhilipp Sehmisch7-13/+170
The gameserver now receive a copy of all world state variables when they are accepted by the accountserver and receive a copy of all map state variables of a map when they register it successfully. Implemented LUA script bindings for getting and setting these variables. When such a variable is set, the accountserver is notified about this change. Changes to world state variables are then propagated to all gameservers by the accountserver. Be aware that when a gameserver is updating a map, there is no check if it is actually responsible for said map. But I consider this not a security flaw, because authenticated game servers are considered to be trustworthy in a lot of other situations, too. Also renamed "quest" to "character variable" in the sourcecode. Reviewed-by: Bertram
2011-02-24Fixing dead born monstersStefan Dombrowski1-2/+5
Reviewed-by: Bertram
2011-02-22Implementing @killmonstersStefan Dombrowski1-0/+26
Reviewed-by: Crush
2011-02-21Remove obsolete reset of SIGSEGV handlingStefan Dombrowski1-3/+0
Reviewed-by: Thorbjorn
2011-02-20Adding CSV support from Jaxad's client implementation.Yohann Ferreira1-8/+45
Reviewed-by: Jaxad0127. Resolves: Mana-Mantis #286.
2011-02-19Removing dublicate deinitialize of enetStefan Dombrowski1-3/+3
Both servers deinitialize enet now from deinitializeServer(). Reviewed-by: Bertram, Jaxad0127
2011-02-19Add support for zlib map layer compression.Yohann Ferreira1-3/+6
Trivial fix.
2011-02-16Removing unused variable configPathChangedStefan Dombrowski1-3/+0
2011-02-16Fixed doc about stroll range, which is coded in pixels.Yohann Ferreira1-2/+2
Not in tiles, as suggested by the header. Trivial fix.
2011-02-15Fixed registering the players items to the buysell handler.Yohann Ferreira1-24/+46
Now buy/sell lua functions can access the player inventory again. This is not using the delayed mode, so it won't be a problem. Reviewed-by: Freeyorp.
2011-01-30Revert "Fixed the money handling."Jared Adams3-8/+2
This reverts commit b2209cbe93aa12dcd4e4e3b9a7cd8b13ed5713e9. Money should be handled through attributes, not magic numbers.
2011-01-31Fixed the money handling.Yohann Ferreira3-2/+8
- At character's attributes recalculation when necessary. - In the lua scripting functions.
2011-01-30Made the code tell a bit more when a monster is lacking values.Yohann Ferreira1-14/+30
2011-01-30Trivial code format fixes in monstermanager.cpp.Yohann Ferreira1-28/+45
2011-01-30Added the missing Magical dodge monster property.Yohann Ferreira1-0/+2
Now this can be loaded with the 'magic-evade' xml tag.
2011-01-30Made the monsters' attributes compute fine again.Yohann Ferreira3-10/+59
As a consequence, the monsters can spawn again. Reviewed-by: Freeyorp.
2011-01-22Made the being direction be updated only at the end of the movement.Yohann Ferreira1-3/+3
This saves a bit of cpu and make use of pixel points where tile points where used before and could lead to discrepancies. Reviewed-by: Thorbjorn.
2011-01-11Made the servers report their protocol version.Yohann Ferreira2-2/+5
As the protocol version isn't something the maintainers should set, I removed the net_clientVersion irrelevant option, replaced by the corresponding define PROTOCOL_VERSION in the manaserv_protocol.h file. A corresponding change in the client will be made. N.B.: Now, the Enet version is also reported in the log. Reviewed-by: Jaxad.
2011-01-10Removing default argument values from Map definitionStefan Dombrowski1-2/+1
The default argument values had no effect, because they are not in the declaration. Updating the codeblock project, because protocol.h had been renamed. Reviewed-by: Bertram
2011-01-09Fix being direction discrepancies by syncing the BeingDirection.Yohann Ferreira5-15/+112
The server was actually using the bitmask enum while the the client still sent another one, creating discrepancies. A second problem is that the being direction was not properly initialized and not updated while it was moving. Reviewed-by: Jaxad.
2011-01-09Removed the superfluous point struct.Yohann Ferreira9-24/+13
It was too close from the Position class and it leads to making the server handle one or another type through the code. Still bugged me many times while making changes. Reviewed-by: Jaxad.
2011-01-06Get rid of the server tick magic number.Yohann Ferreira4-9/+11
Reviewed-by: CodyMartin.
2011-01-03Got rid of the superfluous DEFAULT_TILE_HEIGHT/WIDTH.Yohann Ferreira4-10/+10
We've got DEFAULT_TILE_LENGTH in defines.h for that. Trivial fix.
2011-01-03Change Actor::mActionTime to mMoveTime member to reflect more its actual use.Yohann Ferreira3-12/+14
Trivial.
2011-01-03Cleaned up and document a bit more the speed conversion functions.Yohann Ferreira2-2/+3
Trivial fix.
2011-01-03Namespaced the manaserv protocol to ease the porting of the enums.Yohann Ferreira1-0/+1
Trivial.
2010-12-29protocol.h -> manaserv_protocol.h to avoid conflicts with mysql files.Yohann Ferreira2-2/+2
Resolves: Mana-Mantis #278.
2010-12-29Moved parts needing to be in sync with the client in protocol.h.Yohann Ferreira5-60/+19
Trivial fix.
2010-12-27Implemented @log and @logsay commands.Philipp Sehmisch1-0/+42
The @log command is the equivalent to tmwAthena's @l. It allows to log a text as a transaction for documentation purpose. The @logsay command works like @t on tmwAthena. It says something in public chat while also logging it as a separate trasaction. Reviewed-by: Thorbjorn
2010-12-27Added @kick and @kill commands.Philipp Sehmisch1-0/+71
@kick disconnects the client connection of a character. The new error- code 11 (ERRMSG_ADMINISTRATIVE_LOGOFF) is not supported by the client yet. It will show a generic "The connection to server was lost" message instead. @kill kills the character by setting its HP to 0. Added @kick transaction code I forgot in last commit. Considering that this was just minutes ago I think that noone updated his database yet. So I don't think that a new database version is justified for this. Reviewed-by: Bertram
2010-12-27Transaction logging of various command, new transaction codes and style fix.Philipp Sehmisch1-4/+28
The @mute, @goto, @attribute and @announce commands now logs transactions to the database. Added new transaction codes to database. I've preliminarily added a lot of codes for not yet supported commands so that we needn't do a database update with every single commit which implements one. Also using the equivalent "say" helper function in place of the "GameState::sayTo" method in the command handler. Reviewed-by: Kage
2010-12-17Implemented @die chat commandPhilipp Sehmisch1-2/+11
The @die chat command kills the evoking character by setting its hit points to 0. The example permissions.xml assigns it to the "tester" rights group and not "players" because server admins who are not aware of this command might run into trouble when they assume that players don't have a method to teleport to their spawn point voluntarily. Resolves: mantis ticket #192 Reviewed-by: Jaxad0127
2010-12-16Deharcoded the host and port options for each servers.Yohann Ferreira2-4/+24
Changes: ============================================================ For the account server: ------------------------------------------------------------ Old -> New ------------------------------------------------------------ net_accountServerAddress, net_listenHost -> net_accountHost net_accountServerPort -> net_accountListenToClientPort net_accountServerPort +1 -> net_accountListenToGamePort For the game server: ------------------------------------------------------------ Old -> New ------------------------------------------------------------ net_gameServerAddress -> net_gameHost net_gameServerPort -> net_gameListenToClientPort For the chat server: ------------------------------------------------------------ Old -> New ------------------------------------------------------------ -> net_chatHost net_accountServerPort + 2 -> net_chatListenToClientPort Special fallback feature, as requested by Freeyorp: When the net_accountListenToClientPort (default to 9601) is set, the 3 others ports will automatically offset from it, if they're not set, following this rule: net_accountListenToGamePort = net_accountListenToClientPort + 1 net_chatListenToClientPort = net_accountListenToClientPort + 2 net_gameListenToClientPort = net_accountListenToClientPort + 3 Resolves: Mana-Mantis #216. Reviewed-by: Jaxad0127.
2010-12-15Fix string comparison in map readingJared Adams1-14/+14
2010-12-15Allow names and types in map files to be of any caseJared Adams1-14/+14
Trivial fix, so no review.