m_speed_f += dir*12*BS;
// "Material" groups of the object
- std::map<std::string, int> groups;
+ ItemGroupList groups;
groups["snappy"] = 1;
groups["choppy"] = 1;
groups["fleshy"] = 3;
// "Material" groups of the object
- std::map<std::string, int> groups;
+ ItemGroupList groups;
groups["snappy"] = 1;
groups["choppy"] = 1;
groups["fleshy"] = 3;
#include <string>
#include <iostream>
#include <set>
-#include <map>
+#include "itemgroup.h"
class IGameDef;
struct ToolCapabilities;
-/*
- Some helpers
-*/
-
-static inline int itemgroup_get(const std::map<std::string, int> &groups,
- const std::string &name)
-{
- std::map<std::string, int>::const_iterator i = groups.find(name);
- if(i == groups.end())
- return 0;
- return i->second;
-}
-
/*
Base item definition
*/
bool liquids_pointable;
// May be NULL. If non-NULL, deleted by destructor
ToolCapabilities *tool_capabilities;
- std::map<std::string, int> groups;
+ ItemGroupList groups;
/*
Cached stuff
writeU8(os, 2); // version
os<<serializeString(name);
writeU16(os, groups.size());
- for(std::map<std::string, int>::const_iterator
+ for(ItemGroupList::const_iterator
i = groups.begin(); i != groups.end(); i++){
os<<serializeString(i->first);
writeS16(os, i->second);
#ifndef SERVER
#include "tile.h"
#endif
+#include "itemgroup.h"
class IItemDefManager;
class ITextureSource;
class IGameDef;
*/
std::string name; // "" = undefined node
- std::map<std::string, int> groups; // Same as in itemdef
+ ItemGroupList groups; // Same as in itemdef
// Visual definition
enum NodeDrawType drawtype;
}
// "Material" groups of the player
- std::map<std::string, int> groups;
+ ItemGroupList groups;
groups["choppy"] = 2;
groups["fleshy"] = 3;
}
}
-DigParams getDigParams(const std::map<std::string, int> &groups,
+DigParams getDigParams(const ItemGroupList &groups,
const ToolCapabilities *tp, float time_from_last_punch)
{
//infostream<<"getDigParams"<<std::endl;
return DigParams(result_diggable, result_time, wear_i);
}
-DigParams getDigParams(const std::map<std::string, int> &groups,
+DigParams getDigParams(const ItemGroupList &groups,
const ToolCapabilities *tp)
{
return getDigParams(groups, tp, 1000000);
}
-HitParams getHitParams(const std::map<std::string, int> &groups,
+HitParams getHitParams(const ItemGroupList &groups,
const ToolCapabilities *tp, float time_from_last_punch)
{
DigParams digprop = getDigParams(groups, tp,
return HitParams(hp, wear);
}
-HitParams getHitParams(const std::map<std::string, int> &groups,
+HitParams getHitParams(const ItemGroupList &groups,
const ToolCapabilities *tp)
{
return getHitParams(groups, tp, 1000000);
#include <string>
#include <iostream>
#include <map>
+#include "itemgroup.h"
struct ToolGroupCap
{
{}
};
-DigParams getDigParams(const std::map<std::string, int> &groups,
+DigParams getDigParams(const ItemGroupList &groups,
const ToolCapabilities *tp, float time_from_last_punch);
-DigParams getDigParams(const std::map<std::string, int> &groups,
+DigParams getDigParams(const ItemGroupList &groups,
const ToolCapabilities *tp);
struct HitParams
{}
};
-HitParams getHitParams(const std::map<std::string, int> &groups,
+HitParams getHitParams(const ItemGroupList &groups,
const ToolCapabilities *tp, float time_from_last_punch);
-HitParams getHitParams(const std::map<std::string, int> &groups,
+HitParams getHitParams(const ItemGroupList &groups,
const ToolCapabilities *tp);
#endif