Compare commits

..

No commits in common. "940fe3feeeeaa03918c86a7904c7b82de66af08a" and "51faed72105c2dafdab70dc932696c1319c17641" have entirely different histories.

2 changed files with 43 additions and 89 deletions

View file

@ -101,42 +101,6 @@ struct WeaponPart {
}; };
struct Weapon { struct Weapon {
Weapon() = default;
Weapon(const Weapon& other) {
name = other.name;
type = other.type;
parts = Containers::Array<WeaponPart>{other.parts.size()};
for(UnsignedInt i = 0; i < parts.size(); i++) {
parts[i] = other.parts[i];
}
customStyles = other.customStyles;
attached = other.attached;
damageType = other.damageType;
dualWield = other.dualWield;
effectColourMode = other.effectColourMode;
effectColour = other.effectColour;
}
Weapon& operator=(const Weapon& other) {
name = other.name;
type = other.type;
parts = Containers::Array<WeaponPart>{other.parts.size()};
for(UnsignedInt i = 0; i < parts.size(); i++) {
parts[i] = other.parts[i];
}
customStyles = other.customStyles;
attached = other.attached;
damageType = other.damageType;
dualWield = other.dualWield;
effectColourMode = other.effectColourMode;
effectColour = other.effectColour;
return *this;
}
Weapon(Weapon&& other) = default;
Weapon& operator=(Weapon&& other) = default;
std::string name; std::string name;
std::string type; std::string type;
Containers::Array<WeaponPart> parts; Containers::Array<WeaponPart> parts;

View file

@ -635,59 +635,49 @@ void SaveTool::drawWeapons() {
int id = 0; int id = 0;
#define weapcat(header, array, dirty, payload_type, payload_tooltip) \ #define weapcat(header, array, dirty, payload_type, payload_tooltip) \
ImGui::TableNextRow(ImGuiTableRowFlags_Headers); \ ImGui::TableNextRow(ImGuiTableRowFlags_Headers); \
ImGui::TableNextColumn(); \ ImGui::TableNextColumn(); \
ImGui::TextUnformatted(header); \ ImGui::TextUnformatted(header); \
\ \
for(UnsignedInt i = 0; i < _currentMass->array().size(); i++) { \ for(UnsignedInt i = 0; i < _currentMass->array().size(); i++) { \
auto& weapon = _currentMass->array()[i]; \ auto& weapon = _currentMass->array()[i]; \
\ \
ImGui::TableNextRow(); \ ImGui::TableNextRow(); \
ImGui::TableNextColumn(); \ ImGui::TableNextColumn(); \
ImGui::PushID(id); \ ImGui::PushID(id); \
if(ImGui::Selectable(weapon.name.c_str(), current_weapon == &weapon)) { \ if(ImGui::Selectable(weapon.name.c_str(), current_weapon == &weapon)) { \
current_weapon = &weapon; \ current_weapon = &weapon; \
} \ } \
if(ImGui::BeginDragDropSource()) { \ if(ImGui::BeginDragDropSource()) { \
ImGui::SetDragDropPayload(payload_type, &i, sizeof(UnsignedInt)); \ ImGui::SetDragDropPayload(payload_type, &i, sizeof(UnsignedInt)); \
if(ImGui::GetIO().KeyCtrl) { \ ImGui::Text(payload_tooltip " %i - %s", i + 1, weapon.name.c_str()); \
ImGui::Text(payload_tooltip " %i - %s (copy)", i + 1, weapon.name.c_str()); \ ImGui::EndDragDropSource(); \
} \ } \
else { \ if(ImGui::BeginDragDropTarget()) { \
ImGui::Text(payload_tooltip " %i - %s", i + 1, weapon.name.c_str()); \ if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(payload_type)) { \
} \ int index = *static_cast<int*>(payload->Data); \
ImGui::EndDragDropSource(); \ \
} \ if(current_weapon == &_currentMass->array()[index]) { \
if(ImGui::BeginDragDropTarget()) { \ current_weapon = &_currentMass->array()[i]; \
if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(payload_type)) { \ } \
int index = *static_cast<int*>(payload->Data); \ else if (current_weapon == &_currentMass->array()[i]) { \
\ current_weapon = &_currentMass->array()[index]; \
if(!ImGui::GetIO().KeyCtrl) { \ } \
if(current_weapon == &_currentMass->array()[index]) { \ \
current_weapon = &_currentMass->array()[i]; \ std::swap(_currentMass->array()[index], _currentMass->array()[i]); \
} \ (dirty) = true; \
else if (current_weapon == &_currentMass->array()[i]) { \ } \
current_weapon = &_currentMass->array()[index]; \ \
} \ ImGui::EndDragDropTarget(); \
\ } \
std::swap(_currentMass->array()[index], _currentMass->array()[i]); \ \
} \ ImGui::PopID(); \
else { \ id++; \
_currentMass->array()[i] = _currentMass->array()[index]; \ \
} \ if(weapon.attached == true) { \
(dirty) = true; \ ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, 0x1F008CFFu); \
} \ } \
\
ImGui::EndDragDropTarget(); \
} \
\
ImGui::PopID(); \
id++; \
\
if(weapon.attached == true) { \
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, 0x1F008CFFu); \
} \
} }
weapcat("Melee weapons", meleeWeapons, _meleeDirty, "MeleeWeapon", "Melee weapon") weapcat("Melee weapons", meleeWeapons, _meleeDirty, "MeleeWeapon", "Melee weapon")