Commit e33d4b1b authored by argon.sun's avatar argon.sun

fix

parent 3eda8ed1
...@@ -703,20 +703,17 @@ void Game::WaitFrameSignal(int frame) { ...@@ -703,20 +703,17 @@ void Game::WaitFrameSignal(int frame) {
frameSignal.Wait(); frameSignal.Wait();
} }
void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist) { void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist) {
const int width = 44; //standard pic size, maybe it should be defined in game.h const int width = 44; //standard pic size, maybe it should be defined in game.h
const int height = 64; const int height = 64;
int code = cp->first; int code = cp->first;
int lcode = cp->second.alias; int lcode = cp->second.alias;
if(lcode == 0) if(lcode == 0)
lcode = code; lcode = code;
irr::video::ITexture* img = imageManager.GetTextureThumb(code); irr::video::ITexture* img = imageManager.GetTextureThumb(code);
if(img == NULL) if(img == NULL)
return; //NULL->getSize() will cause a crash return; //NULL->getSize() will cause a crash
dimension2d<u32> size = img->getSize(); dimension2d<u32> size = img->getOriginalSize();
if(size.Width == width and size.Height == height) driver->draw2DImage(img, rect<s32>(pos.X, pos.Y, pos.X + width, pos.Y + height), rect<s32>(0, 0, size.Width, size.Height));
driver->draw2DImage(img, pos);
else
driver->draw2DImage(img, rect<s32>(pos.X, pos.Y,pos.X+width,pos.Y+height), rect<s32>(0,0,size.Width,size.Height));
if(lflist->count(lcode)) { if(lflist->count(lcode)) {
switch((*lflist)[lcode]) { switch((*lflist)[lcode]) {
......
...@@ -270,6 +270,12 @@ public: ...@@ -270,6 +270,12 @@ public:
irr::gui::IGUIButton* btnRepos; irr::gui::IGUIButton* btnRepos;
irr::gui::IGUIButton* btnAttack; irr::gui::IGUIButton* btnAttack;
irr::gui::IGUIButton* btnShowList; irr::gui::IGUIButton* btnShowList;
//chat window
irr::gui::IGUIWindow* wChat;
irr::gui::IGUIListBox* lstChatLog;
irr::gui::IGUIEditBox* ebChatInput;
irr::gui::IGUICheckBox* chkIgnore1;
irr::gui::IGUICheckBox* chkIgnore2;
//phase button //phase button
irr::gui::IGUIStaticText* wPhase; irr::gui::IGUIStaticText* wPhase;
irr::gui::IGUIButton* btnDP; irr::gui::IGUIButton* btnDP;
......
...@@ -42,7 +42,7 @@ void ImageManager::ClearTexture() { ...@@ -42,7 +42,7 @@ void ImageManager::ClearTexture() {
} }
void ImageManager::RemoveTexture(int code) { void ImageManager::RemoveTexture(int code) {
auto tit = tMap.find(code); auto tit = tMap.find(code);
if(tit != tMap.end() and tThumb.find(code)->second != tit->second) { //if member of tThumb point to this; don't remove if(tit != tMap.end()) {
if(tit->second) if(tit->second)
driver->removeTexture(tit->second); driver->removeTexture(tit->second);
tMap.erase(tit); tMap.erase(tit);
...@@ -56,14 +56,17 @@ irr::video::ITexture* ImageManager::GetTexture(int code) { ...@@ -56,14 +56,17 @@ irr::video::ITexture* ImageManager::GetTexture(int code) {
char file[256]; char file[256];
sprintf(file, "pics/%d.jpg", code); //suggest that define the path in game.h sprintf(file, "pics/%d.jpg", code); //suggest that define the path in game.h
irr::video::ITexture* img = driver->getTexture(file); irr::video::ITexture* img = driver->getTexture(file);
if(img == NULL){ if(img == NULL) {
sprintf(file, "pics/thumbnail/%d.jpg", code); sprintf(file, "pics/thumbnail/%d.jpg", code);
img = driver->getTexture(file); img = driver->getTexture(file);
if(img) }
tThumb[code] = img; if(img == NULL) {
tMap[code] = tUnknown;
return tUnknown;
} else {
tMap[code] = img;
return img;
} }
tMap[code] = img;
return img;
} }
if(tit->second) if(tit->second)
return tit->second; return tit->second;
...@@ -78,16 +81,19 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) { ...@@ -78,16 +81,19 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
char file[32]; char file[32];
sprintf(file, "pics/thumbnail/%d.jpg", code); sprintf(file, "pics/thumbnail/%d.jpg", code);
irr::video::ITexture* img = driver->getTexture(file); irr::video::ITexture* img = driver->getTexture(file);
if(img == NULL){ if(img == NULL) {
sprintf(file, "pics/%d.jpg", code); sprintf(file, "pics/%d.jpg", code);
img = driver->getTexture(file); img = driver->getTexture(file);
if(img) }
tMap[code] = img; if(img == NULL) {
tThumb[code] = tUnknown;
return tUnknown;
} else {
tThumb[code] = img;
return img;
} }
tThumb[code] = img;
return img;
} }
if(tit->second) if(tit->second)
return tit->second; return tit->second;
else else
return tUnknown; return tUnknown;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
int32 field::field_used_count[32] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5}; int32 field::field_used_count[32] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5};
bool chain::chain_operation_sort(chain c1, chain c2) { bool chain::chain_operation_sort(chain c1, chain c2) {
return c1.triggering_effect->id > c2.triggering_effect->id; return c1.triggering_effect->id < c2.triggering_effect->id;
} }
field::field(duel* pduel) { field::field(duel* pduel) {
this->pduel = pduel; this->pduel = pduel;
......
...@@ -1235,6 +1235,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1235,6 +1235,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second; peffect = pr.first->second;
if(!peffect->is_activateable(check_player, nil_event)) if(!peffect->is_activateable(check_player, nil_event))
continue; continue;
peffect->id = infos.effect_id++;
newchain.triggering_effect = peffect; newchain.triggering_effect = peffect;
core.select_chains.push_back(newchain); core.select_chains.push_back(newchain);
to_count++; to_count++;
...@@ -1252,6 +1253,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1252,6 +1253,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second; peffect = pr.first->second;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event)) if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue; continue;
peffect->id = infos.effect_id++;
newchain.triggering_effect = peffect; newchain.triggering_effect = peffect;
if(check_hint_timing(peffect)) if(check_hint_timing(peffect))
core.spe_effect[check_player]++; core.spe_effect[check_player]++;
...@@ -1263,6 +1265,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1263,6 +1265,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second; peffect = pr.first->second;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event)) if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue; continue;
peffect->id = infos.effect_id++;
newchain.triggering_effect = peffect; newchain.triggering_effect = peffect;
if(check_hint_timing(peffect)) if(check_hint_timing(peffect))
core.spe_effect[check_player]++; core.spe_effect[check_player]++;
...@@ -1362,6 +1365,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1362,6 +1365,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second; peffect = pr.first->second;
if(!peffect->is_activateable(check_player, nil_event)) if(!peffect->is_activateable(check_player, nil_event))
continue; continue;
peffect->id = infos.effect_id++;
newchain.triggering_effect = peffect; newchain.triggering_effect = peffect;
core.select_chains.push_back(newchain); core.select_chains.push_back(newchain);
to_count++; to_count++;
...@@ -1379,6 +1383,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1379,6 +1383,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second; peffect = pr.first->second;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event)) if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue; continue;
peffect->id = infos.effect_id++;
newchain.triggering_effect = peffect; newchain.triggering_effect = peffect;
if(check_hint_timing(peffect)) if(check_hint_timing(peffect))
core.spe_effect[check_player]++; core.spe_effect[check_player]++;
...@@ -1390,6 +1395,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1390,6 +1395,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second; peffect = pr.first->second;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event)) if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue; continue;
peffect->id = infos.effect_id++;
newchain.triggering_effect = peffect; newchain.triggering_effect = peffect;
if(check_hint_timing(peffect)) if(check_hint_timing(peffect))
core.spe_effect[check_player]++; core.spe_effect[check_player]++;
......
...@@ -62,7 +62,8 @@ function c18096222.eqlimit(e,c) ...@@ -62,7 +62,8 @@ function c18096222.eqlimit(e,c)
return c:GetControler()==e:GetOwnerPlayer() and c:IsType(TYPE_DUAL) return c:GetControler()==e:GetOwnerPlayer() and c:IsType(TYPE_DUAL)
end end
function c18096222.dacon(e,tp,eg,ep,ev,re,r,rp) function c18096222.dacon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():GetEquipTarget()~=nil return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_DESTROY)
and e:GetHandler():GetEquipTarget()~=nil
end end
function c18096222.dafilter(c) function c18096222.dafilter(c)
return c:IsFaceup() and c:IsType(TYPE_DUAL) and not c:IsDualState() return c:IsFaceup() and c:IsType(TYPE_DUAL) and not c:IsDualState()
......
...@@ -4,5 +4,5 @@ function c8198712.initial_effect(c) ...@@ -4,5 +4,5 @@ function c8198712.initial_effect(c)
end end
function c8198712.ritual_filter(c) function c8198712.ritual_filter(c)
local code=c:GetCode() local code=c:GetCode()
return c==72426662 or c==46427957 return code==72426662 or code==46427957
end end
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
antialias = 2 antialias = 2
nickname = Player nickname = Player
gamename = Game gamename = Game
lastdeck = sixsamurai lastdeck = test
textfont = c:/windows/fonts/simsun.ttc 14 textfont = c:/windows/fonts/simsun.ttc 14
numfont = c:/windows/fonts/arialbd.ttf numfont = c:/windows/fonts/arialbd.ttf
serverport = 7911 serverport = 7911
lastip = 192.168.2.100 lastip = 192.168.3.235
lastport = 7911 lastport = 7911
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