Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/descriptions.cc')
-rw-r--r--src/core/descriptions.cc36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/core/descriptions.cc b/src/core/descriptions.cc
index 307cc87..26a5858 100644
--- a/src/core/descriptions.cc
+++ b/src/core/descriptions.cc
@@ -15,7 +15,7 @@ namespace core
ButtonDescription::ButtonDescription()
{
- button_model = 0;
+ button_info = 0;
button_align = Center;
button_commandtype = CommandNone;
}
@@ -35,16 +35,14 @@ void ButtonDescription::set_command(const std::string &command, const CommandTyp
button_command.assign(command);
}
-void ButtonDescription::set_modelname(const std::string &modelname)
+void ButtonDescription::set_alignment(Align align)
{
- button_modelname.assign(modelname);
-
- button_model = model::Model::load(modelname);
+ button_align = align;
}
-void ButtonDescription::set_alignment(Align align)
+void ButtonDescription::set_info(Info *info)
{
- button_align = align;
+ button_info = info;
}
/* ---- class MenuDescription -------------------------------------- */
@@ -92,7 +90,7 @@ void Descriptions::serialize(MenuDescription *menu, std::ostream & os)
<< button->alignment() << " "
<< button->command_type() << " "
<< "\"" << button->command() << "\" "
- << "\"" << button->modelname() << "\" ";
+ << (button->info() ? button->info()->id() : 0) << " ";
}
}
@@ -105,6 +103,7 @@ MenuDescription * Descriptions::receive(std::istream &is)
std::string n;
size_t nb;
char c;
+ long id;
// menu label
is >> n;
@@ -157,12 +156,17 @@ MenuDescription * Descriptions::receive(std::istream &is)
}
}
- // button modelname
- n.clear();
- while ((is.get(c)) && (c != '"'));
- while ((is.get(c)) && (c != '"'))
- n += c;
- if (n.size()) button->set_modelname(n);
+ // button info record id
+ Info *info = 0;
+ if (is >> id) {
+ info = Info::find(id);
+ if (id && !info) {
+ info = new Info(id);
+ }
+ } else {
+ id = 0;
+ }
+ button->set_info(info);
menu->add_button(button);
}
@@ -231,9 +235,7 @@ bool Descriptions::load_entity_menus(core::Entity *entity, const std::string &me
// default command is a game command
button->set_command(strval, ButtonDescription::CommandGame);
-
- } else if (inifile.got_key_string("model", strval)) {
- button->set_modelname(strval);
+
} else if (inifile.got_key_string("align", strval)) {
aux::to_label(strval);
if (strval.compare("left") == 0) {