1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
/**
* @file
* @brief Code for the god menu.
* @todo The god menu.
*/
#include "AppHdr.h"
#include "god-menu.h"
#include "colour.h"
#include "libutil.h"
#include "religion.h"
#include "terrain.h"
#include "tilepick.h"
#include "tileview.h"
GodMenuEntry::GodMenuEntry(god_type god_, bool long_name) :
MenuEntry(god_name(god_, long_name), MEL_ITEM, 1, 0),
god(god_)
{
if (god == GOD_SHINING_ONE)
hotkeys.push_back('1');
else
{
hotkeys.push_back(text.at(0));
hotkeys.push_back(toalower(text.at(0)));
}
int c = god_message_altar_colour(god);
colour_text = colour_to_str(c);
data = &text;
const dungeon_feature_type feat = altar_for_god(god_);
if (feat)
{
const tileidx_t idx = tileidx_feature_base(feat);
add_tile(tile_def(pick_dngn_tile(idx, ui_random(INT_MAX))));
}
}
string GodMenuEntry::_get_text_preface() const
{
if (level == MEL_ITEM && hotkeys.size())
{
char buf[300];
// XX this probably breaks local tiles hotkey handling?
snprintf(buf, sizeof buf, " <%s>%c</%s> - ", colour_text.c_str(),
hotkeys[0], colour_text.c_str());
return string(buf);
}
return "";
}
|