~ubuntu-branches/ubuntu/natty/lordsawar/natty

« back to all changes in this revision

Viewing changes to src/ai_dummy.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2010-04-10 09:29:33 UTC
  • mfrom: (1.1.9 upstream) (5.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100410092933-23uq4dxig30kmtcw
Tags: 0.1.8-1
* New upstream release.
* Add misc:Depends for -data package.
* Bump Standards Version to 3.8.4. (No changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "xmlhelper.h"
34
34
#include "history.h"
35
35
#include "GameScenarioOptions.h"
 
36
#include "Sage.h"
36
37
 
37
38
#define debug(x) {std::cerr<<__FILE__<<": "<<__LINE__<<": "<<x<<endl<<flush;}
38
39
//#define debug(x)
40
41
using namespace std;
41
42
 
42
43
AI_Dummy::AI_Dummy(std::string name, guint32 armyset, Gdk::Color color, int width, int height, int player_no)
43
 
    :RealPlayer(name, armyset, color, width, height, Player::AI_DUMMY, player_no), d_abort_requested(false)
 
44
    :RealPlayer(name, armyset, color, width, height, Player::AI_DUMMY, player_no)
44
45
{
45
46
}
46
47
 
48
49
    :RealPlayer(player)
49
50
{
50
51
    d_type = AI_DUMMY;
51
 
    d_abort_requested = false;
52
52
}
53
53
 
54
54
AI_Dummy::AI_Dummy(XML_Helper* helper)
55
 
    :RealPlayer(helper), d_abort_requested(false)
 
55
    :RealPlayer(helper)
56
56
{
57
57
}
58
58
 
62
62
 
63
63
void AI_Dummy::abortTurn()
64
64
{
65
 
  d_abort_requested = true;
 
65
  abort_requested = true;
66
66
  if (surrendered)
67
67
    aborted_turn.emit();
68
68
}
129
129
    }
130
130
  //this is a dummy AI (neutral player) so there is not much point in
131
131
  //doing anything
132
 
  if (d_abort_requested)
 
132
  if (abort_requested)
133
133
    aborted_turn.emit();
134
134
  return true;
135
135
}
141
141
  cityOccupy(c);
142
142
}
143
143
 
144
 
void AI_Dummy::levelArmy(Army* a)
 
144
void AI_Dummy::heroGainsLevel(Hero * a)
145
145
{
146
146
  Army::Stat stat = Army::STRENGTH;
147
 
  doLevelArmy(a, stat);
 
147
  doHeroGainsLevel(a, stat);
148
148
 
149
149
  Action_Level* item = new Action_Level();
150
150
  item->fillData(a, stat);
151
151
  addAction(item);
152
152
}
153
153
 
 
154
bool AI_Dummy::chooseHero(HeroProto *hero, City *city, int gold)
 
155
{
 
156
  //neutral players never accept heroes.
 
157
  return false;
 
158
}
 
159
        
 
160
Reward *AI_Dummy::chooseReward(Ruin *ruin, Sage *sage, Stack *stack)
 
161
{
 
162
  //neutrals don't search ruins, but let's not return null.
 
163
  return sage->front();
 
164
}
 
165
 
 
166
bool AI_Dummy::chooseTreachery (Stack *stack, Player *player, Vector <int> pos)
 
167
{
 
168
  //neutrals don't leave the castle.
 
169
  bool performTreachery = true;
 
170
  return performTreachery;
 
171
}
 
172
 
 
173
Army::Stat AI_Dummy::chooseStat(Hero *hero)
 
174
{
 
175
  //neutrals don't have heroes.
 
176
  return Army::STRENGTH;
 
177
}
 
178
 
 
179
bool AI_Dummy::chooseQuest(Hero *hero)
 
180
{
 
181
  //neutrals don't have heroes.
 
182
  return true;
 
183
}
154
184
// End of file