Commit 8b6b40c2 authored by mercury233's avatar mercury233

don't use inline

parent 44a078e3
......@@ -61,7 +61,7 @@ static bool check_set_code(const CardDataC& data, int set_code) {
inline bool havePopupWindow() {
return mainGame->wQuery->isVisible() || mainGame->wCategories->isVisible() || mainGame->wLinkMarks->isVisible() || mainGame->wDeckManage->isVisible() || mainGame->wDMQuery->isVisible();
}
inline void refreshDeckList() {
void DeckBuilder::RefreshDeckList() {
irr::gui::IGUIListBox* lstCategories = mainGame->lstCategories;
irr::gui::IGUIListBox* lstDecks = mainGame->lstDecks;
wchar_t catepath[256];
......@@ -77,33 +77,33 @@ inline void refreshDeckList() {
}
});
}
inline void refreshReadonly(int catesel) {
void DeckBuilder::RefreshReadonly(int catesel) {
bool hasDeck = mainGame->cbDBDecks->getItemCount() != 0;
mainGame->deckBuilder.readonly = catesel < 2;
mainGame->btnSaveDeck->setEnabled(!mainGame->deckBuilder.readonly);
mainGame->btnDeleteDeck->setEnabled(hasDeck && !mainGame->deckBuilder.readonly);
readonly = catesel < 2;
mainGame->btnSaveDeck->setEnabled(!readonly);
mainGame->btnDeleteDeck->setEnabled(hasDeck && !readonly);
mainGame->btnRenameCategory->setEnabled(catesel > 3);
mainGame->btnDeleteCategory->setEnabled(catesel > 3);
mainGame->btnNewDeck->setEnabled(!mainGame->deckBuilder.readonly);
mainGame->btnRenameDeck->setEnabled(hasDeck && !mainGame->deckBuilder.readonly);
mainGame->btnDMDeleteDeck->setEnabled(hasDeck && !mainGame->deckBuilder.readonly);
mainGame->btnMoveDeck->setEnabled(hasDeck && !mainGame->deckBuilder.readonly);
mainGame->btnNewDeck->setEnabled(!readonly);
mainGame->btnRenameDeck->setEnabled(hasDeck && !readonly);
mainGame->btnDMDeleteDeck->setEnabled(hasDeck && !readonly);
mainGame->btnMoveDeck->setEnabled(hasDeck && !readonly);
mainGame->btnCopyDeck->setEnabled(hasDeck);
}
inline void changeCategory(int catesel) {
void DeckBuilder::ChangeCategory(int catesel) {
mainGame->RefreshDeck(mainGame->cbDBCategory, mainGame->cbDBDecks);
mainGame->cbDBDecks->setSelected(0);
deckManager.LoadDeck(mainGame->cbDBCategory, mainGame->cbDBDecks);
refreshReadonly(catesel);
mainGame->deckBuilder.is_modified = false;
mainGame->deckBuilder.prev_category = catesel;
mainGame->deckBuilder.prev_deck = 0;
RefreshReadonly(catesel);
is_modified = false;
prev_category = catesel;
prev_deck = 0;
}
inline void showDeckManage() {
void DeckBuilder::ShowDeckManage() {
mainGame->RefreshCategoryDeck(mainGame->cbDBCategory, mainGame->cbDBDecks, false);
mainGame->cbDBCategory->setSelected(mainGame->deckBuilder.prev_category);
mainGame->cbDBCategory->setSelected(prev_category);
mainGame->RefreshDeck(mainGame->cbDBCategory, mainGame->cbDBDecks);
mainGame->cbDBDecks->setSelected(mainGame->deckBuilder.prev_deck);
mainGame->cbDBDecks->setSelected(prev_deck);
irr::gui::IGUIListBox* lstCategories = mainGame->lstCategories;
lstCategories->clear();
lstCategories->addItem(dataManager.GetSysString(1450));
......@@ -115,16 +115,16 @@ inline void showDeckManage() {
lstCategories->addItem(name);
}
});
lstCategories->setSelected(mainGame->deckBuilder.prev_category);
refreshDeckList();
refreshReadonly(mainGame->deckBuilder.prev_category);
mainGame->lstDecks->setSelected(mainGame->deckBuilder.prev_deck);
lstCategories->setSelected(prev_category);
RefreshDeckList();
RefreshReadonly(prev_category);
mainGame->lstDecks->setSelected(prev_deck);
mainGame->PopupElement(mainGame->wDeckManage);
}
inline void ShowBigCard(int code, float zoom) {
mainGame->deckBuilder.bigcard_code = code;
mainGame->deckBuilder.bigcard_zoom = zoom;
void DeckBuilder::ShowBigCard(int code, float zoom) {
bigcard_code = code;
bigcard_zoom = zoom;
ITexture* img = imageManager.GetBigPicture(code, zoom);
mainGame->imgBigCard->setImage(img);
auto size = img->getSize();
......@@ -141,12 +141,12 @@ inline void ShowBigCard(int code, float zoom) {
mainGame->env->getRootGUIElement()->bringToFront(mainGame->wBigCard);
mainGame->gMutex.unlock();
}
inline void ZoomBigCard(s32 centerx = -1, s32 centery = -1) {
if(mainGame->deckBuilder.bigcard_zoom >= 4)
mainGame->deckBuilder.bigcard_zoom = 4;
if(mainGame->deckBuilder.bigcard_zoom <= 0.2f)
mainGame->deckBuilder.bigcard_zoom = 0.2f;
ITexture* img = imageManager.GetBigPicture(mainGame->deckBuilder.bigcard_code, mainGame->deckBuilder.bigcard_zoom);
void DeckBuilder::ZoomBigCard(s32 centerx, s32 centery) {
if(bigcard_zoom >= 4)
bigcard_zoom = 4;
if(bigcard_zoom <= 0.2f)
bigcard_zoom = 0.2f;
ITexture* img = imageManager.GetBigPicture(bigcard_code, bigcard_zoom);
mainGame->imgBigCard->setImage(img);
auto size = img->getSize();
auto pos = mainGame->wBigCard->getRelativePosition();
......@@ -161,7 +161,7 @@ inline void ZoomBigCard(s32 centerx = -1, s32 centery = -1) {
mainGame->imgBigCard->setRelativePosition(recti(0, 0, size.Width, size.Height));
mainGame->wBigCard->setRelativePosition(recti(left, top, left + size.Width, top + size.Height));
}
inline void CloseBigCard() {
void DeckBuilder::CloseBigCard() {
mainGame->HideElement(mainGame->wBigCard);
mainGame->btnBigCardOriginalSize->setVisible(false);
mainGame->btnBigCardZoomIn->setVisible(false);
......@@ -379,7 +379,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
prev_operation = id;
break;
}
showDeckManage();
ShowDeckManage();
break;
}
case BUTTON_NEW_CATEGORY: {
......@@ -500,10 +500,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
if(catesel > 0) {
mainGame->lstCategories->setSelected(catesel);
refreshDeckList();
RefreshDeckList();
mainGame->lstDecks->setSelected(0);
mainGame->cbDBCategory->setSelected(catesel);
changeCategory(catesel);
ChangeCategory(catesel);
}
break;
}
......@@ -530,10 +530,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
if(catesel > 0) {
mainGame->lstCategories->setSelected(catesel);
refreshDeckList();
RefreshDeckList();
mainGame->lstDecks->setSelected(0);
mainGame->cbDBCategory->setSelected(catesel);
changeCategory(catesel);
ChangeCategory(catesel);
}
break;
}
......@@ -545,10 +545,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->lstCategories->removeItem(catesel);
catesel = 2;
mainGame->lstCategories->setSelected(catesel);
refreshDeckList();
RefreshDeckList();
mainGame->lstDecks->setSelected(0);
mainGame->cbDBCategory->setSelected(catesel);
changeCategory(catesel);
ChangeCategory(catesel);
} else {
mainGame->stACMessage->setText(dataManager.GetSysString(1476));
mainGame->PopupElement(mainGame->wACMessage, 20);
......@@ -567,8 +567,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
deckManager.current_deck.extra.clear();
deckManager.current_deck.side.clear();
res = deckManager.SaveDeck(deckManager.current_deck, filepath);
refreshDeckList();
changeCategory(mainGame->lstCategories->getSelected());
RefreshDeckList();
ChangeCategory(mainGame->lstCategories->getSelected());
}
for(int i = 0;i < mainGame->lstDecks->getItemCount();i++) {
if(!mywcsncasecmp(mainGame->lstDecks->getListItem(i), deckname, 256)) {
......@@ -602,8 +602,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if(!FileSystem::IsFileExists(newfilepath)) {
res = FileSystem::Rename(oldfilepath, newfilepath);
}
refreshDeckList();
changeCategory(catesel);
RefreshDeckList();
ChangeCategory(catesel);
for(int i = 0;i < mainGame->lstDecks->getItemCount();i++) {
if(!mywcsncasecmp(mainGame->lstDecks->getListItem(i), newdeckname, 256)) {
deckManager.LoadDeck(newfilepath);
......@@ -635,7 +635,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->cbDBDecks->setSelected(decksel);
deckManager.LoadDeck(mainGame->cbDBCategory, mainGame->cbDBDecks);
}
refreshReadonly(prev_category);
RefreshReadonly(prev_category);
prev_deck = decksel;
} else {
mainGame->stACMessage->setText(dataManager.GetSysString(1476));
......@@ -665,9 +665,9 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
mainGame->lstCategories->setSelected(newcatename);
int catesel = mainGame->lstCategories->getSelected();
refreshDeckList();
RefreshDeckList();
mainGame->cbDBCategory->setSelected(catesel);
changeCategory(catesel);
ChangeCategory(catesel);
for(int i = 0;i < mainGame->lstDecks->getItemCount();i++) {
if(!mywcsncasecmp(mainGame->lstDecks->getListItem(i), deckname, 256)) {
deckManager.LoadDeck(newfilepath);
......@@ -703,9 +703,9 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
mainGame->lstCategories->setSelected(newcatename);
int catesel = mainGame->lstCategories->getSelected();
refreshDeckList();
RefreshDeckList();
mainGame->cbDBCategory->setSelected(catesel);
changeCategory(catesel);
ChangeCategory(catesel);
for(int i = 0;i < mainGame->lstDecks->getItemCount();i++) {
if(!mywcsncasecmp(mainGame->lstDecks->getListItem(i), deckname, 256)) {
deckManager.LoadDeck(newfilepath);
......@@ -817,14 +817,14 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
Terminate();
} else if(prev_operation == COMBOBOX_DBCATEGORY) {
int catesel = mainGame->cbDBCategory->getSelected();
changeCategory(catesel);
ChangeCategory(catesel);
} else if(prev_operation == COMBOBOX_DBDECKS) {
int decksel = mainGame->cbDBDecks->getSelected();
deckManager.LoadDeck(mainGame->cbDBCategory, mainGame->cbDBDecks);
prev_deck = decksel;
is_modified = false;
} else if(prev_operation == BUTTON_MANAGE_DECK) {
showDeckManage();
ShowDeckManage();
}
prev_operation = 0;
break;
......@@ -920,7 +920,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
prev_operation = id;
break;
}
changeCategory(catesel);
ChangeCategory(catesel);
break;
}
case COMBOBOX_DBDECKS: {
......@@ -1078,10 +1078,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if(prev_category == catesel)
break;
}
refreshDeckList();
RefreshDeckList();
mainGame->lstDecks->setSelected(0);
mainGame->cbDBCategory->setSelected(catesel);
changeCategory(catesel);
ChangeCategory(catesel);
break;
}
case LISTBOX_DECKS: {
......
......@@ -21,6 +21,14 @@ public:
void ClearSearch();
void SortList();
void RefreshDeckList();
void RefreshReadonly(int catesel);
void ChangeCategory(int catesel);
void ShowDeckManage();
void ShowBigCard(int code, float zoom);
void ZoomBigCard(s32 centerx = -1, s32 centery = -1);
void CloseBigCard();
bool CardNameContains(const wchar_t *haystack, const wchar_t *needle);
bool push_main(code_pointer pointer, int seq = -1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment