Mercurial > otakunoraifu
diff scn2k/scn2k_impl.cc @ 52:15a18fbe6f21
* Known bugs added to the README
* Code cleaning (0 -> NULL when needed, indentation, spaces, ...)
author | thib |
---|---|
date | Sat, 18 Apr 2009 18:35:39 +0000 |
parents | 35ce1a30f3f9 |
children | ddbcbd000206 |
line wrap: on
line diff
--- a/scn2k/scn2k_impl.cc +++ b/scn2k/scn2k_impl.cc @@ -26,11 +26,11 @@ */ #include <stdexcept> -#include"scn2k_impl.h" -#include"system/file.h" -#include"system/system_config.h" -#include"window/picture.h" -#include"window/system.h" +#include "scn2k_impl.h" +#include "system/file.h" +#include "system/system_config.h" +#include "window/picture.h" +#include "window/system.h" // #define DEBUG 1 @@ -56,13 +56,13 @@ Scn2k::Scn2k(Event::Container& _event, P system_version = 0; skip_mode = SKIP_NO; - script_start = 0; - script = 0; - script_end = 0; + script_start = NULL; + script = NULL; + script_end = NULL; backlog_script_scn = -1; - backlog_script_start = 0; - backlog_script_end = 0; + backlog_script_start = NULL; + backlog_script_end = NULL; save_scn = 0; save_point = 0; @@ -70,14 +70,14 @@ Scn2k::Scn2k(Event::Container& _event, P scn_point = 0; cmd_stack_str = cmd_stack_str_orig; - dialog = 0; + dialog = NULL; dialog_type = CMD_NOP; - menu = 0; + menu = NULL; menu_mouseshown = false; /* マウスカーソルを作成 */ mouse_type = 0; - mouse_surface = 0; + mouse_surface = NULL; mouse_pressed = 0; ShowCursor(); @@ -101,7 +101,7 @@ char* Scn2k::OpenScript(int new_scn_numb sprintf(fname, "SEEN%04d.TXT", new_scn_number); ARCINFO* info = file_searcher.Find(FILESEARCH::SCN, fname, ""); - if (info == 0) goto err; + if (info == NULL) goto err; data = info->Read(); /* version 確認 */ @@ -141,15 +141,16 @@ err: return false; } + bool Scn2k::ChangeScript(int new_scn_number, int call_no) { int old_scn_number = scn_number; int old_scn_pt = script - script_start; int scn_pt = 0; if (script_start) delete[] script_start; - script_start = 0; - script = 0; - script_end = 0; + script_start = NULL; + script = NULL; + script_end = NULL; int call_vec[100]; @@ -176,9 +177,10 @@ bool Scn2k::ChangeScript(int new_scn_num fprintf(stderr,"scn %d pt %d: Cannot jump to %d:%d; fall back to the top\n",old_scn_number, old_scn_pt, scn_number, scn_pt); return true; } + bool Scn2k::ReadCmdAt(Cmd& cmd, int scn, int pt) { const char* d; - if (scn ==scn_number) { + if (scn == scn_number) { d = script_start + pt; if (d < script_start || d >= script_end) { fprintf(stderr,"Cannot read script at current scn %d pt %d\n", scn, pt); @@ -205,7 +207,7 @@ extern bool pressAreq; void Scn2k::Elapsed(unsigned int current_time) { SetWakeup(current_time + 10); // 10msに一回シナリオスクリプト解釈 - if (script == 0) return; + if (script == NULL) return; //VarInfo info; info.type = 6; info.number = 0; // PB の「一回ゲームを開始したことがある」フラグ //flag.Set(info,1); //info.type = 0; info.number = 604; // Princess Bride: クリア対象設定フラグ (聖) @@ -276,7 +278,8 @@ if (0) { fprintf(stderr,"%d / %d : 0x23 - cmd %02x-%02x:%04x:%02x[%2d] \n", scn_point, script_end-script_start, cmd.cmd1,cmd.cmd2,cmd.cmd3,cmd.cmd4,cmd.argc); - int i; for (i=0; i<cmd.args.size(); i++) { + int i; + for (i = 0; i<cmd.args.size(); i++) { if (i == 0) fprintf(stderr,"\t"); VarInfo info = cmd.args[i]; if (info.type == TYPE_STR || info.type == TYPE_VARSTR) @@ -307,7 +310,7 @@ if (0) { // fprintf(stderr,"\nlocal call %d:%d from %d\n",scn_number,cmd.args[0].value,scn_pt); stack.push_back(StackItem(-1, scn_pt)); } -if (cmd.cmd1 == 0 && cmd.cmd2 == 1 && cmd.cmd3 == 1) { +if (cmd.cmd1 == 0 && cmd.cmd2 == 1 && cmd.cmd3 == 1) {//TODO fprintf(stderr,"*** unsupported: cond 1\n"); } script = script_start + cmd.args[0].value; @@ -344,6 +347,7 @@ fprintf(stderr," -> fall back to %d\n",s } break; } + if (cmd.cmd_type == CMD_NOP) continue; if (cmd.cmd_type == CMD_TEXT && cmd.pos != -1) { @@ -366,7 +370,8 @@ fprintf(stderr," -> fall back to %d\n",s fprintf(stderr,"%d-%d / %d : unsupported command; 0x23 - cmd %02x-%02x:%04x:%02x[%2d] \n", cmd.scn, script - script_start, script_end-script_start, cmd.cmd1,cmd.cmd2,cmd.cmd3,cmd.cmd4,cmd.argc); - int i; for (i=0; i<cmd.args.size(); i++) { + int i; + for (i = 0; i<cmd.args.size(); i++) { if (i == 0) fprintf(stderr,"\t"); VarInfo info = cmd.args[i]; if (info.type == TYPE_STR || info.type == TYPE_VARSTR) @@ -379,7 +384,6 @@ fprintf(stderr," -> fall back to %d\n",s cmd.clear(); } } - return; } void Scn2k::ShowCursor(void) { @@ -387,11 +391,11 @@ void Scn2k::ShowCursor(void) { char key[1024]; sprintf(key, "#MOUSE_CURSOR.%03d.NAME",mouse_type); const char* name = config.GetParaStr(key); - if (name == 0 || name[0] == 0) mouse_surface = DEFAULT_MOUSECURSOR; + if (name == NULL || name[0] == 0) mouse_surface = DEFAULT_MOUSECURSOR; else { mouse_surface = parent.Root().NewSurface(name, COLOR_MASK); } - if (mouse_surface == 0) mouse_surface = DEFAULT_MOUSECURSOR; + if (mouse_surface == NULL) mouse_surface = DEFAULT_MOUSECURSOR; System::Main::SetCursor(mouse_surface, Rect(8, 8, 8+32, 8+32)); } @@ -400,18 +404,16 @@ void Scn2k::HideCursor(void) { System::Main::SetCursor(0, Rect(0,0)); if (mouse_surface != DEFAULT_MOUSECURSOR) parent.Root().DeleteSurface(mouse_surface); - mouse_surface = 0; + mouse_surface = NULL; } - return; } bool Scn2k::SysWait(Cmd& cmd) { - if (menu) { menu->Exec(cmd); - if (menu->status & Scn2kMenu::MENU_DELETE || menu->pimpl == 0) { + if (menu->status & Scn2kMenu::MENU_DELETE || menu->pimpl == NULL) { delete menu; - menu = 0; + menu = NULL; if (! menu_mouseshown) HideCursor(); else ShowCursor(); SetSkipMode(SkipMode(skip_mode & (~SKIP_IN_MENU) )); @@ -700,7 +702,7 @@ void Scn2k::SysExec(Cmd& cmd) { } } else if (cmd.cmd1 == 2 && cmd.cmd2 == 1 && cmd.cmd3 == 12) { // DLL Call const char* regname = config.GetParaStr("#REGNAME"); - const char key_lb[] = "KEY\\LittleBusters"; + const char key_lb[] = "KEY\\LittleBusters";//FIXME: too specific to be here? if (strcmp(regname, key_lb) == 0) { DllCall_LB(cmd, flag); cmd.clear(); @@ -715,10 +717,10 @@ void Scn2k::SysExec(Cmd& cmd) { } else if (cmd.cmd1 == 1 && cmd.cmd2 == 0x04) { if (cmd.cmd3 == 0 && cmd.cmd4 == 0) { // タイトル名設定 const char* name = cmd.Str(cmd.args[0]); - if (name == 0) name = ""; + if (name == NULL) name = ""; window_title = name; const char* config_name = config.GetParaStr("#CAPTION"); - if (config_name == 0) config_name = ""; + if (config_name == NULL) config_name = ""; string setname = kconv(string(config_name) + " " + window_title); parent.Root().SetWindowCaption(setname.c_str()); cmd.clear(); @@ -751,7 +753,7 @@ void Scn2k::SysExec(Cmd& cmd) { cmd.clear(); } else if (cmd.cmd3 == 0x4b0) { // 終了 System::Main::Quit(); - //script = 0; script_start = 0; script_end = 0; + //script = NULL; script_start = NULL; script_end = NULL; cmd.clear(); cmd.cmd_type = CMD_WAITFRAMEUPDATE; } else if (cmd.cmd3 == 0x4b4 || cmd.cmd3 == 0x4b5) { // 選択肢巻き戻し @@ -824,10 +826,10 @@ fprintf(stderr,"StatSave %d:",cmd.args[0 } -#include<sys/types.h> -#include<sys/stat.h> -#include<errno.h> -#include<unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#include <unistd.h> // セーブファイルの名前をつくる string Scn2k::MakeSaveFile(void) const { @@ -836,7 +838,7 @@ string Scn2k::MakeSaveFile(void) const { if (dir.c_str()[0] == '~' && dir.c_str()[1] == '/') { char* home = getenv("HOME"); - if (home != 0) { + if (home != NULL) { string new_dir = string(home) + (dir.c_str()+1); dir = new_dir; } @@ -871,6 +873,7 @@ string Scn2k::MakeSaveFile(void) const { delete[] fname; return dir; } + // セーブファイルの名前をつくる string Scn2kSaveTitle::operator() (int number) const { int y,m,d,wd,h,min,sec,msec; @@ -882,14 +885,15 @@ string Scn2kSaveTitle::operator() (int n sprintf(buf, "%2d/%2d %2d:%2d ",m,d,h,min); return string(buf) + title; } -}; +} void Scn2k::SaveSys(void) { char buf[1024]; string save; string path = MakeSaveFile(); - sprintf(buf, "KEY=%s\n", config.GetParaStr("#REGNAME")); save += buf; + sprintf(buf, "KEY=%s\n", config.GetParaStr("#REGNAME")); + save += buf; string save_config; config.DiffOriginal(save_config); save += "CONFIG="; @@ -917,7 +921,7 @@ void Scn2k::SaveSys(void) { path += ".0"; FILE* f = fopen(path.c_str(), "w"); - if (f == 0) { + if (f == NULL) { fprintf(stderr,"Cannot open save file %s\n",path.c_str()); return; } @@ -931,12 +935,12 @@ void Scn2k::LoadSys(void) { string path = MakeSaveFile(); path += ".0"; FILE* f = fopen(path.c_str(), "r"); - if (f == 0) { + if (f == NULL) { fprintf(stderr, "Cannot open save file %s\n",path.c_str()); } else { - fseek(f,0,2); + fseek(f, 0, SEEK_END); int sz = ftell(f); - fseek(f,0,0); + fseek(f, 0, SEEK_SET); char* savedata = new char[sz+1]; fread(savedata, sz, 1, f); savedata[sz] = 0; @@ -1027,7 +1031,7 @@ bool Scn2k::StatSaveFile(int num, int& y msec = 0; /* タイトルの取得 */ FILE* savefile = fopen(path.c_str(), "rb"); - if (savefile == 0) return false; + if (savefile == NULL) return false; char regname[1024]; sprintf(regname, "KEY=%s\n", config.GetParaStr("#REGNAME")); fgets(buf,1000,savefile); @@ -1090,7 +1094,7 @@ void Scn2k::LoadRollback(Cmd& cmd) { void Scn2k::Save(Cmd& cmd) { if (cmd.cmd_type == CMD_SAVEREQ) { - if (menu == 0) { + if (menu == NULL) { SetSkipMode(SKIP_IN_MENU); // テキストスキップ等はここで中断 menu = new Scn2kMenu(Scn2kMenu::MENU_SAVE, *this, flag, text_exec, system_version); menu->InitPanel(event, parent); @@ -1103,7 +1107,7 @@ void Scn2k::Save(Cmd& cmd) { } char buf[1024]; string save; - FILE* f = 0; + FILE* f = NULL; if (save_scn == 0) { fprintf(stderr,"Cannot decide save point\n"); return; // セーブ位置が保存されてない @@ -1138,7 +1142,7 @@ void Scn2k::Save(Cmd& cmd) { } f = fopen(path.c_str(), "w"); - if (f == 0) { + if (f == NULL) { fprintf(stderr,"Cannot open save file %s\n",path.c_str()); return; } @@ -1146,12 +1150,11 @@ void Scn2k::Save(Cmd& cmd) { fclose(f); config.SetParam("#LASTSAVE", 1, file_number); cmd.clear(); - return; } void Scn2k::Load(Cmd& cmd) { if (cmd.cmd_type == CMD_LOADREQ) { - if (menu == 0) { + if (menu == NULL) { menu = new Scn2kMenu(Scn2kMenu::MENU_LOAD, *this, flag, text_exec, system_version); menu->InitPanel(event, parent); menu->InitTitle(Scn2kSaveTitle(*this)); @@ -1169,16 +1172,16 @@ void Scn2k::Load(Cmd& cmd) { file_number = cmd.args[0].value + 1; sprintf(buf, ".%d",file_number); path += buf; - FILE* f = 0; + FILE* f = NULL; if (file_number > 0) f = fopen(path.c_str(), "r"); - if (f == 0) { + if (f == NULL) { fprintf(stderr, "Cannot open save file %s\n",path.c_str()); return; } - fseek(f,0,2); + fseek(f, 0, SEEK_END); int sz = ftell(f); - fseek(f,0,0); + fseek(f, 0, SEEK_SET); char* savedata = new char[sz+1]; fread(savedata, sz, 1, f); savedata[sz] = 0; @@ -1197,10 +1200,10 @@ void Scn2k::Load(Cmd& cmd) { rollback_save.clear(); new_rollback_save = ""; char* rollback_data = savedata; - while( (rollback_data = strstr(rollback_data,"[Rollback Data]\n")) != 0) { + while( (rollback_data = strstr(rollback_data,"[Rollback Data]\n")) != NULL) { rollback_data += strlen("[Rollback Data]\n"); char* rollback_end = strstr(rollback_data, "[Rollback End]\n"); - if (rollback_end == 0) rollback_end = rollback_data + strlen(rollback_data); + if (rollback_end == NULL) rollback_end = rollback_data + strlen(rollback_data); string s(rollback_data, rollback_end); rollback_save.push_back(s); rollback_data = rollback_end; @@ -1219,7 +1222,6 @@ void Scn2k::Load(Cmd& cmd) { cmd.clear(); delete[] savedata; - return; } void Scn2k::SaveImpl(string& save) { @@ -1261,7 +1263,7 @@ void Scn2k::LoadImpl(const char* save) { cmd_stack_str = cmd_stack_str_orig; save = strstr(save, "\n[SCENARIO]\n"); - if (save == 0) return; + if (save == NULL) return; save += strlen("\n[SCENARIO]\n"); while(save[0] != 0 && save[0] != '[') { // while next section start if (strncmp(save, "Scn=", 4) == 0) { @@ -1271,10 +1273,10 @@ void Scn2k::LoadImpl(const char* save) { } else if (strncmp(save, "Title=", 6) == 0) { save += 6; char* s = strchr(save, '\n'); - if (s == 0) window_title = save; + if (s == NULL) window_title = save; else window_title.assign(save, s-save); const char* config_name = config.GetParaStr("#CAPTION"); - if (config_name == 0) config_name = ""; + if (config_name == NULL) config_name = ""; string setname = kconv(string(config_name)+" "+window_title); parent.Root().SetWindowCaption(setname.c_str()); } else if (strncmp(save, "MouseType=", 10) == 0) { @@ -1291,7 +1293,7 @@ void Scn2k::LoadImpl(const char* save) { } else if (strncmp(save, "StackStr=", 9) == 0) { save += 9; char* s = strchr(save, '\n'); - if (s == 0) stack_strbuffer.push_back(""); + if (s == NULL) stack_strbuffer.push_back(""); else stack_strbuffer.push_back(string(save, s-save)); } else if (strncmp(save, "Cmd=", 4) == 0) { CmdSimplified cmd; @@ -1304,12 +1306,12 @@ void Scn2k::LoadImpl(const char* save) { cmd_stack.push_back(cmd); } save = strchr(save, '\n'); - if (save != 0) save++; + if (save != NULL) save++; } ChangeScript(save_scn, 0); script = script_start + save_point; - return; } + void Scn2k::SetSkipMode(SkipMode mode) { if (skip_mode != mode) { skip_mode = mode; @@ -1349,12 +1351,14 @@ void DLLCall_LB_EF00_0(Cmd& cmd, Flags& flags) { // エフェクトの設定 } } if (cmd.args[5].value != 1) return; -static int random_dirtable[] = { + + static int random_dirtable[] = { 0, 2, 1, 3, 0, 2, 1, 3, 1, 3, 2, 0, 1, 3, 2, 0, 0, 0, 0, 0, 3, 1, 2, 0, 3, 1, 3, 1, 0, 2, 3, 1 }; + int* dir = &random_dirtable[(random()&3) * 8]; for (i=0; i<8; i++) { double* param = lb_ef_param + i*0x60; @@ -1394,6 +1398,7 @@ static int random_dirtable[] = { } return; } + void DLLCall_LB_EF00_1(Cmd& cmd, Flags& flags) { // 計算を行う if (lb_ef_param == 0) { fprintf(stderr,"Warning : DLLCall_LB_EF00_1 : Script error : effect calculation was called before setting\n"); @@ -1457,8 +1462,8 @@ void DllCall_LB(Cmd& cmd, Flags& flags) { // リトルバスターズ!の EF00.dll をエミュレート ** */ -#include"window/widget.h" -#include"window/menuitem.h" +#include "window/widget.h" +#include "window/menuitem.h" void DSurfaceFill(Surface* src, const Rect& rect, int r, int g, int b, int a = 0xff); @@ -1473,13 +1478,13 @@ struct Scn2kMenuImpl { virtual void Cancel(void) = 0; virtual void Exec(Cmd& cmd) = 0; Scn2kMenuImpl(Scn2kMenu& _interface) : interface(_interface) { - menu = 0; - pevent = 0; - pparent = 0; + menu = NULL; + pevent = NULL; + pparent = NULL; } virtual ~Scn2kMenuImpl() { if (menu) delete menu; - menu = 0; + menu = NULL; } }; @@ -1509,13 +1514,13 @@ struct LoadMenu : Scn2kMenuImpl { void PressOk(void); }; LoadMenu::LoadMenu(Scn2kMenu& _interface) : Scn2kMenuImpl(_interface) { - btn_local = 0; - btn_scale = 0; - btn_set = 0; + btn_local = NULL; + btn_scale = NULL; + btn_set = NULL; btn_page_val = 0; btn_set_val = -1; btn_local_val = -1; - awk_dialog = 0; + awk_dialog = NULL; in_setpage = false; select_page = 0; select_value = -1; @@ -1528,7 +1533,7 @@ void LoadMenu::InitPanel(Event::Containe pparent = &parent; if (menu) delete menu; - menu = 0; + menu = NULL; menu = new MenuItem(&parent, Rect(80,30,560, 450), 1, 3, 0); Surface* surface = parent.Root().NewSurface(menu->Pic()->Width(), menu->Pic()->Height(), ALPHA_MASK); if (interface.type == Scn2kMenu::MENU_LOAD) { @@ -1674,16 +1679,16 @@ void LoadMenu::SetPage(int new_page) { btn_local->item[i]->Pic()->Move(old_x, i*30-new_point*3); } } - if (btn_page) { + if (btn_page != NULL) { if (select_page%100 == 0) btn_page->SetValue(select_page/100); else btn_page->SetValue(-1); } - if (btn_scale) { + if (btn_scale != NULL) { btn_scale->SetValue(select_page); } in_setpage = false; - return; } + void LoadMenu::SetValue(int new_value) { if (in_setpage) return; in_setpage = true; @@ -1706,8 +1711,8 @@ void LoadMenu::SetValue(int new_value) { } in_setpage = false; - return; } + void LoadMenu::PressOk(void) { if (select_value == -1) { btn_set->SetValue(-1); // なにもしない @@ -1732,26 +1737,31 @@ void LoadMenu::PressOk(void) { } } } + void LoadMenu::Cancel(void) { - if (awk_dialog) { // ダイアログのキャンセル + if (awk_dialog != NULL) { // ダイアログのキャンセル awk_dialog->status = Dialog::CANCEL; ChangeDialog(this, awk_dialog); } else { // 一般キャンセル btn_set->SetValue(1); } } + void LoadMenu::Exec(Cmd& cmd) { } + void LoadMenu::ChangeBtnPage(void* pointer, MenuItem* widget) { LoadMenu* instance = (LoadMenu*)pointer; if (instance->btn_page_val == -1) return; instance->SetPage(instance->btn_page_val*100); } + void LoadMenu::ChangeBtnScale(void* pointer, Scale* from) { LoadMenu* instance = (LoadMenu*)pointer; int value = from->GetValue(); instance->SetPage(value); } + void LoadMenu::ChangeBtnSet(void* pointer, MenuItem* widget) { LoadMenu* instance = (LoadMenu*)pointer; if (instance->btn_set_val == 1) { // cancel @@ -1761,12 +1771,13 @@ void LoadMenu::ChangeBtnSet(void* pointe instance->PressOk(); } } + void LoadMenu::ChangeDialog(void* pointer, Dialog* widget) { LoadMenu* instance = (LoadMenu*)pointer; if (widget->status == Dialog::CANCEL) { // ダイアログ消去、OK ボタン復帰 delete instance->awk_dialog; - instance->awk_dialog = 0; + instance->awk_dialog = NULL; instance->menu->activate(); instance->btn_set->SetValue(-1); return; @@ -1775,6 +1786,7 @@ void LoadMenu::ChangeDialog(void* pointe return; } } + void LoadMenu::ChangeBtnLocal(void* pointer, MenuItem* widget) { LoadMenu* instance = (LoadMenu*)pointer; if (instance->btn_local_val == -1) return; @@ -1793,21 +1805,26 @@ struct BacklogMenu : Scn2kMenuImpl { void Cancel(void); void Exec(Cmd& cmd); }; + BacklogMenu::BacklogMenu(Scn2kMenu& _interface, Scn2k& _scn, Text& parent_text_exec) : Scn2kMenuImpl(_interface), scn_impl(_scn), text_exec(parent_text_exec) { backlog_cnt = -1; backlog_update = false; } + BacklogMenu::~BacklogMenu() { } + void BacklogMenu::InitPanel(Event::Container& event, PicContainer& parent) { pevent = &event; } void BacklogMenu::InitTitle(const SaveTitle& title_op) { } + void BacklogMenu::Cancel(void) { interface.status = Scn2kMenu::MenuStatus(Scn2kMenu::MENU_DELETE); } + void BacklogMenu::Exec(Cmd& cmd) { int command_direction = 0; // forward if (cmd.cmd_type == CMD_NOP) text_exec.Wait(0xffffffffUL, cmd); @@ -1874,7 +1891,7 @@ retry: Scn2kMenu::Scn2kMenu(MenuType _type, Scn2k& scn_impl, const Flags& flags, Text& text_exec, int system_version) : cmd(flags, system_version), type(_type) { - pimpl = 0; + pimpl = NULL; status = MENU_CONTINUE; switch(type) { case MENU_LOAD: pimpl = new LoadMenu(*this); break; @@ -1885,19 +1902,23 @@ Scn2kMenu::Scn2kMenu(MenuType _type, Scn } Scn2kMenu::~Scn2kMenu() { if (pimpl) delete pimpl; - pimpl = 0; + pimpl = NULL; } + void Scn2kMenu::InitPanel(Event::Container& event, PicContainer& parent) { - if (pimpl) pimpl->InitPanel(event, parent); + if (pimpl != NULL) pimpl->InitPanel(event, parent); } + void Scn2kMenu::InitTitle(const SaveTitle& t) { - if (pimpl) pimpl->InitTitle(t); + if (pimpl != NULL) pimpl->InitTitle(t); } + void Scn2kMenu::Cancel(void) { if (pimpl) pimpl->Cancel(); } + void Scn2kMenu::Exec(Cmd& ret_cmd) { - if (pimpl == 0) return; + if (pimpl == NULL) return; pimpl->Exec(ret_cmd); if (pimpl->pevent->presscount(MOUSE_RIGHT)) { Cancel(); @@ -1911,10 +1932,12 @@ void Scn2kMenu::Exec(Cmd& ret_cmd) { ret_cmd.read(tmp_cmd); } } + void Scn2kMenu::activate(void) { - if (pimpl && pimpl->menu) pimpl->menu->activate(); -} -void Scn2kMenu::deactivate(void) { - if (pimpl && pimpl->menu) pimpl->menu->deactivate(); + if (pimpl != NULL && pimpl->menu) pimpl->menu->activate(); } +void Scn2kMenu::deactivate(void) { + if (pimpl != NULL && pimpl->menu) pimpl->menu->deactivate(); +} +