A page in your DokuWiki was added or changed. Here are the details:
Date : 2005/12/02 00:11
User :
Edit Summary: minor changes
@@ -1,7 +1,7 @@
<code>
/* cfequip.cpp
- * $Id: cfequip.cpp,v 1.2 2005/11/30 22:00:32 tbrown Exp $
+ * $Id: cfequip.cpp,v 1.3 2005/12/01 23:11:02 tbrown Exp $
* Author: Terry Brown
* Created: Tue Nov 29 2005
*/
@@ -36,8 +36,11 @@
equip the equipment set <name>
scripttell 1 cfe list
list known equipment sets
+
+ scripttell 1 cfe quit
+ quit the script - not really necessary
Equipment needs unique names, e.g. "shoes +1" might be confused with
"red shoes +1" - just rename the items as needed.
@@ -137,9 +140,9 @@
ofstream out(fn.c_str(), ios::out);
if (!out)
{
cout << red << "ERROR - couldn't write to '"
- << fn << "'\n";
+ << fn << "'\n";
return;
}
for (eSets::const_iterator i = m_dat.begin();
@@ -206,8 +209,15 @@
}
void EquipmentSets::use(const string &s)
{
+
+ if (m_dat.find(s) == m_dat.end())
+ {
+ cout << red << "Can't find set '" << s << "'\n";
+ list();
+ return;
+ }
cout << blue << "use " << s << " (" << m_dat[s].size() << " items)\n";
cout << "request items inv\n";
string l;
@@ -287,8 +297,9 @@
cout << blue << "Supply equipment set file name with:\n";
cout << blue << " scripttell 1 cfe file <filename>\n";
cout << blue << "Other commands:\n";
cout << blue << " scripttell 1 cfe list - list known equipment sets\n";
+ cout << blue << " scripttell 1 cfe quit - end script\n";
cout << blue << " scripttell 1 cfe store <name> - store current equipment as <name>\n";
cout << blue << " scripttell 1 cfe use <name> - equip equipment set <name>\n";
EquipmentSets es;
@@ -303,8 +314,14 @@
{
if (r.size() == 5 && r[3] == "file")
{
es.setfile(r[4]);
+ }
+ else if (r.size() == 4 && r[3] == "quit")
+ {
+ cout << blue << "cfequip quitting\n";
+ cout.flush();
+ return 0;
}
else if (r.size() == 4 && r[3] == "list")
{
es.list();
@@ -322,11 +339,13 @@
cout << red << "invalid cfe command\n";
}
}
+ cout.flush();
}
return 0;
}
+
</code>
IP-Address : 216.161.132.197
Old Revision: http://wiki.metalforge.net/doku.php/cfequip.cpp?rev=1133390206
New Revision: http://wiki.metalforge.net/doku.php/cfequip.cpp
--
This mail was generated by DokuWiki at
http://wiki.metalforge.net/