Skip to content
Permalink
Browse files
Fixed a crash from MVP Ladder Warper (#3888)
Fixed a bug where 3 scripts would be running at the same time on the same character.

Fixes #3881

Thanks to @bgamez23
  • Loading branch information
Lemongrass3110 committed Jan 24, 2019
1 parent 6c86492 commit db3267a868c2855da68481c0807f14004c984da7
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/map/script.cpp
@@ -18630,6 +18630,13 @@ BUILDIN_FUNC(awake)
return SCRIPT_CMD_FAILURE;
}

int rid = st->rid;

// No need to keep the player attached if we are going to run other scripts now, where he might get attached
if( rid ){
script_detach_rid(st);
}

iter = db_iterator(st_db);

for (tst = static_cast<script_state *>(dbi_first(iter)); dbi_exists(iter); tst = static_cast<script_state *>(dbi_next(iter))) {
@@ -18646,6 +18653,12 @@ BUILDIN_FUNC(awake)
}
dbi_destroy(iter);

// If a player had been attached, now is the time to restore it
if( rid ){
st->rid = rid;
script_attach_state(st);
}

return SCRIPT_CMD_SUCCESS;
}

0 comments on commit db3267a

Please sign in to comment.