summaryrefslogtreecommitdiff
path: root/src/map/map.c
AgeCommit message (Collapse)AuthorFilesLines
2008-03-13Replaced some foreach-based functions by their inlined iterator equivalents.ultramage1-19/+18
Changed the dynamic mobs system, so that the flag that indicates whether a particular mob can be unloaded is stored in the mob's respawn data structure. Cleaned up related parts of the source code. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12358 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-03-13Fixed one forgotten mob spawning function call causing mobs to duplicate ↵ultramage1-1/+1
when respawning (followup to r12350) (bugreport:1173) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12353 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-03-12Removed one mob data variable related to dynamic mobs that I found to be ↵ultramage1-6/+6
redundant. Changed MAX_MOBSKILL (max. amount of different skill entries per mob) from 50 to 40 to reduce memory consumption a bit more. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12350 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-03-11Replaced clif_countusers() with a more efficient alternative (thanks to the ↵ultramage1-3/+17
fact that pc_db now only holds fully authed players only). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12339 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-27* Removed NODAMAGE and ICEWALL cell types (mem usage back to normal)ultramage1-8/+2
- Icewall now uses basic cell type 5 (nonwalkable, shootable) - as a consequence, you can now warp to a nonwalkable cell - but only via gm command or scripted warp bug (hopefully :) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12247 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-26- Added new settings for autotrade on battle/misc.conf (you can read ↵zephyrus1-0/+2
descriptions there). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12243 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-21- Fixed new guilds displaying online-connect member count at 0 rather than ↵skotlex1-135/+61
1, and the guild master not knowing it is one (eg: it cannot edit the guild notice of a newly created guild until relogging). - Fixed acc_reg2 parsing screwing up the char_id and subtracting 2 from it rather than passing it as it is. - Extended the auth_node/auth_db system in chrif.c to handle log in/out and mapserver-change procedures. This way players are not in the main dbs when they are not "active", which blocks potential invalid accesses to them. - Replaced states auth, waiting_disconnect and finalsave with active. - Cleaned some the party/guild login and creation procedures, removed the party_sent/guild_sent states. - Removed a redundant guild_check_member call which is beyond not-needed and into the realm of wasting resources. - clif_parse will no longer process packets from !sd->state.active players, this also makes checking for finalsave uneccessary (since players re already removed from the maps and dbs by this point, so you can't access them in any other way) - Separated the roles of unit_free and map_quit, the former will handle cleaning structures from the player so it can be free'd safely, while the latter performs additional routines which are unique to characters logging out normally (map-server changes will invoke unit_free and bypass map_quit). - Removed pc_isplaying, quit_db, map_knowsaccount, MAPIT_PCISPLAYING among other functions/defines which are no longer needed due to the new login scheme. - Cleand up a bit some code in the clif_send(_sub) functions. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12223 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-11Getting rid of map_getallusers(), part 1ultramage1-29/+43
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12195 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-07- Fixed Freezing Trap doing no damage (changed type from misc to weapon)skotlex1-15/+9
- Changed suiton's element to water (apparently fixes not being able to use water-based skills on it) - Fixed Landmine doing no damage (decreased trigger range to 0 to match its splash range) - Fixed the disguise commands using the wrong variable when attempting to disguise as an npc. - Fixed a compilation warning on CELL_CHKNODAMAGE (which is a totally bad-ripoff of basilica cells anyway) - Corrected and optimized npc_remove_map's npc array cleanup (@reloadscripts no longer report 'too many npcs per map and related dangling pointer crashes are fixed) - Removed suspicious, yet totally unused npc_data variable 'n' - HP loss item scripts can no longer kill you. - Corrected the item-drop-rate check to avoid duplicate entries in @whodrops after a @reloadmobdb - Cleaned up and optimized map_addnpc (there are never any gaps in the npc array so npc_num always points to the last valid entry) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12180 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-04- Some code cleanups.zephyrus1-0/+6
- Added new Cell types (NoChat and NoDamage) - Added JobChangeLevel and FreeSKPoints to #stats - Added a Crash protection in clif_send with invalid fd values. - Merged a missing update in TK Mission. - Added script command 'getmapflag' - Merged some new Status Change to Stable. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12175 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-03* Added an iterator to map.h/c.FlavioJS1-0/+148
Will be used instead of map_getallusers, which has problems with dangling pointers (returned array isn't updated). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12170 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-02Fixed npc reloading crash (bugreport:889)ultramage1-5/+5
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12166 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-30Added back the GRF_PATH_FILENAME variable and commandline parameter.ultramage1-1/+5
Removed confusing /tool/mapcache/ configuration directory, changed code to use /conf for this purpose. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12154 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-28Fixed a coding mistake I made in r12142.ultramage1-1/+4
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12145 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-26Added an out-of-bounds crashfix for map_delobject and map_delobjectnofree.ultramage1-3/+13
Added missing EOL to the 'hack on namerequest' console message. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12142 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-26Some random cleaningultramage1-41/+18
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12141 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-14* Client packet correctionsultramage1-0/+16
- 0x01df is not 'gmreqnochatcount', but for requesting a player's account name via right-click menu (which currently can't be done) - added /remove and /recall, aliases to /shift and /summon - added /changemaptype, which alters a single cell's gat type - gm kick will no longer exit the client (now it goes to the login screen) - removed the quicksort invocation in /ignore code git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12076 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-06Extended the id range for npcs, now [400,700) will also be treated as NPC ↵ultramage1-1/+1
objects (see topic:170845 and bugreport:727). Silenced a compilation warning. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12025 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-06Modified showmsg code to not attach a timestamp to MSG_NONE-type messages, ↵ultramage1-19/+14
generated by ShowMessage(). It now works exactly like printf(). Removed/replaced all printf calls in the code. Added a new flag to setting 'console_silent', for filtering debug messages. Silenced the "Broken pipe found" and "Server running in debug mode" messages. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12020 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-05Corrected one place belonging to the no-stacking mod that I missed when ↵ultramage1-2/+2
doing the mapcell update (followup to r12003). Added info from newest clients to packet db. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12015 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-04Modified the map_setcell() code to to use a boolean flag instead of needing ↵ultramage1-26/+27
SET_ / CLR_ pairs of defines (topic:174323). Also removed script object 'setcell', added script function 'setcell'. - Now you can manipulate cell information without needing @loadnpc - You can also manipulate the terrain ('gat') type itself, using the new cell_walkable, cell_shootable and cell_water constants (currently the implementation uses bit flags too, so to get the type you want, you need to adjust the flags one by one) - This breaks current scripts, so please adjust places that use setcell (also be sure to _only_ use predefined constants, not direct numbers) - Details can be found in the script reference. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12009 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-03Changes to reduce the number of map cell typesultramage1-11/+0
- Pneuma now again works via status change (see r3969) - removed unused CELL_SAFETYWALL - removed custom CELL_REGEN, it just increased regen rate (r1192, r1518) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12005 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-03Map cell mechanism rewriteultramage1-98/+150
- defined a data structure for map cells (replaces 3 various cell arrays) - both terrain (gat) and dynamic (cell) information is now stored as C-style bit flags instead of #defines and bitmasks - added map_gat2cell() and map_cell2gat() for terrain type conversions - changing terrain information via 'setcell' is temporarily disabled - mapserver startup now takes longer, as it needs to adapt mapcache data to internal representation, cell by cell (new mapcache format anyone?) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12003 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-03Moved extra junk from map_addblock/map_delblock to where it logically ↵ultramage1-35/+18
belongs (loadendack/unit_remove_map), removed flags and _sub macros git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12002 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-03Removed map_data's block_count, as (quote Yor/ja2160), "Perhaps useful for ↵ultramage1-177/+83
debug, but uses memory AND CPU for nothing." (block lists are linked lists, they don't need count tracking) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12001 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-31* Added code to reject double logins in clif_parse_WantToConnection and ↵FlavioJS1-7/+26
added debug messages to detect possible double logins that escaped. * Isolated accounts that are waiting for the quit ack. The rest of the game logic no longer has access to them though the id2sd/charid2sd dbs. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11998 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-27* Corrected description of scope and npc variables in script_commands.txt.FlavioJS1-0/+4
* Made temporary character string variables not have a limited length. (now all temporary string variables don't have limited length) * Made temporary character variables reuse free positions. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11984 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-26Fixed the incorrect interpretation of the map-cell height information stored ↵ultramage1-22/+27
in .gat files; this was causing an overall of 20000 cells to be treated as water when officially they aren't. A full mapcache rebuild is needed to apply this change. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11982 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-26Moved distance-related functions to path.c/hultramage1-46/+0
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11981 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-23- Fixed warning about unused variableskotlex1-2/+1
- Made the kaahi heal timer function uncrashable. - Fixed pc move item to cart function checking against the wrong max index. - Fixed initialization of sd issue in map_addblock - Removed redundant reinitialization when parsing item pickup. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11968 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-22- Corrected mob spawn utilization of the delay1/delay2 values (one is ↵skotlex1-9/+13
respawn delay base, the second is random variance added on top of it). Cleaned up related code. - Changed abit map_add_block to prevent adding a player object which is invalid (not authed, waiting to be disconnected) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11964 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-22Path code cleaning...ultramage1-9/+8
* Added map/path.h, moved path-related function headers to path.h. * Removed the macroed _real() path functions. * Modified some functions to use boolean return values instead of 1/0 or 0/-1. * Modified path_search_long() to allow a NULL output pointer (in which case a temporary local buffer will be used instead). * Removed an unused ->path_half member variable from struct walkpath_data. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11958 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-18- Cleaned up a bit the format of skill_db.txt (that comma next to the skill ↵skotlex1-4/+18
name looks ugly if you ask me) - Corrected skill_db reading to properly trim the skill name/descs. - Added a mobid_db in map.c to handle mob lookups faster. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11943 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-14Guardian hp handling code removal (see bugreport:342)ultramage1-0/+6
- removed guardian hp from the castle data structure, database, savefiles and various script functions (use upgrade_svn11914.sql) - removed guardian hp calculation and manipulation from the castle manager npc, now the hp values are updated by the server itself (glitch: when castle defense changes, all guardians are healed to full) - tweaked script function 'guardianinfo' to provide some data needed by the manager npc (currently available are hp, maxhp and visibility); also, it doesn't need a player attached to execute anymore The whole thing is experimental, use at your own risk (seems to work though...) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11915 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-07- Insignificant cleanups.skotlex1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11866 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-06- The default event script behaviour is to trigger on labels rather than ↵skotlex1-2/+1
NPCs now. - Removed several script config options which break NPC compatibility when you mess with them (event_script_type, event_requires_trigger, die_event_name, kill_pc_event_name, kill_mob_event_name, logout_event_name, login_event_name, loadmap_event_name, baselvup_event_name, joblvup_event_name) - LoadMap events no longer set the variable "@maploaded$" to the name of the new map. - Optimized/simplified the code now that the previous config options were removed. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11859 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-22- Changed the status_change structure to use dynamic rather than static ↵skotlex1-12/+13
memory to hold the individual status changes, this should have a noticeable impact on the server's memory consumption. - Had to add a few 'ugly' flags to status_change since now you can't track SC related information while said SC is not active (happens only for Storm Gust, Joint Beat and Magic Power). - Since I am unable to fully test, watch out for any bugs~ git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11786 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-21- Moved subtype from struct block_list to struct npc_data.skotlex1-1/+1
- Fixed some compilation warnings. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11772 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-17Removed battle_config.error_log as console_silent already handles thisultramage1-48/+23
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11751 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-15Added error messages when trying to place objects on invalid map coordinates ↵ultramage1-4/+10
(quick patch for bugreport:419) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11737 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-13Added error reporting for invalid rows in skill db files.ultramage1-1/+0
Fixed skill_castnodex_db.txt not being parsed correctly. Fixed a search&replace typo in skill_db.txt. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11728 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-11- Added missing include npc.h to map.cskotlex1-0/+1
- Now when job changing to another class tree, status changes from skills that belong to your previous class are cleared. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11716 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-11Fixed a missing include/export, and typos in the previous revision.ultramage1-2/+3
Corrected wrong length values in one charserver packet. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11714 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-11- Cleaned up pc_calc_weapontypeskotlex1-2/+5
- made on-touch areas work with walking npcs. Note that the implementation is performance may not be optimal, but I am not sure if it can be done in any better way. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11713 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-09* Re-worked the login-char-map packet spam mechanismultramage1-8/+3
- mapserver no longer sends entire user list to charserver every 10 seconds; similar change done to the char-login connection - user count updates are only sent when the value actually changes instead of servers polling each other every few seconds - the servers now prevent interserver connection timeout explicitly by sending ping/ack packet pairs instead of relying on the usercount polling to do so; keepalive is sent every 'stall_time'-2 seconds - removed the @refreshonline command as refresh happens automatically every 5 seconds git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11703 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-08* Changed EXIT_SUCCESS back to 0 in console.c to avoid an unnecessary include.FlavioJS1-10/+10
* Fixed gm_account_db not being deallocated in login-converter.c. * Refactoring names and documentation in db.h/db.c: - changed 'struct dbt' to 'struct DBMap' and 'DB' to 'DBMap*' - changed 'struct db' to 'struct DBMap_impl' and 'DB_impl' to 'DBMap_impl*' - changed COUNT to DB_COUNTSTAT and made it's existence not depend on DB_ENABLE_STATS - removed some @see links and corrected small typos in the documentation git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11698 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-03Added script function 'strnpcinfo', for increased npc awareness (originally ↵ultramage1-0/+6
from jAthena). Updated script reference doc. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11650 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-29Command code cleaning (refer to topic:169759)ultramage1-1/+1
* separated the execution part of command code into interface part and internal part to better see which checks are done and when (fixes problem where 'nocommand' mapflag blocked server npcs) * moved the internal commands list (array) to the end of the file, this let me discard that long block of ACMD_FUNC() declarations * removed enum AtCommandType from command headers and commands array; its purpose was perhaps to identify aliased commands, but apparently it was never finished because the rest of the code doesn't use it (also doing aliases like this is not a very good idea) * internally, commands are now referenced to using their function name * removed the @/# symbols from the command lists; all lookup functions will now properly deal with strings with- and without a command symbol (commands interface still requires the symbol tho', so TODO for later) * removed several unneeded commands (*id2 code, dmalloc debug commands) * reverted atcommand config from alphabetically-sorted to how it was before (with additional fixes; see /conf changelog) * added missing code for #dropall / #storeall * added a warning when trying to set gm level of an undefined command The structure of the commands table has changed, please adjust docs/guides to match the new format (sorry for the inconvenience). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11607 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-26* Removed confusing map_nick2sd_nocase(), let the charserver handle itultramage1-15/+0
* Added correct packet for attachment retrieval failure when overweight * Fixed one more mistake in r11571 (Sql->SqlStmt) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11579 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-24- added defines JOB_MAX_BASIC and JOB_MAX to mmo.h so the code can know ↵skotlex1-0/+4
which are the max valid classes. - @/#jobchange no longer strip your equipment since pc_jobchange removes any unequippables already. - removed the wasteful define MAX_PC_CLASS and replaced it by the CLASS_COUNT define (which is automatically updated using the previous JOB_MAX* defines) + pc_class2idx function (which converts high class IDs into values that fit in CLASS_COUNT) - Made status_charge a function rather than a define to get rid of those warnings that have been there since forever. - Merged the CELL_NOVENDING code (see topic #129209) - Small check that disables the pet catching process if you try to use another item. - Added a check to fix a warning and prevent a crash in the npc duplicate check (even though I have no idea what this check is supposed to do, therefore I can't fix it properly other than to avoid the crash) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11572 54d463be-8e91-2dee-dedb-b68131a5f0ec