Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
e49204da
Commit
e49204da
authored
Jan 10, 2009
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug: empty OptionalScript were saved as empty string, causing parse error when reading.
custom pack types can now be removed again.
parent
ac81c734
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
src/gui/set/random_pack_panel.cpp
src/gui/set/random_pack_panel.cpp
+19
-6
src/script/scriptable.cpp
src/script/scriptable.cpp
+3
-1
No files found.
src/gui/set/random_pack_panel.cpp
View file @
e49204da
...
...
@@ -313,6 +313,7 @@ class CustomPackDialog : public wxDialog {
void
storePack
();
void
onAmountChange
(
wxSpinEvent
&
);
void
onOk
(
wxCommandEvent
&
);
void
onRemove
(
wxCommandEvent
&
);
};
CustomPackDialog
::
CustomPackDialog
(
Window
*
parent
,
const
SetP
&
set
,
const
PackTypeP
&
edited_pack
)
...
...
@@ -322,6 +323,7 @@ CustomPackDialog::CustomPackDialog(Window* parent, const SetP& set, const PackTy
// init ui
totals
=
new
PackTotalsPanel
(
this
,
wxID_ANY
,
generator
,
true
);
name
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
edited_pack
?
edited_pack
->
name
:
_
(
"custom pack"
));
wxButton
*
remove
=
new
wxButton
(
this
,
ID_REMOVE_ITEM
,
_BUTTON_
(
"remove item"
));
// init sizer
wxSizer
*
s
=
new
wxBoxSizer
(
wxVERTICAL
);
wxSizer
*
s2
=
new
wxStaticBoxSizer
(
wxHORIZONTAL
,
this
,
_LABEL_
(
"pack name"
));
...
...
@@ -338,7 +340,10 @@ CustomPackDialog::CustomPackDialog(Window* parent, const SetP& set, const PackTy
s5
->
Add
(
totals
,
1
,
wxEXPAND
|
wxALL
,
4
);
s3
->
Add
(
s5
,
1
,
wxEXPAND
|
wxLEFT
,
8
);
s
->
Add
(
s3
,
0
,
wxEXPAND
|
wxALL
&
~
wxTOP
,
8
);
s
->
Add
(
CreateButtonSizer
(
wxOK
|
wxCANCEL
),
0
,
wxEXPAND
|
wxALL
&
~
wxTOP
,
8
);
wxSizer
*
s6
=
new
wxBoxSizer
(
wxHORIZONTAL
);
s6
->
Add
(
remove
,
0
,
wxALL
&
~
wxTOP
&
~
wxRIGHT
,
8
);
s6
->
Add
(
CreateButtonSizer
(
wxOK
|
wxCANCEL
),
1
,
wxALL
&
~
wxTOP
,
8
);
s
->
Add
(
s6
,
0
,
wxEXPAND
);
// add spin controls
FOR_EACH
(
pack
,
set
->
game
->
pack_types
)
{
if
(
pack
->
selectable
)
continue
;
// this pack is already selectable from the main UI
...
...
@@ -392,12 +397,17 @@ void CustomPackDialog::onOk(wxCommandEvent&) {
storePack
();
EndModal
(
wxID_OK
);
}
void
CustomPackDialog
::
onRemove
(
wxCommandEvent
&
)
{
edited_pack
=
PackTypeP
();
EndModal
(
wxID_OK
);
}
void
CustomPackDialog
::
onAmountChange
(
wxSpinEvent
&
)
{
updateTotals
();
}
BEGIN_EVENT_TABLE
(
CustomPackDialog
,
wxDialog
)
EVT_BUTTON
(
wxID_OK
,
CustomPackDialog
::
onOk
)
EVT_BUTTON
(
ID_REMOVE_ITEM
,
CustomPackDialog
::
onRemove
)
EVT_SPINCTRL
(
ID_PACK_AMOUNT
,
CustomPackDialog
::
onAmountChange
)
END_EVENT_TABLE
()
...
...
@@ -578,20 +588,23 @@ void RandomPackPanel::onCommand(int id) {
}
}
void
RandomPackPanel
::
onPackTypeClick
(
wxCommandEvent
&
ev
)
{
for
(
size_t
i
=
0
;
i
<
pickers
.
size
()
;
++
i
)
{
const
PackAmountPicker
&
pick
=
pickers
[
i
];
FOR_EACH
(
pick
,
pickers
)
{
if
(
pick
.
label
==
ev
.
GetEventObject
())
{
// edit this pack type
CustomPackDialog
dlg
(
this
,
set
,
pick
.
pack
);
if
(
dlg
.
ShowModal
()
==
wxID_OK
)
{
if
(
dlg
.
get
())
{
// delete pack
set
->
actions
.
addAction
(
new
AddPackAction
(
REMOVE
,
*
set
,
pick
.
pack
)
);
}
else
{
// update pack
for
(
size_t
i
=
0
;
i
<
set
->
pack_types
.
size
()
;
++
i
)
{
if
(
set
->
pack_types
[
i
]
==
pick
.
pack
)
{
set
->
actions
.
addAction
(
new
ChangePackAction
(
*
set
,
i
,
dlg
.
get
())
);
}
}
}
else
{
// delete pack
set
->
actions
.
addAction
(
new
AddPackAction
(
REMOVE
,
*
set
,
pick
.
pack
)
);
}
}
break
;
}
}
...
...
src/script/scriptable.cpp
View file @
e49204da
...
...
@@ -90,7 +90,9 @@ template <> void Reader::handle(OptionalScript& os) {
}
template
<>
void
Writer
::
handle
(
const
OptionalScript
&
os
)
{
if
(
os
.
script
)
{
handle
(
os
.
unparsed
);
}
}
template
<>
void
GetDefaultMember
::
handle
(
const
OptionalScript
&
os
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment