mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
* common/Add.h, common/Burn.h, common/Chop.h, common/Connect.h, common/Cut.h, common/Delve.h, common/Dig.h, common/Eat.h, common/Monitor.h, common/Mow.h, common/Nourish.h, common/Setup.h, common/Tick.h, common/Unseen.h, common/Update.h, * common/operations.cpp, scripts/gen_op.py: Try a new much simpler way of handling custom ops. * common/CustomOp.cpp, common/CustomOp.h, common/CustomOp_impl.h: Remove obsolete old template for custom ops. * common/custom.cpp: Install factories in a different way for all the custom op types.
40 lines
839 B
Python
Executable file
40 lines
839 B
Python
Executable file
#!/usr/bin/env python
|
|
|
|
import sys
|
|
|
|
if len(sys.argv) != 2:
|
|
print "usage: " + sys.argv[0] + " <opname>"
|
|
sys.exit(1)
|
|
|
|
opname = sys.argv[1].lower()
|
|
opnamecap = opname.capitalize()
|
|
opnameup = opname.upper()
|
|
|
|
outfile = open('common/' + opnamecap + '.h', 'w')
|
|
|
|
outfile.write("""// This file may be redistributed and modified only under the terms of
|
|
// the GNU General Public License (See COPYING for details).
|
|
// Copyright (C) 2005 Alistair Riddoch
|
|
|
|
#ifndef COMMON_%s_H
|
|
#define COMMON_%s_H
|
|
|
|
#include <Atlas/Objects/Generic.h>
|
|
|
|
namespace Atlas { namespace Objects { namespace Operation {
|
|
|
|
extern int %s_NO;
|
|
|
|
class %s : public Generic
|
|
{
|
|
public:
|
|
%s() {
|
|
(*this)->setType("%s", %s_NO);
|
|
}
|
|
};
|
|
|
|
} } }
|
|
|
|
#endif // COMMON_%s_H
|
|
""" % (opnameup, opnameup, opnameup, opnamecap, opnamecap, opname, opnameup, opnameup))
|
|
outfile.close()
|