widgets/pict.hpp: add a class cPictNum to store a picture number and its type,
game[legacy]: only prevent walking on portail in combat mode Scenario Editor: begin to use cPictNum to avoid crashing when displaying some terrain animations, to be continued...
This commit is contained in:
@@ -354,14 +354,7 @@ static void fill_ter_info(cDialog& me, short ter){
|
||||
{
|
||||
cPict& pic_ctrl = dynamic_cast<cPict&>(me["graphic"]);
|
||||
pic_num_t pic = ter_type.picture;
|
||||
if(pic < 960)
|
||||
pic_ctrl.setPict(pic, PIC_TER);
|
||||
else if(pic < 1000)
|
||||
pic_ctrl.setPict(pic - 960, PIC_TER_ANIM);
|
||||
else if(pic < 2000)
|
||||
pic_ctrl.setPict(pic % 1000, PIC_CUSTOM_TER);
|
||||
else
|
||||
pic_ctrl.setPict(pic % 2000, PIC_CUSTOM_TER_ANIM);
|
||||
pic_ctrl.setPict(cPictNum::getPN_for_terrain(pic));
|
||||
me["pict"].setTextToNum(pic);
|
||||
}{
|
||||
cPict& pic_ctrl = dynamic_cast<cPict&>(me["seemap"]);
|
||||
@@ -492,7 +485,7 @@ static bool edit_ter_obj(cDialog& me, ter_num_t which_ter) {
|
||||
for(int x = 0; x < 4; x++) {
|
||||
for(int y = 0; y < 4; y++) {
|
||||
std::string id = "x" + std::to_string(x) + "y" + std::to_string(y);
|
||||
dynamic_cast<cPict&>(me[id]).setPict(obj[x][y]);
|
||||
dynamic_cast<cPict&>(me[id]).setPict(cPictNum::getPN_for_terrain(obj[x][y]));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@@ -368,12 +368,7 @@ void edit_sign(sign_loc_t& which_sign,short num,short picture) {
|
||||
cDialog sign_dlg("edit-sign");
|
||||
sign_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &sign_dlg, false));
|
||||
sign_dlg["okay"].attachClickHandler(std::bind(edit_sign_event_filter, _1, std::ref(which_sign)));
|
||||
cPict& icon = dynamic_cast<cPict&>(sign_dlg["pic"]);
|
||||
if(picture >= 960 && picture < 1000)
|
||||
icon.setPict(picture, PIC_TER_ANIM);
|
||||
else if(picture >= 2000)
|
||||
icon.setPict(picture - 2000, PIC_CUSTOM_TER_ANIM);
|
||||
else icon.setPict(picture, PIC_TER); // automatically adjusts for custom graphics
|
||||
dynamic_cast<cPict&>(sign_dlg["pic"]).setPict(cPictNum::getPN_for_terrain(picture));
|
||||
|
||||
sign_dlg["num"].setTextToNum(num);
|
||||
sign_dlg["text"].setText(which_sign.text);
|
||||
|
Reference in New Issue
Block a user