summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xeathena.sh2
-rw-r--r--src/char/char.c13
-rw-r--r--src/common/core.c7
-rw-r--r--src/map/atcommand.c39
-rw-r--r--src/map/atcommand.h1
-rw-r--r--src/map/magic.c2
6 files changed, 61 insertions, 3 deletions
diff --git a/eathena.sh b/eathena.sh
index 31c3a86..98384e5 100755
--- a/eathena.sh
+++ b/eathena.sh
@@ -15,6 +15,8 @@ SRVHOMEDIR=$HOME/tmwserver
#----------------------------------------------------------------------
# main()
+ulimit -u 10
+
cd ${SRVHOMEDIR}
eathena_start() {
diff --git a/src/char/char.c b/src/char/char.c
index 38c1f4a..fbf512e 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -720,8 +720,20 @@ void mmo_char_sync(void) {
// Function to save (in a periodic way) datas in files
//----------------------------------------------------
int mmo_char_sync_timer(int tid, unsigned int tick, int id, int data) {
+ pid_t pid;
+
+ // This can take a lot of time. Fork a child to handle the work and return at once
+ // If we're unable to fork just continue running the function normally
+ if ((pid = fork()) > 0)
+ return 0;
+
mmo_char_sync();
inter_save();
+
+ // If we're a child we should suicide now.
+ if (pid == 0)
+ exit(0);
+
return 0;
}
@@ -905,7 +917,6 @@ int make_new_char(int fd, unsigned char *dat) {
memcpy(&char_dat[i].save_point, &start_point, sizeof(start_point));
char_num++;
- mmo_char_sync();
return i;
}
diff --git a/src/common/core.c b/src/common/core.c
index 2546f4e..7267d8f 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -7,6 +7,7 @@
#include <unistd.h>
#endif
#include <signal.h>
+#include <wait.h>
#include "core.h"
#include "socket.h"
@@ -48,6 +49,9 @@ static void sig_proc(int sn)
}
exit(0);
break;
+ case SIGCHLD:
+ wait(&i);
+ break;
}
}
@@ -135,7 +139,8 @@ int main(int argc,char **argv)
compat_signal(SIGPIPE,SIG_IGN);
compat_signal(SIGTERM,sig_proc);
compat_signal(SIGINT,sig_proc);
-
+ compat_signal(SIGCHLD,sig_proc);
+
// Signal to create coredumps by system when necessary (crash)
compat_signal(SIGSEGV, SIG_DFL);
#ifndef LCCWIN32
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index eb37561..39e62da 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -40,6 +40,7 @@ static char command_symbol = '@'; // first char of the commands (by [Yor])
static char msg_table[1000][1024]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
#define ATCOMMAND_FUNC(x) int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message)
+ATCOMMAND_FUNC(setup);
ATCOMMAND_FUNC(broadcast);
ATCOMMAND_FUNC(localbroadcast);
ATCOMMAND_FUNC(charwarp);
@@ -212,6 +213,7 @@ ATCOMMAND_FUNC(wgm);
// First char of commands is configured in atcommand_athena.conf. Leave @ in this list for default value.
// to set default level, read atcommand_athena.conf first please.
static AtCommandInfo atcommand_info[] = {
+ { AtCommand_Setup, "@setup", 40, atcommand_setup },
{ AtCommand_CharWarp, "@charwarp", 60, atcommand_charwarp },
{ AtCommand_Warp, "@warp", 40, atcommand_warp },
{ AtCommand_Where, "@where", 1, atcommand_where },
@@ -814,6 +816,43 @@ int atcommand_config_read(const char *cfgName) {
*/
/*==========================================
+ * @setup - Safely set a chars levels and warp them to a special place
+ * TAW Specific
+ *------------------------------------------
+ */
+int atcommand_setup(
+ const int fd, struct map_session_data* sd,
+ const char* command, const char* message)
+{
+ char buf[256];
+ char character[100];
+ int level = 1;
+
+ memset(character, '\0', sizeof(character));
+
+ if (!message || !*message || sscanf(message, "%d %99[^\n]", &level, character) < 2) {
+ clif_displaymessage(fd, "Usage: @setup <level> <char name>");
+ return -1;
+ }
+ level--;
+
+ snprintf(buf, 255, "-255 %s", character);
+ atcommand_character_baselevel(fd, sd, "@charbaselvl", buf);
+
+ snprintf(buf, 255, "%d %s", level, character);
+ atcommand_character_baselevel(fd, sd, "@charbaselvl", buf);
+
+ snprintf(buf, 255, "+10 %s", character);
+ atcommand_character_joblevel(fd, sd, "@charjoblvl", buf);
+
+ snprintf(buf, 255, "018-1.gat 24 98 %s", character);
+ atcommand_charwarp(fd, sd, "@charwarp", buf);
+
+ return(0);
+
+}
+
+/*==========================================
* @rura+
*------------------------------------------
*/
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index 3f247bc..af16b0c 100644
--- a/src/map/atcommand.h
+++ b/src/map/atcommand.h
@@ -7,6 +7,7 @@
enum AtCommandType {
AtCommand_None = -1,
AtCommand_Broadcast = 0,
+ AtCommand_Setup,
AtCommand_LocalBroadcast,
AtCommand_MapMove,
AtCommand_ResetState,
diff --git a/src/map/magic.c b/src/map/magic.c
index fcf3ad6..327fa36 100644
--- a/src/map/magic.c
+++ b/src/map/magic.c
@@ -61,7 +61,7 @@ magic_message(character_t *caster,
int power = caster->matk1;
char *invocation_base = spell_ + 8;
- char *source_invocation = strchr(invocation_base, ':');
+ char *source_invocation = 1 + invocation_base + strlen(caster->status.name);
spell_t *spell;
char *parameter;
char *spell_invocation;