public
Description: openc2e
Homepage: http://openc2e.org
Clone URL: git://github.com/ccdevnet/openc2e.git
openc2e / PointerAgent.cpp
100644 44 lines (39 sloc) 1.318 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* PointerAgent.cpp
* openc2e
*
* Created by Alyssa Milburn on Tue Aug 30 2005.
* Copyright (c) 2005 Alyssa Milburn. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
 
#include "PointerAgent.h"
#include "c16Image.h"
#include "openc2e.h"
#include "World.h"
#include "caosVM.h"
 
// TODO: change imagecount?
PointerAgent::PointerAgent(std::string spritefile) : SimpleAgent(2, 1, 1, UINT_MAX, spritefile, 0, 0) {
name = "hand";
handle_events = false;
}
 
// TODO: this should have a queueScript equiv too
void PointerAgent::firePointerScript(unsigned short event, Agent *src) {
shared_ptr<script> s = src->findScript(event);
if (!s) return;
if (!vm) vm = world.getVM(this);
if (vm->fireScript(s, false, src)) { // TODO: should FROM be src?
vm->setTarg(this);
zotstack();
}
}
 
/* vim: set noet: */