updates for dfool AI

This commit is contained in:
John W. C. McNabb 2006-01-06 20:03:59 +00:00
parent 56c29a19bf
commit f9ddc7b05a
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,4 @@
#include "global.hpp"
#include "ai_dfool.hpp"
namespace dfool {

View file

@ -30,6 +30,7 @@
#include <iostream>
#include "serialization/parser.hpp"
#include <ctime>
#include <algorithm>
#include <cstdlib>
#include <iostream>
@ -107,13 +108,20 @@ unit::unit(const unit_type* t, int side, bool use_traits, bool dummy_unit, unit_
//dummy units used by the 'move_unit_fake' command don't need to have a side.
if(dummy_unit == false) validate_side(side_);
clock_t ct = clock();
char buf[20];
snprintf(buf,sizeof(buf),"-%d",ct);
std::string time_tag(buf);
if(use_traits) {
//units that don't have traits generated are just generic
//units, so they shouldn't get a description either.
description_ = type_->generate_description();
generate_traits();
underlying_description_ = description_ + time_tag;
}else{
underlying_description_ = type_->id() + time_tag;
}
}
//constructor for advancing a unit from a lower level