All pastes #976658 Raw Edit

Someone

public text v1 · immutable
·published 2008-04-08 10:40 UTC
rendered paste body
@@ -13953,28 +13993,27 @@
 
 void Player::_SaveActions()
 {
-    for(ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end(); )
+	for(ActionButtonList::iterator itr, next = m_actionButtons.begin(); next != m_actionButtons.end(); )
     {
-        switch (itr->second.uState)
+		itr = next;
+        next++;
+		switch (itr->second.uState)
         {
             case ACTIONBUTTON_NEW:
                 CharacterDatabase.PExecute("INSERT INTO character_action (guid,button,action,type,misc) VALUES ('%u', '%u', '%u', '%u', '%u')",
                     GetGUIDLow(), (uint32)itr->first, (uint32)itr->second.action, (uint32)itr->second.type, (uint32)itr->second.misc );
                 itr->second.uState = ACTIONBUTTON_UNCHANGED;
-                ++itr;
                 break;
             case ACTIONBUTTON_CHANGED:
                 CharacterDatabase.PExecute("UPDATE character_action  SET action = '%u', type = '%u', misc= '%u' WHERE guid= '%u' AND button= '%u' ",
                     (uint32)itr->second.action, (uint32)itr->second.type, (uint32)itr->second.misc, GetGUIDLow(), (uint32)itr->first );
                 itr->second.uState = ACTIONBUTTON_UNCHANGED;
-                ++itr;
                 break;
             case ACTIONBUTTON_DELETED:
                 CharacterDatabase.PExecute("DELETE FROM character_action WHERE guid = '%u' and button = '%u'", GetGUIDLow(), (uint32)itr->first );
                 m_actionButtons.erase(itr++);
                 break;
             default:
-                ++itr;
                 break;
         };
     }
@@ -14555,16 +14594,6 @@