📄 info.cpp
字号:
PlayerOptions.SaveOptions();
CloseWindowCB(ID,hittype,control);
}
else
{
PlayerOptions.ComplyWRules(CurrRules.GetRules());
PlayerOptions.SaveOptions();
INFOSetupControls();
}*/
ebox=(C_EditBox*)control->Parent_->FindControl(INFO_PASSWORD);
if(ebox)
{
game=(FalconGameEntity*)gCommsMgr->GetTargetGame();
if(game && OkCB)
{
if(!game->CheckPassword(ebox->GetText()))
{
AreYouSure(TXT_ERROR,TXT_WRONGPASSWORD,NULL,CloseWindowCB);
return;
}
}
}
PlayerOptions.ComplyWRules(CurrRules.GetRules());
PlayerOptions.SaveOptions();
CloseWindowCB(ID,hittype,control);
if(OkCB)
(*OkCB)();
}
int CheckButtonCompliance(C_Button *button,int test)
{
if(button->GetState() == C_STATE_1 && test)
{
button->SetState(C_STATE_2);
button->Refresh();
return FALSE;
}
else if(button->GetState() == C_STATE_2 && !test)
{
button->SetState(C_STATE_1);
button->Refresh();
return TRUE;
}
else if(button->GetState() == C_STATE_2)
{
return FALSE;
}
return TRUE;
}
void CheckCompliance(void)
{
C_Window *win = gMainHandler->FindWindow(INFO_WIN);
if(!win)
return;
C_ListBox *lbox;
C_Button *button;
C_Slider *slider;
C_EditBox *ebox;
C_Line *line;
int InCompliance = TRUE;
int MakeRed = 0;
lbox=(C_ListBox *)win->FindControl(FLTMOD_CUR);
if(lbox != NULL)
{
if(lbox->GetTextID()==FLTMOD_2)
if(CurrRules.SimFlightModel > FMSimplified)
{
InCompliance = FALSE;
MakeRed++;
}
line = (C_Line *)win->FindControl(FLTMOD_LINE);
if(MakeRed && line)
{
//lbox->SetNormColor(RGB(255,0,0));
//lbox->Refresh();
line->SetColor(RGB(230,0,0));
line->Refresh();
MakeRed--;
}
else if(line)
{
//lbox->SetNormColor(RGB(230,230,230));
//lbox->Refresh();
line->SetColor(RGB(65,128,173));
line->Refresh();
}
}
lbox=(C_ListBox *)win->FindControl(RADAR_CUR);
if(lbox != NULL)
{
switch(lbox->GetTextID())
{
case RADAR_2:
if(CurrRules.SimAvionicsType > ATSimplified)
{
InCompliance = FALSE;
MakeRed++;
}
break;
case RADAR_3:
if(CurrRules.SimAvionicsType > ATEasy)
{
InCompliance = FALSE;
MakeRed++;
}
break;
default:
break;
}
line = (C_Line *)win->FindControl(RADAR_LINE);
if(MakeRed && line)
{
//lbox->SetNormColor(RGB(255,0,0));
//lbox->Refresh();
line->SetColor(RGB(230,0,0));
line->Refresh();
MakeRed--;
}
else if(line)
{
//lbox->SetNormColor(RGB(230,230,230));
//lbox->Refresh();
line->SetColor(RGB(65,128,173));
line->Refresh();
}
}
lbox=(C_ListBox *)win->FindControl(WEAPEFF_CUR);
if(lbox != NULL)
{
switch(lbox->GetTextID())
{
case WEAPEFF_2:
if(CurrRules.SimWeaponEffect > WEEnhanced)
{
InCompliance = FALSE;
MakeRed++;
}
break;
case WEAPEFF_3:
if(CurrRules.SimWeaponEffect > WEExaggerated)
{
InCompliance = FALSE;
MakeRed++;
}
break;
default:
break;
}
line = (C_Line *)win->FindControl(WEAPEFF_LINE);
if(MakeRed && line)
{
//lbox->SetNormColor(RGB(255,0,0));
//lbox->Refresh();
line->SetColor(RGB(230,0,0));
line->Refresh();
MakeRed--;
}
else if(line)
{
//lbox->SetNormColor(RGB(230,230,230));
//lbox->Refresh();
line->SetColor(RGB(65,128,173));
line->Refresh();
}
}
lbox=(C_ListBox *)win->FindControl(AUTOPILOT_CUR);
if(lbox != NULL)
{
switch(lbox->GetTextID())
{
case AUTO_2:
if(CurrRules.SimAutopilotType > APEnhanced)
{
InCompliance = FALSE;
MakeRed++;
}
break;
case AUTO_3:
if(CurrRules.SimAutopilotType > APIntelligent)
{
InCompliance = FALSE;
MakeRed++;
}
break;
default:
break;
}
line = (C_Line *)win->FindControl(AUTOPILOT_LINE);
if(MakeRed && line)
{
//lbox->SetNormColor(RGB(255,0,0));
//lbox->Refresh();
line->SetColor(RGB(230,0,0));
line->Refresh();
MakeRed--;
}
else if(line)
{
//lbox->SetNormColor(RGB(230,230,230));
//lbox->Refresh();
line->SetColor(RGB(65,128,173));
line->Refresh();
}
}
lbox=(C_ListBox *)win->FindControl(PADLOCK_CUR);
if(lbox != NULL)
{
switch(lbox->GetTextID())
{
case PADLOCK_1:
if(CurrRules.SimPadlockMode > PDRealistic)
{
InCompliance = FALSE;
MakeRed++;
}
break;
case PADLOCK_2:
if(CurrRules.SimPadlockMode > PDEnhanced)
{
InCompliance = FALSE;
MakeRed++;
}
break;
case PADLOCK_4:
if(CurrRules.SimPadlockMode > PDDisabled)
{
InCompliance = FALSE;
MakeRed++;
}
break;
/* case PADLOCK_3:
if(CurrRules.SimPadlockMode > PDSuper)
{
InCompliance = FALSE;
MakeRed++;
}
break;*/
default:
break;
}
line = (C_Line *)win->FindControl(PADLOCK_LINE);
if(MakeRed && line)
{
//lbox->SetNormColor(RGB(255,0,0));
//lbox->Refresh();
line->SetColor(RGB(230,0,0));
line->Refresh();
MakeRed--;
}
else if(line)
{
//lbox->SetNormColor(RGB(230,230,230));
//lbox->Refresh();
line->SetColor(RGB(65,128,173));
line->Refresh();
}
}
lbox=(C_ListBox *)win->FindControl(REFUELING_CUR);
if(lbox != NULL)
{
switch(lbox->GetTextID())
{
case REFUEL_2:
if(CurrRules.SimAirRefuelingMode < ARModerated)
{
InCompliance = FALSE;
MakeRed++;
}
break;
case REFUEL_3:
if(CurrRules.SimAirRefuelingMode < ARSimplistic)
{
InCompliance = FALSE;
MakeRed++;
}
break;
default:
break;
}
line = (C_Line *)win->FindControl(REFUELING_LINE);
if(MakeRed && line)
{
//lbox->SetNormColor(RGB(255,0,0));
//lbox->Refresh();
line->SetColor(RGB(230,0,0));
line->Refresh();
MakeRed--;
}
else if(line)
{
//lbox->SetNormColor(RGB(230,230,230));
//lbox->Refresh();
line->SetColor(RGB(65,128,173));
line->Refresh();
}
}
button=(C_Button *)win->FindControl(FUEL_CUR);
if(button != NULL)
{
if(!CheckButtonCompliance(button,!CurrRules.UnlimitedFuel()) )
InCompliance = FALSE;
}
button=(C_Button *)win->FindControl(CHAFFLARES_CUR);
if(button != NULL)
{
if(!CheckButtonCompliance(button,!CurrRules.UnlimitedChaff()) )
InCompliance = FALSE;
}
button=(C_Button *)win->FindControl(COLLISIONS_CUR);
if(button != NULL)
{
if(!CheckButtonCompliance(button,!CurrRules.NoCollisions()) )
InCompliance = FALSE;
}
button=(C_Button *)win->FindControl(BLACKOUT_CUR);
if(button != NULL)
{
if(!CheckButtonCompliance(button,!CurrRules.NoBlackout()) )
InCompliance = FALSE;
}
button=(C_Button *)win->FindControl(IDTAGS_CUR);
if(button != NULL)
{
if(!CheckButtonCompliance(button,!CurrRules.NameTagsOn()) )
InCompliance = FALSE;
}
button=(C_Button *)win->FindControl(WEATHER_CUR);
if(button != NULL)
{
if(!CheckButtonCompliance(button,CurrRules.WeatherOn()) )
InCompliance = FALSE;
}
button=(C_Button *)win->FindControl(INVULNERABILITY_CUR);
if(button != NULL)
{
if(!CheckButtonCompliance(button,!CurrRules.InvulnerableOn()) )
InCompliance = FALSE;
}
/* May need to hit this if veh mag is 1
button=(C_Button *)win->FindControl(AUTO_SCALE);
if(button != NULL)
{
if(!CheckButtonCompliance(button,!CurrRules.InvulnerableOn()) )
InCompliance = FALSE;
if(button->GetState() == C_STATE_1)
PlayerOptions.SetObjFlag(DISP_OBJ_DYN_SCALING);
else
PlayerOptions.ClearObjFlag(DISP_OBJ_DYN_SCALING);
}*/
slider=(C_Slider *)win->FindControl(VEHICLE_SIZE_CUR);
if(slider != NULL)
{
if(CurrRules.ObjMagnification < (int)( (float)slider->GetSliderPos()/( slider->GetSliderMax() - slider->GetSliderMin() ) * 4 + 1.5f ) )
{
InCompliance = FALSE;
MakeRed++;
}
ebox = (C_EditBox *)win->FindControl(slider->GetUserNumber(0));
if(ebox)
{
if(MakeRed)
{
ebox->SetFgColor(RGB(255,0,0));
MakeRed--;
}
else
{
ebox->SetFgColor(RGB(0,255,0));
}
ebox->Refresh();
}
}
button=(C_Button *)win->FindControl(INFO_COMPLY);
if(button != NULL)
{
if(InCompliance)
{
button->SetLabel(0,TXT_OK);
}
else
{
button->SetLabel(0,TXT_COMPLY);
}
button->Refresh();
}
}
void ListBoxChangeCB(long,short hittype,C_Base *)
{
if(hittype != C_TYPE_SELECT)
return;
CheckCompliance();
}
void SliderChangeCB(long,short hittype,C_Base *control)
{
if(hittype != C_TYPE_MOUSEMOVE)
return;
C_Slider *slider;
int scale;
slider=(C_Slider *)control;
scale = FloatToInt32((float)slider->GetSliderPos()/(slider->GetSliderMax()-slider->GetSliderMin()) * 4 + 1.5F);
if(scale != slider->GetUserNumber(2))
{
C_EditBox *ebox;
ebox = (C_EditBox *)control->Parent_->FindControl(slider->GetUserNumber(0));
if(ebox)
{
ebox->SetInteger(scale);
ebox->Refresh();
}
CheckCompliance();
}
slider->SetUserNumber(2,scale);
}
void ButtonChangeCB(long,short hittype,C_Base *control)
{
if(hittype != C_TYPE_LMOUSEUP)
return;
C_Button *btn;
btn = (C_Button *)control;
if(btn->GetState() != C_STATE_0)
{
btn->SetState(C_STATE_0);
btn->Refresh();
}
else
{
btn->SetState(C_STATE_1);
}
CheckCompliance();
}
static void INFOSaveRulesToFile(void)
{
if(modify)
CurrRules.SaveRules(LogBook.Callsign());
}
static void SliderRuleControlCB(long,short hittype,C_Base *control)
{
if(hittype != C_TYPE_MOUSEMOVE)
return;
C_Slider *slider;
int scale;
slider=(C_Slider *)control;
scale = static_cast<int>(((float)slider->GetSliderPos()/(slider->GetSliderMax()-slider->GetSliderMin()) * 4 + 1.5F));
if(scale != slider->GetUserNumber(2))
{
C_EditBox *ebox;
ebox = (C_EditBox *)control->Parent_->FindControl(slider->GetUserNumber(0));
if(ebox)
{
ebox->SetInteger(scale);
ebox->Refresh();
}
INFOSaveRules();
CheckCompliance();
}
slider->SetUserNumber(2,scale);
}
static void RuleControlCB(long,short hittype,C_Base *control)
{
if(!control)
return;
if((hittype != C_TYPE_LMOUSEUP) && (hittype != C_TYPE_SELECT))
return;
if(modify && control->_GetCType_() == _CNTL_BUTTON_) // if host I assume
{
if(control->GetState())
control->SetState(0);
else
control->SetState(1);
control->Refresh();
}
else
return;
INFOSaveRules();
CheckCompliance();
}
static void CloseInfoWindowCB(long ID,short hittype,C_Base *control)
{
if(hittype != C_TYPE_LMOUSEUP)
return;
if(CancelCB)
(*CancelCB)();
CloseWindowCB(ID,hittype,control);
}
void INFOHookupControls()
{
C_Window *win;
C_Button *button;
C_ListBox *lbox;
C_Slider *slider;
win=gMainHandler->FindWindow(INFO_WIN);
if(!win)
return;
button=(C_Button *)win->FindControl(CLOSE_WINDOW);
if(button != NULL)
button->SetCallback(CloseInfoWindowCB);
button=(C_Button *)win->FindControl(INFO_CANCEL);
if(button != NULL)
button->SetCallback(CloseInfoWindowCB);
button=(C_Button *)win->FindControl(INFO_COMPLY);
if(button != NULL)
button->SetCallback(ComplyCB);
/*
INFO_COMPLY
VEHICLE_SIZE_READOUT_REQ
VEHICLE_SIZE_REQ
VEHICLE_SIZE_CUR
VEHICLE_SIZE_READOUT_CUR
all of these need special callbacks to only allow the host to change them
FUEL_REQ
CHAFFLARES_REQ
COLLISIONS_REQ
BLACKOUT_REQ
IDTAGS_REQ
WEATHER_REQ
INVULNERABILITY_REQ
VEHICLE_SIZE_REQ
FLTMOD_REQ
RADAR_REQ
WEAPEFF_REQ
AUTOPILOT_REQ
REFUELING_REQ
PADLOCK_REQ
*/
lbox=(C_ListBox *)win->FindControl(FLTMOD_CUR);
if(lbox != NULL)
lbox->SetCallback(ListBoxChangeCB);
lbox=(C_ListBox *)win->FindControl(RADAR_CUR);
if(lbox != NULL)
lbox->SetCallback(ListBoxChangeCB);
lbox=(C_ListBox *)win->FindControl(WEAPEFF_CUR);
if(lbox != NULL)
lbox->SetCallback(ListBoxChangeCB);
lbox=(C_ListBox *)win->FindControl(AUTOPILOT_CUR);
if(lbox != NULL)
lbox->SetCallback(ListBoxChangeCB);
lbox=(C_ListBox *)win->FindControl(PADLOCK_CUR);
if(lbox != NULL)
lbox->SetCallback(ListBoxChangeCB);
lbox=(C_ListBox *)win->FindControl(REFUELING_CUR);
if(lbox != NULL)
lbox->SetCallback(ListBoxChangeCB);
button=(C_Button *)win->FindControl(FUEL_CUR);
if(button != NULL)
button->SetCallback(ButtonChangeCB);
button=(C_Button *)win->FindControl(CHAFFLARES_CUR);
if(button != NULL)
button->SetCallback(ButtonChangeCB);
button=(C_Button *)win->FindControl(COLLISIONS_CUR);
if(button != NULL)
button->SetCallback(ButtonChangeCB);
button=(C_Button *)win->FindControl(BLACKOUT_CUR);
if(button != NULL)
button->SetCallback(ButtonChangeCB);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -