CEVENT(CMDBoard, _AbortPost) { Editor* ed = ((EditorAbortedArgs*)args)->editor; BoardPost* post = (BoardPost*)ed->GetArg(); delete post; }
CEVENT(CMDBoard, _ExitPost) { World* world = World::GetPtr(); Editor* ed = ((EditorExitedArgs*)args)->editor; BoardPost* post = (BoardPost*)ed->GetArg(); Player* mobile = (Player*)caller; BoardManager* bmanager = (BoardManager*)world->GetProperty("boards"); Property* prop = NULL; Board* board = NULL; int id = 0; if (!bmanager) { mobile->Message(MSG_ERROR, "Can not access the board system."); return; } prop = mobile->variables.FindProperty("board"); if (!prop) { mobile->Message(MSG_ERROR, "No board set."); return; } id = prop->GetValue().GetInt(); board = bmanager->GetBoardByIndex(id); if (!board) { mobile->Message(MSG_ERROR, "The board you have set does not exist."); return; } board->AddPost(post); }
CEVENT(CMDBoard, _SavePost) { Editor* ed = ((EditorSavedArgs*)args)->editor; BoardPost* post = (BoardPost*)ed->GetArg(); std::vector<std::string>* lines; lines = ed->GetLines(); post->SetMessage(Explode(*lines, "\n")); }