/*
       -= SEER - C-Scripting engine v 0.94a =-
State      : under implementation
Author     : Przemyslaw Podsiadly
             email: ppodsiad@elka.pw.edu.pl
             WWW:   http://home.elka.pw.edu.pl/~ppodsiad/seer
File:exlotr.sh
Desc:header for exlotr scripts: exlsam.sc and exlfrodo.sc
*/

#ifndef LOTR_RPG_SYSTEM_INCLUDED
/*
*/
//#include stdio
#include stdlib

/* small ones*/
import int rnd(int x=10);//random 0..x-1


struct Stats{
 int Vitality,Strength,Agility,Speed,Intelect,Wisdom,Faith;
};

struct Position{
 int x,y,z;
};

struct Place{
 char *name;
 int index;
 Position pos;
};

//All the data your system posses about a character (except to graphics/sound)
//If you want your hero to be unable to access some of them, just add private;
//or const for read-only members.
class Character{
public:
 string name;
 const Stats stats;
 Position pos;
//and much more...
};

#define evSuccess       0
#define evNotice        1       //notice a thing
#define evNoticeWhat(e)         ((char*)e.with)
#define evHear          2       //hear a sound
#define evHearWhat(e)           ((char*)e.with)
#define evAttacked      3       //be attacked
#define evAttackedBy(e)         ((Character*)e.with)
#define evUnable        4       //unable to complete action, like
                                //got lost, door are locked, etc.
                                //maybe there should be some info:why?
#define evMeet          5       //meet somebody
#define evMeetWhom(e)           ((Character*)e.with)
#define evTold          6       //somebody told you something
#define evToldBy(e)             ((Character*)((e).with))
#define evToldWhat(e)           (*((char**)((e).with)+1))

struct Event{
 int nr;
 int *with;
 void *matter;
 bool operator==(int _code) {return _code==nr;}
 bool operator!=(int _code) {return _code!=nr;}
};


import Place *getPlace(char* name);
import Character *getCharacter(char *name);

#define actWait         0
#define actOpen         1
#define actGoTo         2
#define actFollow       3
#define actMoveNormal   101
#define actMoveSneak    102
#define actWield        110
#define actPickUp       111
#define actPutDown      112
#define actBreak        113
#define actTell         200
import bool act(Event &ev,int action,...);

import int say(char *,...);

bool goTo(Event &ev,Place* x)
{return act(ev,actGoTo,x->pos);
}

bool goToPlace(Event &ev,char *x)
{return goTo(ev,getPlace(x));
}

bool goToCharacter(Event &ev,char *x)
{
 return act(ev,actGoTo,getCharacter(x)->pos);
}

void tellTo(char *name, char *text)
{Event ev;
 while (act(ev,actTell,getCharacter(name),text),ev!=evSuccess)
 {
 }
}

export live;
export me;

Character *me;

#define LOTR_RPG_SYSTEM_INCLUDED
#endif