diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-08-08 17:41:49 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-08-08 17:41:49 +0000 |
commit | 32d8ac256193c2caf9fe705b377739bbde541dc8 (patch) | |
tree | 7118dc27e4a4fa1b6860aa6a866bee110ac06a7b /src/map/script.c | |
parent | 83c079bdb0de26af96c2da4155c384663b0e9945 (diff) | |
download | hercules-32d8ac256193c2caf9fe705b377739bbde541dc8.tar.gz hercules-32d8ac256193c2caf9fe705b377739bbde541dc8.tar.bz2 hercules-32d8ac256193c2caf9fe705b377739bbde541dc8.tar.xz hercules-32d8ac256193c2caf9fe705b377739bbde541dc8.zip |
* Cleaned up junk left in the code by the mapcache/mapindex update
- Added mapindex_getmapname(_ext) to help with ".gat" adding/removing
- Moved related processing to the interface (prevents duplicity)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10963 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/src/map/script.c b/src/map/script.c index ec68e2b9f..8412d0019 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9576,42 +9576,33 @@ BUILDIN_FUNC(flagemblem) BUILDIN_FUNC(getcastlename) { - char mapname[MAP_NAME_LENGTH_EXT]; - struct guild_castle *gc; - - strncpy(mapname, script_getstr(st,2), MAP_NAME_LENGTH_EXT); - gc = guild_mapname2gc(mapname); - - if(gc) - script_pushconststr(st,gc->castle_name); - else - script_pushconststr(st,""); + const char* mapname = mapindex_getmapname(script_getstr(st,2),NULL); + struct guild_castle* gc = guild_mapname2gc(mapname); + char* name = (gc) ? gc->castle_name : ""; + script_pushconststr(st,name); return 0; } BUILDIN_FUNC(getcastledata) { - char mapname[MAP_NAME_LENGTH_EXT]; - int index=script_getnum(st,3); - const char *event=NULL; - struct guild_castle *gc; - int i; + const char* mapname = mapindex_getmapname(script_getstr(st,2),NULL); + int index = script_getnum(st,3); - strncpy(mapname, script_getstr(st,2), MAP_NAME_LENGTH_EXT); - gc = guild_mapname2gc(mapname); + struct guild_castle* gc = guild_mapname2gc(mapname); if(script_hasdata(st,4) && index==0 && gc) { - event=script_getstr(st,4); + const char* event = script_getstr(st,4); check_event(st, event); guild_addcastleinfoevent(gc->castle_id,17,event); } if(gc){ switch(index){ - case 0: + case 0: { + int i; for(i=1;i<26;i++) // Initialize[AgitInit] guild_castledataload(gc->castle_id,i); - break; + } break; case 1: script_pushint(st,gc->guild_id); break; case 2: @@ -9659,13 +9650,10 @@ BUILDIN_FUNC(getcastledata) BUILDIN_FUNC(setcastledata) { - char mapname[MAP_NAME_LENGTH_EXT]; int index=script_getnum(st,3); int value=script_getnum(st,4); - struct guild_castle *gc; - - strncpy(mapname, script_getstr(st,2), MAP_NAME_LENGTH_EXT); - gc = guild_mapname2gc(mapname); + + struct guild_castle* gc = guild_mapname2gc( mapindex_getmapname(script_getstr(st,2),NULL) ); if(gc) { // Save Data byself First |