本文整理汇总了C++中Mod类的典型用法代码示例。如果您正苦于以下问题:C++ Mod类的具体用法?C++ Mod怎么用?C++ Mod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateStats
void InventoryState::onAutoequip(Action *)
{
// don't act when moving items
if (_inv->getSelectedItem() != 0)
{
return;
}
BattleUnit *unit = _battleGame->getSelectedUnit();
Tile *groundTile = unit->getTile();
std::vector<BattleItem*> *groundInv = groundTile->getInventory();
Mod *mod = _game->getMod();
RuleInventory *groundRuleInv = mod->getInventory("STR_GROUND", true);
int worldShade = _battleGame->getGlobalShade();
std::vector<BattleUnit*> units;
units.push_back(unit);
BattlescapeGenerator::autoEquip(units, mod, NULL, groundInv, groundRuleInv, worldShade, true, true);
// refresh ui
_inv->arrangeGround(false);
updateStats();
_refreshMouse();
// give audio feedback
_game->getMod()->getSoundByDepth(_battleGame->getDepth(), Mod::ITEM_DROP)->play();
}
示例2: clear
void MCModInfoFrame::updateWithMod(Mod &m)
{
if(m.type() == m.MOD_FOLDER)
{
clear();
return;
}
QString text = "";
QString name = "";
if(m.name().isEmpty()) name = m.mmc_id();
else name = m.name();
if(m.homeurl().isEmpty()) text = name;
else text = "<a href=\"" + m.homeurl() + "\">" + name + "</a>";
if(!m.authors().isEmpty()) text += " by " + m.authors();
setModText(text);
if(m.description().isEmpty())
{
setModDescription(tr("No description provided in mcmod.info"));
}
else
{
setModDescription(m.description());
}
}
示例3: AxisAngletoHomochoric
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void OrientationMath::AxisAngletoHomochoric(float w, float n1, float n2, float n3, float& r1, float& r2, float& r3)
{
// Bring omega into proper range.
Mod<float> mod;
w = mod.WrapTwoPI(w);
float denom = 0.0f;
denom = (n1 * n1) + (n2 * n2) + (n3 * n3);
denom = sqrt(denom);
if(denom == 0.0)
{
r1 = 0.0, r2 = 0.0, r3 = 0.0;
return;
}
n1 = n1 / denom;
n2 = n2 / denom;
n3 = n3 / denom;
if (w >= 0.0f && w < DREAM3D::Constants::k_Pi)
{
float temp = powf(((0.75f) * (w - sinf(w))), DREAM3D::Constants::k_1Over3);
r1 = n1 * temp;
r2 = n2 * temp;
r3 = n3 * temp;
}
else
{
float temp = powf(((0.75f) * (DREAM3D::Constants::k_2Pi - w + sinf(w))), DREAM3D::Constants::k_1Over3);
r1 = n1 * temp;
r2 = n2 * temp;
r3 = n3 * temp;
}
}
示例4:
Mod::Mod(const Mod& mod)
{
modFile = mod.GetFileName();
modName = mod.GetName();
modVersion = mod.GetModVersion();
mcVersion = mod.GetMCVersion();
}
示例5: main
int main()
{
char szError[cbErrMax];
EC ec;
PDB* ppdb = PDB::Open("001.PDB", pdbWrite, 0, &ec, szError);
assert(ppdb);
DBI* pdbi = ppdb->OpenDBI(pdbWrite, "<target>");
assert(pdbi);
TS ts = pdbi->OpenTpi(pdbWrite);
assert(ts);
struct {
unsigned short len;
unsigned short leaf;
unsigned long signature;
unsigned long age;
unsigned char name[9];
} typeUseTypeServer = {
20,
LF_TYPESERVER,
123456789,
1,
"\x07""002.PDB"
};
struct {
unsigned short reclen;
unsigned short rectyp;
CV_uoff32_t off;
unsigned short seg;
CV_typ_t typind;
unsigned char name[5];
} aSymbol = {
16,
S_GDATA32,
0,
0,
0,
"\x03""ABC"
};
Mod* pmod = pdbi->OpenMod(ts, 1, "<mod>");
assert(pmod->AddTypes((PB)&typeUseTypeServer, 20));
for (TI ti = 0x1000; ti < 0x12e0; ti++) {
aSymbol.typind = ti;
assert(pmod->AddSymbols((PB)&aSymbol, 16));
}
pmod->Commit();
pmod->Close();
ts->Commit();
ts->Close();
ppdb->Commit();
pdbi->Close();
ppdb->Commit();
ppdb->Close();
return 0;
}
示例6: selectedWeapon
bool PedInstance::createActQFindEnemy(actionQueueGroupType &as) {
as.state = 1;
actionQueueType aq;
aq.as = PedInstance::pa_smNone;
aq.group_desc = PedInstance::gd_mThink;
aq.state = 1;
aq.ot_execute = PedInstance::ai_aFindEnemy;
as.actions.push_back(aq);
pedWeaponToUse pw_to_use;
Mod *pMod = slots_[Mod::MOD_BRAIN];
if (getMainType() == PedInstance::m_tpAgent) {
aq.multi_var.enemy_var.pw_to_use.use_ranks = pMod || (!isOurAgent())
? true: false;
WeaponInstance *wi = selectedWeapon();
if (wi && wi->usesAmmo() && wi->ammoRemaining() == 0) {
wi = NULL;
setSelectedWeapon(-1);
}
if (wi && wi->canShoot()) {
if (pMod) {
// This overrides selected weapon
// might be confusing for player
if (pMod->getVersion() == Mod::MOD_V3) {
pw_to_use.desc = 5;
pw_to_use.wpn.dmg_type = wi->dmgType();
} else if (pMod->getVersion() == Mod::MOD_V2) {
pw_to_use.desc = 4;
pw_to_use.wpn.dmg_type = wi->dmgType();
} else {
// Mod::MOD_V1
pw_to_use.desc = 3;
pw_to_use.wpn.wpn_type = wi->getWeaponType();
}
} else {
pw_to_use.desc = 2;
pw_to_use.wpn.wi = wi;
}
} else {
pw_to_use.desc = 5;
pw_to_use.wpn.dmg_type = MapObject::dmg_Physical;
}
} else {
pw_to_use.desc = 5;
pw_to_use.wpn.dmg_type = MapObject::dmg_Physical;
}
if (createActQFiring(as, NULL, NULL, false, 0, &pw_to_use))
as.actions.back().state |= 64;
else
return false;
createActQFollowing(as, NULL, 1);
as.actions.back().state |= 64;
return true;
}
示例7: DeleteMLMod
void Instance::DeleteMLMod(size_t index)
{
Mod *mod = &mlModList[index];
if (wxRemoveFile(mod->GetFileName().GetFullPath()))
{
mlModList.erase(mlModList.begin() + index);
}
else
{
wxLogError(_("Failed to delete mod."));
}
}
示例8:
Mod& Mod::operator*=(const Mod& m){ //repeated doubling is used for efficiency and prevention of overflow
long b = m.val();
Mod temp = 0;
while (b > 0){
if (b % 2 == 1){
temp += *this;
}
*this += *this;
b = b / 2;
}
x = temp.val();
return *this;
}
示例9:
bool Mod::operator==(const Mod& mod){
if( get_a() == mod.get_a() ){
return true;
}else{
return false;
}
}
示例10: replace
bool Mod::replace(Mod &with)
{
if (!destroy())
return false;
bool success = false;
auto t = with.type();
if (t == MOD_ZIPFILE || t == MOD_SINGLEFILE)
{
QLOG_DEBUG() << "Copy: " << with.m_file.filePath() << " to " << m_file.filePath();
success = QFile::copy(with.m_file.filePath(), m_file.filePath());
}
if (t == MOD_FOLDER)
{
success = copyPath(with.m_file.filePath(), m_file.path());
}
if (success)
{
m_name = with.m_name;
m_mmc_id = with.m_mmc_id;
m_mod_id = with.m_mod_id;
m_version = with.m_version;
m_mcversion = with.m_mcversion;
m_description = with.m_description;
m_authors = with.m_authors;
m_credits = with.m_credits;
m_homeurl = with.m_homeurl;
m_type = with.m_type;
m_file.refresh();
}
return success;
}
示例11: GEng
/**
* Load stuff from the currently loaded mods into some arrays.
**/
void Menu::loadModBits(UIUpdate* ui)
{
Mod* mod = GEng()->mm->getSupplOrBase();
this->gm->loadModBits(ui);
// Logo
delete(this->logo);
this->logo = this->render->loadSprite("menu/logo.png", mod);
if (!this->logo) {
this->logo = this->render->loadSprite("menu/logo.png", GEng()->mm->getBase());
}
// Background
delete(this->bg);
this->bg = this->render->loadSprite("menu/bg.jpg", mod);
if (!this->bg) {
this->bg = this->render->loadSprite("menu/bg.jpg", GEng()->mm->getBase());
}
// Rotating model
delete(this->play);
this->model = NULL;
this->play = NULL;
if (!mod->getMenuModelName().empty()) {
this->model_rot = -10.0f;
this->model = mod->getAssimpModel(mod->getMenuModelName());
if (this->model != NULL) {
this->play = new AnimPlay(this->model);
}
}
// Font always loaded from base mod
if (this->font == NULL) {
this->font = new OpenGLFont(this->render, "DejaVuSans", GEng()->mm->getBase(), 20.0f * GEng()->gui_scale);
}
this->loadMenuItems();
}
示例12: showWebsiteForMod
void showWebsiteForMod(QWidget *parentDlg, Mod &m)
{
QString url = m.homeurl();
if (url.size())
{
// catch the cases where the protocol is missing
if (!url.startsWith("http"))
{
url = "http://" + url;
}
QDesktopServices::openUrl(url);
}
else
{
CustomMessageBox::selectable(
parentDlg, parentDlg->tr("How sad!"),
parentDlg->tr("The mod author didn't provide a website link for this mod."),
QMessageBox::Warning);
}
}
示例13: strongCompare
bool Mod::strongCompare(const Mod &other) const
{
return mmc_id() == other.mmc_id() && version() == other.version() && type() == other.type();
}
示例14:
bool operator!=(const Mod& a, const Mod& b) {
return a.val() != b.val();
}
示例15: switch
bool PedInstance::createActQFiring(actionQueueGroupType &as, PathNode *tpn,
ShootableMapObject *tsmo, bool forced_shot, uint32 make_shots,
pedWeaponToUse *pw_to_use, int32 value)
{
as.state = 1;
actionQueueType aq;
aq.group_desc = PedInstance::gd_mFire;
bool can_shoot = false;
bool does_phys_dmg = false;
Weapon *pWeapon = NULL;
if (pw_to_use) {
switch (pw_to_use->desc) {
case 1:
pw_to_use->wpn.wi = weapon(pw_to_use->wpn.indx);
can_shoot = pw_to_use->wpn.wi->canShoot();
does_phys_dmg = pw_to_use->wpn.wi->doesPhysicalDmg();
pw_to_use->desc = 2;
break;
case 2:
// pointer
can_shoot = pw_to_use->wpn.wi->canShoot();
does_phys_dmg = pw_to_use->wpn.wi->doesPhysicalDmg();
break;
case 3:
// weapon type
pWeapon = g_App.weapons().getWeapon(pw_to_use->wpn.wpn_type);
can_shoot = pWeapon->canShoot();
does_phys_dmg = pWeapon->doesPhysicalDmg();
break;
case 4:
// strict damage type
if(!g_App.weapons().checkDmgTypeCanShootStrict(
pw_to_use->wpn.dmg_type, can_shoot)) {
return false;
}
does_phys_dmg = (pw_to_use->wpn.dmg_type
& MapObject::dmg_Physical) != 0;
break;
case 5:
// non-strict damage type
if(!g_App.weapons().checkDmgTypeCanShootNonStrict(
pw_to_use->wpn.dmg_type, can_shoot)) {
return false;
}
does_phys_dmg = (pw_to_use->wpn.dmg_type
& MapObject::dmg_Physical) != 0;
break;
}
aq.multi_var.enemy_var.pw_to_use = *pw_to_use;
} else {
WeaponInstance *wi = selectedWeapon();
if (wi) {
can_shoot = wi->canShoot();
does_phys_dmg = wi->doesPhysicalDmg();
Mod *pMod = slots_[Mod::MOD_BRAIN];
if (pMod) {
if (pMod->getVersion() == Mod::MOD_V3) {
aq.multi_var.enemy_var.pw_to_use.desc = 5;
aq.multi_var.enemy_var.pw_to_use.wpn.dmg_type = wi->dmgType();
} else if (pMod->getVersion() == Mod::MOD_V2) {
aq.multi_var.enemy_var.pw_to_use.desc = 4;
aq.multi_var.enemy_var.pw_to_use.wpn.dmg_type = wi->dmgType();
} else {
aq.multi_var.enemy_var.pw_to_use.desc = 3;
aq.multi_var.enemy_var.pw_to_use.wpn.wpn_type = wi->getWeaponType();
}
} else {
aq.multi_var.enemy_var.pw_to_use.desc = 2;
aq.multi_var.enemy_var.pw_to_use.wpn.wi = wi;
}
} else
return false;
}
if (!can_shoot)
return false;
aq.multi_var.enemy_var.pw_to_use.use_ranks = slots_[Mod::MOD_BRAIN] ? true: false;
aq.multi_var.enemy_var.value = value;
aq.multi_var.enemy_var.forced_shot = forced_shot;
if (does_phys_dmg) {
aq.as = PedInstance::pa_smFiring;
// TODO: use condition to set more information for action execution
// continuos shooting until ammo ends(or all weapons ammo),
// until target destroyed, type of damage that will complete action
aq.multi_var.enemy_var.make_shots = make_shots;
aq.multi_var.enemy_var.shots_done = 0;
if (tpn) {
aq.t_pn = *tpn;
aq.ot_execute = PedInstance::ai_aAttackLocation;
aq.t_smo = NULL;
} else {
aq.t_smo = tsmo;
aq.ot_execute = PedInstance::ai_aDestroyObject;
}
} else {
if (tsmo && tsmo->majorType() == MapObject::mjt_Ped) {
aq.as = PedInstance::pa_smNone;
aq.multi_var.enemy_var.make_shots = make_shots;
aq.multi_var.enemy_var.shots_done = 0;
//.........这里部分代码省略.........