add terrain picture to item shortcut editor
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
<button name='left' type='left' top='334' left='10' def-key='left'/>
|
||||
<text name='num' top='115' left='211' width=' 46' height='14'/>
|
||||
<pict type='dlog' num='16' top='8' left='8'/>
|
||||
<pict name='ter-pic' type='ter' num='0' top='70' left='458'/>
|
||||
<text size='large' top='6' left='50' width='256' height='20'>Item Placement Shortcuts</text>
|
||||
<text top='25' left='50' width='439' height='40'>
|
||||
You can design shortcuts for automatic placement of items in towns.
|
||||
|
@@ -3005,6 +3005,22 @@ static void put_item_placement_in_dlog(cDialog& me, const cScenario::cItemStorag
|
||||
me["num"].setTextToNum(which);
|
||||
dynamic_cast<cLed&>(me["owned"]).setState(storage.property ? led_red : led_off);
|
||||
me["ter"].setTextToNum(storage.ter_type);
|
||||
if(storage.ter_type == -1){
|
||||
me["ter-pic"].hide();
|
||||
}
|
||||
else{
|
||||
me["ter-pic"].show();
|
||||
pic_num_t pict = scenario.ter_types[storage.ter_type].picture;
|
||||
if(pict < 960){
|
||||
dynamic_cast<cPict&>(me["ter-pic"]).setPict(pict, PIC_TER);
|
||||
}else if(pict < 1000){
|
||||
dynamic_cast<cPict&>(me["ter-pic"]).setPict(pict - 960, PIC_TER_ANIM);
|
||||
}else if(pict < 2000){
|
||||
dynamic_cast<cPict&>(me["ter-pic"]).setPict(pict - 1000, PIC_CUSTOM_TER);
|
||||
}else{
|
||||
dynamic_cast<cPict&>(me["ter-pic"]).setPict(pict - 2000, PIC_CUSTOM_TER_ANIM);
|
||||
}
|
||||
}
|
||||
for(short i = 0; i < 10; i++) {
|
||||
std::string id = std::to_string(i + 1);
|
||||
me["item" + id].setTextToNum(storage.item_num[i]);
|
||||
@@ -3037,6 +3053,7 @@ static bool edit_item_placement_event_filter(cDialog& me, std::string hit, cScen
|
||||
if(i >= 0){
|
||||
me["ter"].setTextToNum(i);
|
||||
storage.ter_type = i;
|
||||
put_item_placement_in_dlog(me, storage, which);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@@ -918,4 +918,14 @@ bool aEditScenTimers::undo_me() {
|
||||
bool aEditScenTimers::redo_me() {
|
||||
scenario.scenario_timers = new_timers;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aEditItemShortcuts::undo_me() {
|
||||
scenario.storage_shortcuts = old_shortcuts;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aEditItemShortcuts::redo_me() {
|
||||
scenario.storage_shortcuts = new_shortcuts;
|
||||
return true;
|
||||
}
|
@@ -572,4 +572,14 @@ public:
|
||||
cAction("Edit Scenario Event Timers"), old_timers(old_timers), new_timers(new_timers) {}
|
||||
};
|
||||
|
||||
class aEditItemShortcuts : public cAction {
|
||||
std::array<cScenario::cItemStorage,10> old_shortcuts;
|
||||
std::array<cScenario::cItemStorage,10> new_shortcuts;
|
||||
bool undo_me() override;
|
||||
bool redo_me() override;
|
||||
public:
|
||||
aEditItemShortcuts(std::array<cScenario::cItemStorage,10> old_shortcuts, std::array<cScenario::cItemStorage,10> new_shortcuts) :
|
||||
cAction("Edit Item Placement Shortcuts"), old_shortcuts(old_shortcuts), new_shortcuts(new_shortcuts) {}
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user