示例#1
0
void OnFormationEditBt(HWND hdlgP)
{
	RECT rcBtn;
	LPARAM lParam;
	
	GetWindowRect(GetDlgItem(hdlgP, IDC_TV_FORMATION_EXPLORER), &rcBtn);
	lParam = posix_mku32((rcBtn.left > 0)? rcBtn.left: rcBtn.right, rcBtn.top);

	ns::action_formation = ma_edit;
/*
	if (DialogBoxParam(gdmgr._hinst, MAKEINTRESOURCE(IDD_FORMATIOMEDIT), hdlgP, DlgFactionEditProc, lParam)) {
		ns::core.update_to_ui_formation(hdlgP, ns::clicked_formation);
		ns::core.set_dirty(tcore::BIT_FORMATION, ns::core.formations_dirty());
	}
*/
	return;
}
示例#2
0
void OnFeatureEditBt(HWND hdlgP)
{
	RECT rcBtn;
	LPARAM lParam;
	
	GetWindowRect(GetDlgItem(hdlgP, IDC_LV_FEATURE_COMPLEX), &rcBtn);
	lParam = posix_mku32((rcBtn.left > 0)? rcBtn.left: rcBtn.right, rcBtn.top);

	ns::action_feature = ma_edit;

	if (DialogBoxParam(gdmgr._hinst, MAKEINTRESOURCE(IDD_FEATUREEDIT), hdlgP, DlgFeatureEditProc, lParam)) {
		ns::core.update_to_ui_feature(hdlgP);
		ns::core.set_dirty(tcore::BIT_FEATURE, ns::core.features_dirty());
	}

	return;
}
示例#3
0
// @deep: 嵌套深度, 顶层: 0
void wml_config_to_fp(posix_file_t fp, const config &cfg, uint32_t *max_str_len, std::vector<std::string> &td, uint16_t deep)
{
	uint32_t							u32n, bytertd;
	int									first;
		
	// config::child_list::const_iterator	ichildlist;
	// string_map::const_iterator			istrmap;

	// recursively resolve children
	BOOST_FOREACH (const config::any_child &value, cfg.all_children_range()) {
		// save {[cfg]}{len}{name}
		posix_fwrite(fp, WMLBIN_MARK_CONFIG, WMLBIN_MARK_CONFIG_LEN, bytertd);
		u32n = posix_mku32(value.key.size(), deep);
		posix_fwrite(fp, &u32n, sizeof(u32n), bytertd);
		posix_fwrite(fp, value.key.c_str(), posix_lo16(u32n), bytertd);

		*max_str_len = posix_max(*max_str_len, value.key.size());

		// save {[val]}{len}{name0}{len}{val0}{len}{name1}{len}{val1}{...}
		// string_map	&values = value.cfg.gvalues();
		// for (istrmap = values.begin(); istrmap != values.end(); istrmap ++) {
		first = 1;
		BOOST_FOREACH (const config::attribute &istrmap, value.cfg.attribute_range()) {
			if (first) {
				posix_fwrite(fp, WMLBIN_MARK_VALUE, WMLBIN_MARK_VALUE_LEN, bytertd);
				first = 0;
			}
			u32n = istrmap.first.size();
			posix_fwrite(fp, &u32n, sizeof(u32n), bytertd);
			posix_fwrite(fp, istrmap.first.c_str(), u32n, bytertd);
			*max_str_len = posix_max(*max_str_len, u32n);

			if (istrmap.second.t_str().translatable()) {
				// parse translatable string
				std::vector<t_string_base::trans_str> trans = istrmap.second.t_str().valuex();
				for (std::vector<t_string_base::trans_str>::const_iterator ti = trans.begin(); ti != trans.end(); ti ++) {
					if (ti == trans.begin()) {
						if (ti->td.empty()) {
							u32n = posix_mku32(0, posix_mku16(0, trans.size()));
						} else {
							u32n = posix_mku32(0, posix_mku16(tstring_textdomain_idx(ti->td.c_str(), td), trans.size()));
						}
					} else {
						if (ti->td.empty()) {
							u32n = posix_mku32(0, 0);
						} else {
							u32n = posix_mku32(0, posix_mku16(tstring_textdomain_idx(ti->td.c_str(), td), 0));
						}
					}
					// flag
					posix_fwrite(fp, &u32n, sizeof(u32n), bytertd);
					// length of value
					u32n = ti->str.size();
					posix_fwrite(fp, &u32n, sizeof(u32n), bytertd);
					posix_fwrite(fp, ti->str.c_str(), u32n, bytertd);
				}
			} else {
				// flag
				u32n = 0;
				posix_fwrite(fp, &u32n, sizeof(u32n), bytertd);
				// length of value
				u32n = istrmap.second.str().size();
				posix_fwrite(fp, &u32n, sizeof(u32n), bytertd);
				posix_fwrite(fp, istrmap.second.str().c_str(), u32n, bytertd);
			}
			*max_str_len = posix_max(*max_str_len, u32n);

		}		
		wml_config_to_fp(fp, value.cfg, max_str_len, td, deep + 1);
	}

	return;
}