Advanced Topic - Doing it differently.

Christopher Bunting cbunting99 at gmail.com
Fri Apr 8 03:02:30 New Zealand Standard Time 2005


In regards to that reply.. I've never been able to delegate a struct
as below with c whatsoever.. This is the main reason why I've been
able to do so many new things with the combat system with less code.
But if you can show this in C with this amount of code or less, please
do and I will definitly quit coding and start studying C again.

---- Delegate to Non-Static Nested Function ----

	struct Foo
	{   int a = 7;
	    int bar() { return a; }
	}

	int foo(int delegate() dg)
	{
	    return dg() + 1;
	}

	void test()
	{
	    int x = 27;
	    int abc() { return x; }
	    Foo f;
	    int i;

	    i = foo(&abc);	// i is set to 28
	    i = foo(&f.bar);	// i is set to 8
	}
----------------

It's functions like these that allow me to return various aspects of
the player attributes during combat so that CHA, STR, DEX, WIS, INT,
Proficencies, racial attributes and various other things can be used
simultaneously to help tighten up and make combat more strict based on
total attributes without having to write various other functions and
various of lines of code as needed in C to provide the same result..
To my knowledge, Not even C, C++ or Java can do that.

The whole basis for my posts were not to show how well everyone else
can do things in C. It was about why C wasn't able to do enough for
me. Maybe I'm really missing the point on why I needed to use LUA and
look for other means to get things to work the way that I wanted. But
I am always willing to try and learn new things and if you can show
how these types of things and how they can be written like this in C,
then maybe I should have just asked for examples along time ago and
just did all the coding in C.. But I was thinking that was one of the
main downfalls of C Based Muds.

Regards,
Chris
-- 
ROM mailing list
ROM at rom.org
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom


More information about the MUD-Dev mailing list