Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // COMMAND.CPP CHANGES/ADDITIONS
- void consterr(const char *name)
- {
- defformatstring(o)("Alias %s is a constant and cannot be overwritten.", name);
- conoutf(o);
- }
- COMMAND(consterr, ARG_1STR);
- void alias(const char *name, const char *action)
- {
- ident *b = idents->access(name);
- if(!b)
- {
- if(identexists("constant_aliases")) {
- if(strstr(getalias("constant_aliases"), name)) {
- consterr(name);
- return;
- }
- }
- ident b(ID_ALIAS, newstring(name), newstring(action), persistidents, execcontext);
- idents->access(b.name, b);
- }
- else if(b->type==ID_ALIAS)
- {
- if(contextisolated[execcontext] && execcontext > b->context)
- {
- conoutf("cannot redefine alias %s in this execution context", b->name);
- scripterr();
- return;
- }
- if(identexists("constant_aliases")) {
- if(strstr(getalias("constant_aliases"), name)) {
- consterr(name);
- return;
- }
- }
- if(b->action!=b->executing) delete[] b->action;
- b->action = newstring(action);
- if(b->persist!=persistidents) b->persist = persistidents;
- }
- else
- {
- conoutf("cannot redefine builtin %s with an alias", name);
- scripterr();
- }
- }
- // SCRIPTS.CFG ADDITIONS
- if (! (checkalias constant_aliases)) [ constant_aliases = "" ]
- const = [
- if (! (strstr $constant_aliases $arg1)) [
- $arg1 = $arg2
- add2list constant_aliases $arg1
- ] [ consterr $arg1 ]
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement