Add and remove excess empty lines between functions,

Make code better.
This commit is contained in:
zcaliptium 2016-03-29 23:49:32 +03:00
parent c0a1b7bdf7
commit 31d597856d
20 changed files with 44 additions and 38 deletions

View File

@ -18,7 +18,6 @@ CMGEdit::CMGEdit(void)
Clear();
}
void CMGEdit::Clear(void)
{
mg_iCursorPos = 0;
@ -26,7 +25,6 @@ void CMGEdit::Clear(void)
_bEditingString = FALSE;
}
void CMGEdit::OnActivate(void)
{
if (!mg_bEnabled) {
@ -112,7 +110,6 @@ BOOL CMGEdit::OnKeyDown(int iVKey)
return TRUE;
}
// char typed
BOOL CMGEdit::OnChar(MSG msg)
{
@ -134,7 +131,6 @@ BOOL CMGEdit::OnChar(MSG msg)
return TRUE;
}
void CMGEdit::Render(CDrawPort *pdp)
{
if (mg_bEditing) {
@ -160,9 +156,11 @@ void CMGEdit::Render(CDrawPort *pdp)
CMGButton::Render(pdp);
}
}
void CMGEdit::OnStringChanged(void)
{
}
void CMGEdit::OnStringCanceled(void)
{
}

View File

@ -120,6 +120,7 @@ void CMGFileButton::OnActivate(void)
mg_iState = FBS_SAVENAME;
}
}
BOOL CMGFileButton::OnKeyDown(int iVKey)
{
if (mg_iState == FBS_NORMAL) {

View File

@ -17,7 +17,6 @@ CMGKeyDefinition::CMGKeyDefinition(void)
mg_iState = DOING_NOTHING;
}
void CMGKeyDefinition::OnActivate(void)
{
PlayMenuSound(_psdPress);
@ -26,7 +25,6 @@ void CMGKeyDefinition::OnActivate(void)
mg_iState = RELEASE_RETURN_WAITING;
}
BOOL CMGKeyDefinition::OnKeyDown(int iVKey)
{
// if waiting for a key definition

View File

@ -18,7 +18,6 @@ void CMGLevelButton::OnActivate(void)
_pAfterLevelChosen();
}
void CMGLevelButton::OnSetFocus(void)
{
SetThumbnail(mg_fnmLevel);

View File

@ -31,7 +31,6 @@ void PrintInBox(CDrawPort *pdp, PIX pixI, PIX pixJ, PIX pixSizeI, CTString str,
pdp->PutText(str, pixI, pixJ, col);
}
CMGServerList::CMGServerList()
{
mg_iSelected = 0;
@ -285,7 +284,6 @@ static INDEX SliderPixToIndex(PIX pixOffset, INDEX iVisible, INDEX iTotal, PIXaa
return (iTotal*pixOffset) / pixFull;
}
static PIXaabbox2D GetSliderBox(INDEX iFirst, INDEX iVisible, INDEX iTotal,
PIXaabbox2D boxFull)
{
@ -306,6 +304,7 @@ PIXaabbox2D CMGServerList::GetScrollBarFullBox(void)
{
return PIXaabbox2D(PIX2D(mg_pixSBMinI, mg_pixSBMinJ), PIX2D(mg_pixSBMaxI, mg_pixSBMaxJ));
}
PIXaabbox2D CMGServerList::GetScrollBarHandleBox(void)
{
return GetSliderBox(mg_iFirstOnScreen, mg_ctOnScreen, _lhServers.Count(), GetScrollBarFullBox());
@ -438,6 +437,7 @@ void CMGServerList::OnSetFocus(void)
{
mg_bFocused = TRUE;
}
void CMGServerList::OnKillFocus(void)
{
mg_bFocused = FALSE;

View File

@ -72,7 +72,6 @@ BOOL CMGSlider::OnKeyDown(int iVKey)
return CMenuGadget::OnKeyDown(iVKey);
}
PIXaabbox2D CMGSlider::GetSliderBox(void)
{
extern CDrawPort *pdp;
@ -85,7 +84,6 @@ PIXaabbox2D CMGSlider::GetSliderBox(void)
return PIXaabbox2D(PIX2D(pixIR + 1, pixJ + 1), PIX2D(pixIR + pixISizeR - 2, pixJ + pixJSize - 2));
}
void CMGSlider::Render(CDrawPort *pdp)
{
SetFontMedium(pdp);

View File

@ -37,7 +37,6 @@ void CMGTrigger::ApplyCurrentSelection(void)
mg_strValue = mg_astrTexts[mg_iSelected];
}
void CMGTrigger::OnSetNextInList(int iVKey)
{
if (mg_pPreTriggerChange != NULL) {
@ -52,7 +51,6 @@ void CMGTrigger::OnSetNextInList(int iVKey)
}
}
BOOL CMGTrigger::OnKeyDown(int iVKey)
{
if ((iVKey == VK_RETURN || iVKey == VK_LBUTTON) ||
@ -68,7 +66,6 @@ BOOL CMGTrigger::OnKeyDown(int iVKey)
return FALSE;
}
void CMGTrigger::Render(CDrawPort *pdp)
{
SetFontMedium(pdp);

View File

@ -17,7 +17,6 @@ BOOL CMGVarButton::IsSeparator(void)
return mg_pvsVar->vs_bSeparator;
}
BOOL CMGVarButton::IsEnabled(void)
{
return(_gmRunningGameMode == GM_NONE
@ -25,7 +24,6 @@ BOOL CMGVarButton::IsEnabled(void)
|| mg_pvsVar->vs_bCanChangeInGame);
}
// return slider position on scren
PIXaabbox2D CMGVarButton::GetSliderBox(void)
{
@ -111,7 +109,6 @@ BOOL CMGVarButton::OnKeyDown(int iVKey)
return CMenuGadget::OnKeyDown(iVKey);
}
void CMGVarButton::Render(CDrawPort *pdp)
{
if (mg_pvsVar == NULL) {

View File

@ -85,6 +85,7 @@ void CMenuGadget::Disappear(void)
void CMenuGadget::Think(void)
{
}
void CMenuGadget::OnMouseOver(PIX pixI, PIX pixJ)
{
}

View File

@ -93,6 +93,7 @@ void CCustomizeKeyboardMenu::StartMenu(void)
gm_iListWantedItem = 0;
CGameMenu::StartMenu();
}
void CCustomizeKeyboardMenu::EndMenu(void)
{
ControlsMenuOff();

View File

@ -126,8 +126,7 @@ void CInGameMenu::StartMenu(void)
gm_mgLabel1.mg_strText.PrintF(TRANS("Player: %s"), pc.GetNameForPrinting());
gm_mgLabel2.mg_strText = "";
}
else {
} else {
if (_pNetwork->IsServer()) {
CTString strHost, strAddress;
@ -142,8 +141,8 @@ void CInGameMenu::StartMenu(void)
gm_mgLabel1.mg_strText = TRANS("Address: ") + strHostName;
gm_mgLabel2.mg_strText = "";
}
else {
} else {
CTString strConfig;
strConfig = TRANS("<not adjusted>");

View File

@ -77,8 +77,6 @@ void CLevelsMenu::FillListItems(void)
gm_mgArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
}
void CLevelsMenu::StartMenu(void)
{
// set default parameters for the list

View File

@ -130,6 +130,7 @@ void CLoadSaveMenu::StartMenu(void)
CGameMenu::StartMenu();
}
void CLoadSaveMenu::EndMenu(void)
{
// delete all file infos
@ -196,11 +197,11 @@ BOOL CLoadSaveMenu::ParseFile(const CTFileName &fnm, CTString &strName)
if (fnm.FileExt() != gm_fnmExt) {
return FALSE;
}
CTFileName fnSaveGameDescription = fnm.NoExt() + ".des";
try {
strName.Load_t(fnSaveGameDescription);
}
catch (char *strError) {
} catch (char *strError) {
(void)strError;
strName = fnm.FileName();

View File

@ -106,6 +106,7 @@ void CMainMenu::Initialize_t(void)
gm_mgQuit.mg_pmgDown = &gm_mgSingle;
gm_mgQuit.mg_pActivatedFunction = NULL;
}
void CMainMenu::StartMenu(void)
{
gm_mgSingle.mg_bEnabled = IsMenuEnabled("Single Player");

View File

@ -88,9 +88,6 @@ void CNetworkStartMenu::Initialize_t(void)
gm_mgStart.mg_strText = TRANS("START");
gm_lhGadgets.AddTail(gm_mgStart.mg_lnNode);
gm_mgStart.mg_pActivatedFunction = NULL;
}
void CNetworkStartMenu::StartMenu(void)

View File

@ -178,8 +178,7 @@ void CPlayerProfileMenu::SelectPlayer(INDEX iPlayer)
if (_iLocalPlayer >= 0 && _iLocalPlayer<4) {
_pGame->gm_aiMenuLocalPlayers[_iLocalPlayer] = iPlayer;
}
else {
} else {
_pGame->gm_iSinglePlayer = iPlayer;
}
gm_mgNameField.mg_pstrToChange = &pc.pc_strName;
@ -215,8 +214,7 @@ void CPlayerProfileMenu::SelectPlayer(INDEX iPlayer)
// no model
gm_mgModel.mg_moModel.SetData(NULL);
// if there is some
}
else {
} else {
// set the model
BOOL(*pFunc)(CModelObject *, CPlayerCharacter *, CTString &, BOOL) =
(BOOL(*)(CModelObject *, CPlayerCharacter *, CTString &, BOOL))pss->ss_pvValue;
@ -258,8 +256,7 @@ void CPlayerProfileMenu::StartMenu(void)
for (INDEX i = 0; i<8; i++) {
gm_mgNumber[i].mg_bEnabled = TRUE;
}
}
else {
} else {
for (INDEX i = 0; i<8; i++) {
gm_mgNumber[i].mg_bEnabled = FALSE;
}
@ -281,7 +278,6 @@ void CPlayerProfileMenu::StartMenu(void)
CGameMenu::StartMenu();
}
void CPlayerProfileMenu::EndMenu(void)
{
_pGame->SavePlayersAndControls();

View File

@ -119,8 +119,7 @@ void CSinglePlayerMenu::StartMenu(void)
gm_mgPlayersAndControls.mg_boxOnScreen = BoxBigRow(6.0f);
gm_mgOptions.mg_boxOnScreen = BoxBigRow(7.0f);
}
else {
} else {
if (gm_mgTraining.mg_lnNode.IsLinked()) {
gm_mgTraining.mg_lnNode.Remove();
}

View File

@ -62,7 +62,6 @@ void CVideoOptionsMenu::Initialize_t(void)
gm_mgApply.mg_pActivatedFunction = NULL;
}
void CVideoOptionsMenu::StartMenu(void)
{
InitVideoOptionsButtons();

View File

@ -22,18 +22,21 @@ FLOATaabbox2D BoxTitle(void)
FLOAT2D(0, _fBigSizeJ),
FLOAT2D(1, _fBigSizeJ));
}
FLOATaabbox2D BoxNoUp(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(_fNoStartI+fRow*(_fNoSizeI+_fNoSpaceI), _fNoUpStartJ),
FLOAT2D(_fNoStartI+fRow*(_fNoSizeI+_fNoSpaceI)+_fNoSizeI, _fNoUpStartJ+_fNoSizeJ));
}
FLOATaabbox2D BoxNoDown(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(_fNoStartI+fRow*(_fNoSizeI+_fNoSpaceI), _fNoDownStartJ),
FLOAT2D(_fNoStartI+fRow*(_fNoSizeI+_fNoSpaceI)+_fNoSizeI, _fNoDownStartJ+_fNoSizeJ));
}
FLOATaabbox2D BoxBigRow(FLOAT fRow)
{
return FLOATaabbox2D(
@ -46,6 +49,7 @@ FLOATaabbox2D BoxBigLeft(FLOAT fRow)
FLOAT2D(0.1f, _fBigStartJ+fRow*_fBigSizeJ),
FLOAT2D(0.45f, _fBigStartJ+(fRow+1)*_fBigSizeJ));
}
FLOATaabbox2D BoxBigRight(FLOAT fRow)
{
return FLOATaabbox2D(
@ -66,48 +70,56 @@ FLOATaabbox2D BoxVersion(void)
FLOAT2D(0.05f, _fBigStartJ+-5.5f*_fMediumSizeJ),
FLOAT2D(0.97f, _fBigStartJ+(-5.5f+1)*_fMediumSizeJ));
}
FLOATaabbox2D BoxMediumRow(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(0.05f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.95f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
FLOATaabbox2D BoxKeyRow(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(0.15f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.85f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
FLOATaabbox2D BoxMediumLeft(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(0.05f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.45f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
FLOATaabbox2D BoxPlayerSwitch(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(0.05f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.65f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
FLOATaabbox2D BoxMediumMiddle(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(_fNoStartI, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.95f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
FLOATaabbox2D BoxPlayerEdit(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(_fNoStartI, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.65f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
FLOATaabbox2D BoxMediumRight(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(0.55f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.95f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
FLOATaabbox2D BoxPopup(void)
{
return FLOATaabbox2D(FLOAT2D(0.2f, 0.4f), FLOAT2D(0.8f, 0.6f));
@ -119,30 +131,35 @@ FLOATaabbox2D BoxPopupLabel(void)
FLOAT2D(0.22f, 0.43f),
FLOAT2D(0.78f, 0.49f));
}
FLOATaabbox2D BoxPopupYesLarge(void)
{
return FLOATaabbox2D(
FLOAT2D(0.30f, 0.51f),
FLOAT2D(0.48f, 0.57f));
}
FLOATaabbox2D BoxPopupNoLarge(void)
{
return FLOATaabbox2D(
FLOAT2D(0.52f, 0.51f),
FLOAT2D(0.70f, 0.57f));
}
FLOATaabbox2D BoxPopupYesSmall(void)
{
return FLOATaabbox2D(
FLOAT2D(0.30f, 0.54f),
FLOAT2D(0.48f, 0.59f));
}
FLOATaabbox2D BoxPopupNoSmall(void)
{
return FLOATaabbox2D(
FLOAT2D(0.52f, 0.54f),
FLOAT2D(0.70f, 0.59f));
}
FLOATaabbox2D BoxChangePlayer(INDEX iTable, INDEX iButton)
{
return FLOATaabbox2D(
@ -205,6 +222,7 @@ FLOATaabbox2D BoxLeftColumn(FLOAT fRow)
FLOAT2D(0.02f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.15f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
FLOATaabbox2D BoxPlayerModel(void)
{
extern INDEX sam_bWideScreen;
@ -214,10 +232,12 @@ FLOATaabbox2D BoxPlayerModel(void)
return FLOATaabbox2D(FLOAT2D(0.68f, 0.235f), FLOAT2D(0.68f+(0.965f-0.68f)*9.0f/12.0f, 0.78f));
}
}
FLOATaabbox2D BoxPlayerModelName(void)
{
return FLOATaabbox2D(FLOAT2D(0.68f, 0.78f), FLOAT2D(0.965f, 0.82f));
}
PIXaabbox2D FloatBoxToPixBox(const CDrawPort *pdp, const FLOATaabbox2D &boxF)
{
PIX pixW = pdp->GetWidth();
@ -243,6 +263,7 @@ void SetFontTitle(CDrawPort *pdp)
pdp->SetTextScaling( 1.25f * pdp->GetWidth() /640 *pdp->dp_fWideAdjustment);
pdp->SetTextAspect(1.0f);
}
extern CFontData _fdBig;
void SetFontBig(CDrawPort *pdp)
{
@ -250,6 +271,7 @@ void SetFontBig(CDrawPort *pdp)
pdp->SetTextScaling( 1.0f * pdp->GetWidth() /640 *pdp->dp_fWideAdjustment);
pdp->SetTextAspect(1.0f);
}
extern CFontData _fdMedium;
void SetFontMedium(CDrawPort *pdp)
{
@ -257,6 +279,7 @@ void SetFontMedium(CDrawPort *pdp)
pdp->SetTextScaling( 1.0f * pdp->GetWidth() /640 *pdp->dp_fWideAdjustment);
pdp->SetTextAspect(0.75f);
}
void SetFontSmall(CDrawPort *pdp)
{
pdp->SetFont( _pfdConsoleFont);

View File

@ -176,18 +176,21 @@ int qsort_CompareFileInfos_NameUp(const void *elem1, const void *elem2)
const CFileInfo &fi2 = **(CFileInfo **)elem2;
return strcmp(fi1.fi_strName, fi2.fi_strName);
}
int qsort_CompareFileInfos_NameDn(const void *elem1, const void *elem2)
{
const CFileInfo &fi1 = **(CFileInfo **)elem1;
const CFileInfo &fi2 = **(CFileInfo **)elem2;
return -strcmp(fi1.fi_strName, fi2.fi_strName);
}
int qsort_CompareFileInfos_FileUp(const void *elem1, const void *elem2)
{
const CFileInfo &fi1 = **(CFileInfo **)elem1;
const CFileInfo &fi2 = **(CFileInfo **)elem2;
return strcmp(fi1.fi_fnFile, fi2.fi_fnFile);
}
int qsort_CompareFileInfos_FileDn(const void *elem1, const void *elem2)
{
const CFileInfo &fi1 = **(CFileInfo **)elem1;