2010-03-18 22:26:40 +01:00
|
|
|
// ==============================================================
|
|
|
|
// This file is part of Glest (www.glest.org)
|
|
|
|
//
|
2010-05-01 12:46:56 +02:00
|
|
|
// Copyright (C) 2001-2008 Martio Figueroa
|
2010-03-18 22:26:40 +01:00
|
|
|
//
|
|
|
|
// You can redistribute this code and/or modify it under
|
|
|
|
// the terms of the GNU General Public License as published
|
|
|
|
// by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version
|
|
|
|
// ==============================================================
|
|
|
|
|
|
|
|
#include "command_type.h"
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
#include "upgrade_type.h"
|
|
|
|
#include "unit_type.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "leak_dumper.h"
|
|
|
|
#include "graphics_interface.h"
|
|
|
|
#include "tech_tree.h"
|
|
|
|
#include "faction_type.h"
|
|
|
|
#include "unit_updater.h"
|
|
|
|
#include "renderer.h"
|
|
|
|
#include "leak_dumper.h"
|
|
|
|
#include "socket.h"
|
|
|
|
|
|
|
|
using namespace Shared::Util;
|
|
|
|
|
|
|
|
namespace Glest{ namespace Game{
|
|
|
|
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class CommandType
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//get
|
|
|
|
CommandClass CommandType::getClass() const{
|
|
|
|
assert(this!=NULL);
|
|
|
|
return commandTypeClass;
|
|
|
|
}
|
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
void CommandType::load(int id, const XmlNode *n, const string &dir,
|
|
|
|
const TechTree *tt, const FactionType *ft, const UnitType &ut,
|
|
|
|
std::map<string,int> &loadedFileList) {
|
2010-05-01 12:46:56 +02:00
|
|
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
|
|
|
|
2010-03-18 22:26:40 +01:00
|
|
|
this->id= id;
|
|
|
|
name= n->getChild("name")->getAttribute("value")->getRestrictedValue();
|
|
|
|
|
|
|
|
//image
|
|
|
|
const XmlNode *imageNode= n->getChild("image");
|
|
|
|
image= Renderer::getInstance().newTexture2D(rsGame);
|
2011-03-13 09:23:43 +01:00
|
|
|
|
|
|
|
string currentPath = dir;
|
|
|
|
endPathWithSlash(currentPath);
|
|
|
|
image->load(currentPath + imageNode->getAttribute("path")->getRestrictedValue());
|
2011-03-15 16:30:28 +01:00
|
|
|
loadedFileList[currentPath + imageNode->getAttribute("path")->getRestrictedValue()]++;
|
2010-03-18 22:26:40 +01:00
|
|
|
|
|
|
|
//unit requirements
|
|
|
|
const XmlNode *unitRequirementsNode= n->getChild("unit-requirements");
|
2011-03-15 16:30:28 +01:00
|
|
|
for(int i = 0; i < unitRequirementsNode->getChildCount(); ++i) {
|
2010-03-18 22:26:40 +01:00
|
|
|
const XmlNode *unitNode= unitRequirementsNode->getChild("unit", i);
|
|
|
|
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
|
|
|
unitReqs.push_back(ft->getUnitType(name));
|
|
|
|
}
|
|
|
|
|
|
|
|
//upgrade requirements
|
|
|
|
const XmlNode *upgradeRequirementsNode= n->getChild("upgrade-requirements");
|
2011-03-15 16:30:28 +01:00
|
|
|
for(int i = 0; i < upgradeRequirementsNode->getChildCount(); ++i) {
|
2010-03-18 22:26:40 +01:00
|
|
|
const XmlNode *upgradeReqNode= upgradeRequirementsNode->getChild("upgrade", i);
|
|
|
|
string name= upgradeReqNode->getAttribute("name")->getRestrictedValue();
|
|
|
|
upgradeReqs.push_back(ft->getUpgradeType(name));
|
|
|
|
}
|
2010-05-01 12:46:56 +02:00
|
|
|
|
|
|
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class StopCommandType
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//varios
|
|
|
|
StopCommandType::StopCommandType(){
|
|
|
|
commandTypeClass= ccStop;
|
|
|
|
clicks= cOne;
|
|
|
|
}
|
|
|
|
|
2011-03-18 04:53:06 +01:00
|
|
|
void StopCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const {
|
|
|
|
unitUpdater->updateStop(unit, frameIndex);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
string StopCommandType::getDesc(const TotalUpgrade *totalUpgrade) const{
|
|
|
|
string str;
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
|
|
|
|
str= name+"\n";
|
|
|
|
str+= lang.get("ReactionSpeed")+": "+ intToStr(stopSkillType->getSpeed())+"\n";
|
|
|
|
if(stopSkillType->getEpCost()!=0)
|
|
|
|
str+= lang.get("EpCost")+": "+intToStr(stopSkillType->getEpCost())+"\n";
|
2011-02-06 19:33:49 +01:00
|
|
|
if(stopSkillType->getHpCost()!=0)
|
|
|
|
str+= lang.get("HpCost")+": "+intToStr(stopSkillType->getHpCost())+"\n";
|
2010-03-18 22:26:40 +01:00
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
string StopCommandType::toString() const{
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
return lang.get("Stop");
|
|
|
|
}
|
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
void StopCommandType::load(int id, const XmlNode *n, const string &dir,
|
|
|
|
const TechTree *tt, const FactionType *ft, const UnitType &ut,
|
|
|
|
std::map<string,int> &loadedFileList) {
|
|
|
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList);
|
2010-03-18 22:26:40 +01:00
|
|
|
|
|
|
|
//stop
|
|
|
|
string skillName= n->getChild("stop-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
stopSkillType= static_cast<const StopSkillType*>(ut.getSkillType(skillName, scStop));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class MoveCommandType
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//varios
|
|
|
|
MoveCommandType::MoveCommandType(){
|
|
|
|
commandTypeClass= ccMove;
|
|
|
|
clicks= cTwo;
|
|
|
|
}
|
|
|
|
|
2011-03-18 04:53:06 +01:00
|
|
|
void MoveCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const {
|
|
|
|
unitUpdater->updateMove(unit, frameIndex);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
void MoveCommandType::load(int id, const XmlNode *n, const string &dir,
|
|
|
|
const TechTree *tt, const FactionType *ft, const UnitType &ut,
|
|
|
|
std::map<string,int> &loadedFileList) {
|
|
|
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList);
|
2010-03-18 22:26:40 +01:00
|
|
|
|
|
|
|
//move
|
|
|
|
string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
moveSkillType= static_cast<const MoveSkillType*>(ut.getSkillType(skillName, scMove));
|
|
|
|
}
|
|
|
|
|
|
|
|
string MoveCommandType::getDesc(const TotalUpgrade *totalUpgrade) const{
|
|
|
|
string str;
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
|
|
|
|
str= name+"\n";
|
|
|
|
str+= lang.get("WalkSpeed")+": "+ intToStr(moveSkillType->getSpeed());
|
|
|
|
if(totalUpgrade->getMoveSpeed()!=0){
|
|
|
|
str+= "+" + intToStr(totalUpgrade->getMoveSpeed());
|
|
|
|
}
|
|
|
|
str+="\n";
|
|
|
|
if(moveSkillType->getEpCost()!=0){
|
|
|
|
str+= lang.get("EpCost")+": "+intToStr(moveSkillType->getEpCost())+"\n";
|
2011-02-06 19:33:49 +01:00
|
|
|
}
|
|
|
|
if(moveSkillType->getHpCost()!=0){
|
|
|
|
str+= lang.get("HpCost")+": "+intToStr(moveSkillType->getHpCost())+"\n";
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
string MoveCommandType::toString() const{
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
return lang.get("Move");
|
|
|
|
}
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class AttackCommandType
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//varios
|
|
|
|
AttackCommandType::AttackCommandType(){
|
|
|
|
commandTypeClass= ccAttack;
|
|
|
|
clicks= cTwo;
|
|
|
|
}
|
|
|
|
|
2011-03-18 04:53:06 +01:00
|
|
|
void AttackCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const {
|
|
|
|
unitUpdater->updateAttack(unit, frameIndex);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
void AttackCommandType::load(int id, const XmlNode *n, const string &dir,
|
|
|
|
const TechTree *tt, const FactionType *ft, const UnitType &ut,
|
|
|
|
std::map<string,int> &loadedFileList) {
|
|
|
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList);
|
2010-03-18 22:26:40 +01:00
|
|
|
|
|
|
|
//move
|
|
|
|
string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
moveSkillType= static_cast<const MoveSkillType*>(ut.getSkillType(skillName, scMove));
|
|
|
|
|
|
|
|
//attack
|
|
|
|
skillName= n->getChild("attack-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
attackSkillType= static_cast<const AttackSkillType*>(ut.getSkillType(skillName, scAttack));
|
|
|
|
}
|
|
|
|
|
|
|
|
string AttackCommandType::getDesc(const TotalUpgrade *totalUpgrade) const{
|
|
|
|
string str;
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
|
|
|
|
str= name+"\n";
|
|
|
|
if(attackSkillType->getEpCost()!=0){
|
|
|
|
str+= lang.get("EpCost") + ": " + intToStr(attackSkillType->getEpCost()) + "\n";
|
2011-02-06 19:33:49 +01:00
|
|
|
}
|
|
|
|
if(attackSkillType->getHpCost()!=0){
|
|
|
|
str+= lang.get("HpCost") + ": " + intToStr(attackSkillType->getHpCost()) + "\n";
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//attack strength
|
|
|
|
str+= lang.get("AttackStrenght")+": ";
|
|
|
|
str+= intToStr(attackSkillType->getAttackStrength()-attackSkillType->getAttackVar());
|
|
|
|
str+= "...";
|
|
|
|
str+= intToStr(attackSkillType->getAttackStrength()+attackSkillType->getAttackVar());
|
|
|
|
if(totalUpgrade->getAttackStrength()!=0){
|
|
|
|
str+= "+"+intToStr(totalUpgrade->getAttackStrength());
|
|
|
|
}
|
|
|
|
str+= " ("+ attackSkillType->getAttackType()->getName() +")";
|
|
|
|
str+= "\n";
|
|
|
|
|
|
|
|
//splash radius
|
|
|
|
if(attackSkillType->getSplashRadius()!=0){
|
|
|
|
str+= lang.get("SplashRadius")+": "+intToStr(attackSkillType->getSplashRadius())+"\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//attack distance
|
|
|
|
str+= lang.get("AttackDistance")+": "+intToStr(attackSkillType->getAttackRange());
|
|
|
|
if(totalUpgrade->getAttackRange()!=0){
|
|
|
|
str+= "+"+intToStr(totalUpgrade->getAttackRange()!=0);
|
|
|
|
}
|
|
|
|
str+="\n";
|
|
|
|
|
|
|
|
//attack fields
|
|
|
|
str+= lang.get("Fields") + ": ";
|
|
|
|
for(int i= 0; i < fieldCount; i++){
|
|
|
|
Field field = static_cast<Field>(i);
|
|
|
|
if( attackSkillType->getAttackField(field) )
|
|
|
|
{
|
|
|
|
str+= SkillType::fieldToStr(field) + " ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
str+="\n";
|
|
|
|
|
|
|
|
//movement speed
|
|
|
|
str+= lang.get("WalkSpeed")+": "+ intToStr(moveSkillType->getSpeed()) ;
|
|
|
|
if(totalUpgrade->getMoveSpeed()!=0){
|
|
|
|
str+= "+"+intToStr(totalUpgrade->getMoveSpeed());
|
|
|
|
}
|
|
|
|
str+="\n";
|
|
|
|
|
|
|
|
str+= lang.get("AttackSpeed")+": "+ intToStr(attackSkillType->getSpeed()) +"\n";
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
string AttackCommandType::toString() const{
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
return lang.get("Attack");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class AttackStoppedCommandType
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//varios
|
|
|
|
AttackStoppedCommandType::AttackStoppedCommandType(){
|
|
|
|
commandTypeClass= ccAttackStopped;
|
|
|
|
clicks= cOne;
|
|
|
|
}
|
|
|
|
|
2011-03-18 04:53:06 +01:00
|
|
|
void AttackStoppedCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const {
|
|
|
|
unitUpdater->updateAttackStopped(unit, frameIndex);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
void AttackStoppedCommandType::load(int id, const XmlNode *n, const string &dir,
|
|
|
|
const TechTree *tt, const FactionType *ft, const UnitType &ut,
|
|
|
|
std::map<string,int> &loadedFileList) {
|
|
|
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList);
|
2010-03-18 22:26:40 +01:00
|
|
|
|
|
|
|
//stop
|
|
|
|
string skillName= n->getChild("stop-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
stopSkillType= static_cast<const StopSkillType*>(ut.getSkillType(skillName, scStop));
|
|
|
|
|
|
|
|
//attack
|
|
|
|
skillName= n->getChild("attack-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
attackSkillType= static_cast<const AttackSkillType*>(ut.getSkillType(skillName, scAttack));
|
|
|
|
}
|
|
|
|
|
|
|
|
string AttackStoppedCommandType::getDesc(const TotalUpgrade *totalUpgrade) const{
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
string str;
|
|
|
|
|
|
|
|
str= name+"\n";
|
|
|
|
if(attackSkillType->getEpCost()!=0){
|
|
|
|
str+= lang.get("EpCost")+": "+intToStr(attackSkillType->getEpCost())+"\n";
|
2011-02-06 19:33:49 +01:00
|
|
|
}
|
|
|
|
if(attackSkillType->getHpCost()!=0){
|
|
|
|
str+= lang.get("HpCost")+": "+intToStr(attackSkillType->getHpCost())+"\n";
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//attack strength
|
|
|
|
str+= lang.get("AttackStrenght")+": ";
|
|
|
|
str+= intToStr(attackSkillType->getAttackStrength()-attackSkillType->getAttackVar());
|
|
|
|
str+="...";
|
|
|
|
str+= intToStr(attackSkillType->getAttackStrength()+attackSkillType->getAttackVar());
|
|
|
|
if(totalUpgrade->getAttackStrength()!=0)
|
|
|
|
str+= "+"+intToStr(totalUpgrade->getAttackStrength());
|
|
|
|
str+= " ("+ attackSkillType->getAttackType()->getName() +")";
|
|
|
|
str+="\n";
|
|
|
|
|
|
|
|
//splash radius
|
|
|
|
if(attackSkillType->getSplashRadius()!=0){
|
|
|
|
str+= lang.get("SplashRadius")+": "+intToStr(attackSkillType->getSplashRadius())+"\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//attack distance
|
2010-04-27 22:38:34 +02:00
|
|
|
str+= lang.get("AttackDistance")+": "+intToStr(attackSkillType->getAttackRange());
|
2010-03-18 22:26:40 +01:00
|
|
|
if(totalUpgrade->getAttackRange()!=0){
|
|
|
|
str+= "+"+intToStr(totalUpgrade->getAttackRange()!=0);
|
|
|
|
}
|
|
|
|
str+="\n";
|
|
|
|
|
|
|
|
//attack fields
|
|
|
|
str+= lang.get("Fields") + ": ";
|
|
|
|
for(int i= 0; i < fieldCount; i++){
|
|
|
|
Field field = static_cast<Field>(i);
|
|
|
|
if( attackSkillType->getAttackField(field) )
|
|
|
|
{
|
|
|
|
str+= SkillType::fieldToStr(field) + " ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
str+="\n";
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2011-01-08 22:53:05 +01:00
|
|
|
string AttackStoppedCommandType::toString() const {
|
2010-03-18 22:26:40 +01:00
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
return lang.get("AttackStopped");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class BuildCommandType
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//varios
|
2011-01-08 22:53:05 +01:00
|
|
|
BuildCommandType::BuildCommandType() {
|
2010-03-18 22:26:40 +01:00
|
|
|
commandTypeClass= ccBuild;
|
|
|
|
clicks= cTwo;
|
|
|
|
}
|
|
|
|
|
2011-01-08 22:53:05 +01:00
|
|
|
BuildCommandType::~BuildCommandType() {
|
2010-03-18 22:26:40 +01:00
|
|
|
deleteValues(builtSounds.getSounds().begin(), builtSounds.getSounds().end());
|
|
|
|
deleteValues(startSounds.getSounds().begin(), startSounds.getSounds().end());
|
|
|
|
}
|
|
|
|
|
2011-03-18 04:53:06 +01:00
|
|
|
void BuildCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const {
|
|
|
|
unitUpdater->updateBuild(unit, frameIndex);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
void BuildCommandType::load(int id, const XmlNode *n, const string &dir,
|
|
|
|
const TechTree *tt, const FactionType *ft, const UnitType &ut,
|
|
|
|
std::map<string,int> &loadedFileList) {
|
|
|
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
|
|
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList);
|
2010-03-18 22:26:40 +01:00
|
|
|
|
|
|
|
//move
|
|
|
|
string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
moveSkillType= static_cast<const MoveSkillType*>(ut.getSkillType(skillName, scMove));
|
|
|
|
|
|
|
|
//build
|
|
|
|
skillName= n->getChild("build-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
buildSkillType= static_cast<const BuildSkillType*>(ut.getSkillType(skillName, scBuild));
|
|
|
|
|
|
|
|
//buildings built
|
|
|
|
const XmlNode *buildingsNode= n->getChild("buildings");
|
|
|
|
for(int i=0; i<buildingsNode->getChildCount(); ++i){
|
|
|
|
const XmlNode *buildingNode= buildingsNode->getChild("building", i);
|
|
|
|
string name= buildingNode->getAttribute("name")->getRestrictedValue();
|
|
|
|
buildings.push_back(ft->getUnitType(name));
|
|
|
|
}
|
|
|
|
|
|
|
|
//start sound
|
|
|
|
const XmlNode *startSoundNode= n->getChild("start-sound");
|
|
|
|
if(startSoundNode->getAttribute("enabled")->getBoolValue()){
|
|
|
|
startSounds.resize(startSoundNode->getChildCount());
|
|
|
|
for(int i=0; i<startSoundNode->getChildCount(); ++i){
|
|
|
|
const XmlNode *soundFileNode= startSoundNode->getChild("sound-file", i);
|
|
|
|
string path= soundFileNode->getAttribute("path")->getRestrictedValue();
|
2011-03-15 16:30:28 +01:00
|
|
|
trimPathWithStartingSlash(path);
|
|
|
|
|
2010-03-18 22:26:40 +01:00
|
|
|
StaticSound *sound= new StaticSound();
|
2011-03-13 09:23:43 +01:00
|
|
|
|
|
|
|
string currentPath = dir;
|
|
|
|
endPathWithSlash(currentPath);
|
|
|
|
sound->load(currentPath + path);
|
2011-03-15 16:30:28 +01:00
|
|
|
loadedFileList[currentPath + path]++;
|
2010-03-18 22:26:40 +01:00
|
|
|
startSounds[i]= sound;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//built sound
|
|
|
|
const XmlNode *builtSoundNode= n->getChild("built-sound");
|
|
|
|
if(builtSoundNode->getAttribute("enabled")->getBoolValue()){
|
|
|
|
builtSounds.resize(builtSoundNode->getChildCount());
|
|
|
|
for(int i=0; i<builtSoundNode->getChildCount(); ++i){
|
|
|
|
const XmlNode *soundFileNode= builtSoundNode->getChild("sound-file", i);
|
|
|
|
string path= soundFileNode->getAttribute("path")->getRestrictedValue();
|
2011-03-15 16:30:28 +01:00
|
|
|
trimPathWithStartingSlash(path);
|
|
|
|
|
2010-03-18 22:26:40 +01:00
|
|
|
StaticSound *sound= new StaticSound();
|
2011-03-13 09:23:43 +01:00
|
|
|
|
|
|
|
string currentPath = dir;
|
|
|
|
endPathWithSlash(currentPath);
|
|
|
|
sound->load(currentPath + path);
|
2011-03-15 16:30:28 +01:00
|
|
|
loadedFileList[currentPath + path]++;
|
2010-03-18 22:26:40 +01:00
|
|
|
builtSounds[i]= sound;
|
|
|
|
}
|
|
|
|
}
|
2010-05-01 12:46:56 +02:00
|
|
|
|
|
|
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
string BuildCommandType::getDesc(const TotalUpgrade *totalUpgrade) const{
|
|
|
|
string str;
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
|
|
|
|
str= name+"\n";
|
|
|
|
str+= lang.get("BuildSpeed")+": "+ intToStr(buildSkillType->getSpeed())+"\n";
|
|
|
|
if(buildSkillType->getEpCost()!=0){
|
|
|
|
str+= lang.get("EpCost")+": "+intToStr(buildSkillType->getEpCost())+"\n";
|
2011-02-06 19:33:49 +01:00
|
|
|
}
|
|
|
|
if(buildSkillType->getHpCost()!=0){
|
|
|
|
str+= lang.get("HpCost")+": "+intToStr(buildSkillType->getHpCost())+"\n";
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
string BuildCommandType::toString() const{
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
return lang.get("Build");
|
|
|
|
}
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class HarvestCommandType
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//varios
|
|
|
|
HarvestCommandType::HarvestCommandType(){
|
|
|
|
commandTypeClass= ccHarvest;
|
|
|
|
clicks= cTwo;
|
|
|
|
}
|
|
|
|
|
2011-03-18 04:53:06 +01:00
|
|
|
void HarvestCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const {
|
|
|
|
unitUpdater->updateHarvest(unit, frameIndex);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
void HarvestCommandType::load(int id, const XmlNode *n, const string &dir,
|
|
|
|
const TechTree *tt, const FactionType *ft, const UnitType &ut,
|
|
|
|
std::map<string,int> &loadedFileList) {
|
|
|
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList);
|
2010-03-18 22:26:40 +01:00
|
|
|
|
|
|
|
//move
|
|
|
|
string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
moveSkillType= static_cast<const MoveSkillType*>(ut.getSkillType(skillName, scMove));
|
|
|
|
|
|
|
|
//harvest
|
|
|
|
skillName= n->getChild("harvest-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
harvestSkillType= static_cast<const HarvestSkillType*>(ut.getSkillType(skillName, scHarvest));
|
|
|
|
|
|
|
|
//stop loaded
|
|
|
|
skillName= n->getChild("stop-loaded-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
stopLoadedSkillType= static_cast<const StopSkillType*>(ut.getSkillType(skillName, scStop));
|
|
|
|
|
|
|
|
//move loaded
|
|
|
|
skillName= n->getChild("move-loaded-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
moveLoadedSkillType= static_cast<const MoveSkillType*>(ut.getSkillType(skillName, scMove));
|
|
|
|
|
|
|
|
//resources can harvest
|
|
|
|
const XmlNode *resourcesNode= n->getChild("harvested-resources");
|
|
|
|
for(int i=0; i<resourcesNode->getChildCount(); ++i){
|
|
|
|
const XmlNode *resourceNode= resourcesNode->getChild("resource", i);
|
|
|
|
harvestedResources.push_back(tt->getResourceType(resourceNode->getAttribute("name")->getRestrictedValue()));
|
|
|
|
}
|
|
|
|
|
|
|
|
maxLoad= n->getChild("max-load")->getAttribute("value")->getIntValue();
|
|
|
|
hitsPerUnit= n->getChild("hits-per-unit")->getAttribute("value")->getIntValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
string HarvestCommandType::getDesc(const TotalUpgrade *totalUpgrade) const{
|
|
|
|
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
string str;
|
|
|
|
|
|
|
|
str= name+"\n";
|
|
|
|
str+= lang.get("HarvestSpeed")+": "+ intToStr(harvestSkillType->getSpeed()/hitsPerUnit)+"\n";
|
|
|
|
str+= lang.get("MaxLoad")+": "+ intToStr(maxLoad)+"\n";
|
|
|
|
str+= lang.get("LoadedSpeed")+": "+ intToStr(moveLoadedSkillType->getSpeed())+"\n";
|
|
|
|
if(harvestSkillType->getEpCost()!=0){
|
|
|
|
str+= lang.get("EpCost")+": "+intToStr(harvestSkillType->getEpCost())+"\n";
|
|
|
|
}
|
2011-02-06 19:33:49 +01:00
|
|
|
if(harvestSkillType->getHpCost()!=0){
|
|
|
|
str+= lang.get("HpCost")+": "+intToStr(harvestSkillType->getHpCost())+"\n";
|
|
|
|
}
|
2010-03-18 22:26:40 +01:00
|
|
|
str+=lang.get("Resources")+":\n";
|
|
|
|
for(int i=0; i<getHarvestedResourceCount(); ++i){
|
|
|
|
str+= getHarvestedResource(i)->getName()+"\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
string HarvestCommandType::toString() const{
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
return lang.get("Harvest");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HarvestCommandType::canHarvest(const ResourceType *resourceType) const{
|
|
|
|
return find(harvestedResources.begin(), harvestedResources.end(), resourceType) != harvestedResources.end();
|
|
|
|
}
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class RepairCommandType
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//varios
|
|
|
|
RepairCommandType::RepairCommandType(){
|
|
|
|
commandTypeClass= ccRepair;
|
|
|
|
clicks= cTwo;
|
|
|
|
}
|
|
|
|
|
|
|
|
RepairCommandType::~RepairCommandType(){
|
|
|
|
}
|
|
|
|
|
2011-03-18 04:53:06 +01:00
|
|
|
void RepairCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const {
|
|
|
|
unitUpdater->updateRepair(unit, frameIndex);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
void RepairCommandType::load(int id, const XmlNode *n, const string &dir,
|
|
|
|
const TechTree *tt, const FactionType *ft, const UnitType &ut,
|
|
|
|
std::map<string,int> &loadedFileList) {
|
|
|
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList);
|
2010-03-18 22:26:40 +01:00
|
|
|
|
|
|
|
//move
|
|
|
|
string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
moveSkillType= static_cast<const MoveSkillType*>(ut.getSkillType(skillName, scMove));
|
|
|
|
|
|
|
|
//repair
|
|
|
|
skillName= n->getChild("repair-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
repairSkillType= static_cast<const RepairSkillType*>(ut.getSkillType(skillName, scRepair));
|
|
|
|
|
|
|
|
//repaired units
|
|
|
|
const XmlNode *unitsNode= n->getChild("repaired-units");
|
|
|
|
for(int i=0; i<unitsNode->getChildCount(); ++i){
|
|
|
|
const XmlNode *unitNode= unitsNode->getChild("unit", i);
|
|
|
|
repairableUnits.push_back(ft->getUnitType(unitNode->getAttribute("name")->getRestrictedValue()));
|
|
|
|
}
|
2010-05-01 12:46:56 +02:00
|
|
|
|
|
|
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
string RepairCommandType::getDesc(const TotalUpgrade *totalUpgrade) const{
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
string str;
|
|
|
|
|
|
|
|
str= name+"\n";
|
|
|
|
str+= lang.get("RepairSpeed")+": "+ intToStr(repairSkillType->getSpeed())+"\n";
|
|
|
|
if(repairSkillType->getEpCost()!=0){
|
|
|
|
str+= lang.get("EpCost")+": "+intToStr(repairSkillType->getEpCost())+"\n";
|
|
|
|
}
|
2011-02-06 19:33:49 +01:00
|
|
|
if(repairSkillType->getHpCost()!=0){
|
|
|
|
str+= lang.get("HpCost")+": "+intToStr(repairSkillType->getHpCost())+"\n";
|
|
|
|
}
|
2010-03-18 22:26:40 +01:00
|
|
|
str+="\n"+lang.get("CanRepair")+":\n";
|
|
|
|
for(int i=0; i<repairableUnits.size(); ++i){
|
|
|
|
str+= (static_cast<const UnitType*>(repairableUnits[i]))->getName()+"\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
string RepairCommandType::toString() const{
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
return lang.get("Repair");
|
|
|
|
}
|
|
|
|
|
|
|
|
//get
|
2010-10-30 10:54:00 +02:00
|
|
|
bool RepairCommandType::isRepairableUnitType(const UnitType *unitType) const {
|
2010-11-11 09:02:50 +01:00
|
|
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unitType [%s] repairableUnits.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,unitType->toString().c_str(),repairableUnits.size());
|
2010-10-30 10:54:00 +02:00
|
|
|
|
|
|
|
for(int i = 0; i < repairableUnits.size(); ++i) {
|
|
|
|
const UnitType *curUnitType = static_cast<const UnitType*>(repairableUnits[i]);
|
2010-11-11 09:02:50 +01:00
|
|
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] curUnitType [%s] i = %d\n",__FILE__,__FUNCTION__,__LINE__,curUnitType->toString().c_str(),i);
|
2010-10-30 10:54:00 +02:00
|
|
|
|
|
|
|
if(curUnitType == unitType) {
|
2010-03-18 22:26:40 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class ProduceCommandType
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//varios
|
|
|
|
ProduceCommandType::ProduceCommandType(){
|
|
|
|
commandTypeClass= ccProduce;
|
|
|
|
clicks= cOne;
|
|
|
|
}
|
|
|
|
|
2011-03-18 04:53:06 +01:00
|
|
|
void ProduceCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const {
|
|
|
|
unitUpdater->updateProduce(unit, frameIndex);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
void ProduceCommandType::load(int id, const XmlNode *n, const string &dir,
|
|
|
|
const TechTree *tt, const FactionType *ft, const UnitType &ut,
|
|
|
|
std::map<string,int> &loadedFileList) {
|
|
|
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList);
|
2010-03-18 22:26:40 +01:00
|
|
|
|
|
|
|
//produce
|
|
|
|
string skillName= n->getChild("produce-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
produceSkillType= static_cast<const ProduceSkillType*>(ut.getSkillType(skillName, scProduce));
|
|
|
|
|
|
|
|
string producedUnitName= n->getChild("produced-unit")->getAttribute("name")->getRestrictedValue();
|
|
|
|
producedUnit= ft->getUnitType(producedUnitName);
|
2010-05-01 12:46:56 +02:00
|
|
|
|
|
|
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
string ProduceCommandType::getDesc(const TotalUpgrade *totalUpgrade) const{
|
|
|
|
string str= name+"\n";
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
|
|
|
|
//prod speed
|
|
|
|
str+= lang.get("ProductionSpeed")+": "+ intToStr(produceSkillType->getSpeed());
|
|
|
|
if(totalUpgrade->getProdSpeed()!=0){
|
|
|
|
str+="+" + intToStr(totalUpgrade->getProdSpeed());
|
|
|
|
}
|
|
|
|
str+="\n";
|
|
|
|
|
|
|
|
//mpcost
|
|
|
|
if(produceSkillType->getEpCost()!=0){
|
|
|
|
str+= lang.get("EpCost")+": "+intToStr(produceSkillType->getEpCost())+"\n";
|
|
|
|
}
|
2011-02-06 19:33:49 +01:00
|
|
|
if(produceSkillType->getHpCost()!=0){
|
|
|
|
str+= lang.get("hpCost")+": "+intToStr(produceSkillType->getHpCost())+"\n";
|
|
|
|
}
|
2010-03-18 22:26:40 +01:00
|
|
|
str+= "\n" + getProducedUnit()->getReqDesc();
|
2011-01-08 22:53:05 +01:00
|
|
|
|
2010-03-18 22:26:40 +01:00
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
string ProduceCommandType::toString() const{
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
return lang.get("Produce");
|
|
|
|
}
|
|
|
|
|
|
|
|
string ProduceCommandType::getReqDesc() const{
|
|
|
|
return RequirableType::getReqDesc()+"\n"+getProducedUnit()->getReqDesc();
|
|
|
|
}
|
|
|
|
|
|
|
|
const ProducibleType *ProduceCommandType::getProduced() const{
|
|
|
|
return producedUnit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class UpgradeCommandType
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//varios
|
|
|
|
UpgradeCommandType::UpgradeCommandType(){
|
|
|
|
commandTypeClass= ccUpgrade;
|
|
|
|
clicks= cOne;
|
|
|
|
}
|
|
|
|
|
2011-03-18 04:53:06 +01:00
|
|
|
void UpgradeCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const {
|
|
|
|
unitUpdater->updateUpgrade(unit, frameIndex);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
void UpgradeCommandType::load(int id, const XmlNode *n, const string &dir,
|
|
|
|
const TechTree *tt, const FactionType *ft, const UnitType &ut,
|
|
|
|
std::map<string,int> &loadedFileList) {
|
2010-03-18 22:26:40 +01:00
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList);
|
2010-03-18 22:26:40 +01:00
|
|
|
|
|
|
|
//upgrade
|
|
|
|
string skillName= n->getChild("upgrade-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
upgradeSkillType= static_cast<const UpgradeSkillType*>(ut.getSkillType(skillName, scUpgrade));
|
|
|
|
|
|
|
|
string producedUpgradeName= n->getChild("produced-upgrade")->getAttribute("name")->getRestrictedValue();
|
|
|
|
producedUpgrade= ft->getUpgradeType(producedUpgradeName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
string UpgradeCommandType::getDesc(const TotalUpgrade *totalUpgrade) const{
|
|
|
|
string str;
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
|
|
|
|
str= name+"\n";
|
|
|
|
str+= lang.get("UpgradeSpeed")+": "+ intToStr(upgradeSkillType->getSpeed())+"\n";
|
|
|
|
if(upgradeSkillType->getEpCost()!=0)
|
|
|
|
str+= lang.get("EpCost")+": "+intToStr(upgradeSkillType->getEpCost())+"\n";
|
2011-02-06 19:33:49 +01:00
|
|
|
if(upgradeSkillType->getHpCost()!=0)
|
|
|
|
str+= lang.get("HpCost")+": "+intToStr(upgradeSkillType->getHpCost())+"\n";
|
2010-03-18 22:26:40 +01:00
|
|
|
str+= "\n"+getProducedUpgrade()->getReqDesc();
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
string UpgradeCommandType::toString() const{
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
return lang.get("Upgrade");
|
|
|
|
}
|
|
|
|
|
|
|
|
string UpgradeCommandType::getReqDesc() const{
|
|
|
|
return RequirableType::getReqDesc()+"\n"+getProducedUpgrade()->getReqDesc();
|
|
|
|
}
|
|
|
|
|
|
|
|
const ProducibleType *UpgradeCommandType::getProduced() const{
|
|
|
|
return producedUpgrade;
|
|
|
|
}
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class MorphCommandType
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//varios
|
|
|
|
MorphCommandType::MorphCommandType(){
|
|
|
|
commandTypeClass= ccMorph;
|
|
|
|
clicks= cOne;
|
|
|
|
}
|
|
|
|
|
2011-03-18 04:53:06 +01:00
|
|
|
void MorphCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const {
|
|
|
|
unitUpdater->updateMorph(unit, frameIndex);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
2011-03-15 16:30:28 +01:00
|
|
|
void MorphCommandType::load(int id, const XmlNode *n, const string &dir,
|
|
|
|
const TechTree *tt, const FactionType *ft, const UnitType &ut,
|
|
|
|
std::map<string,int> &loadedFileList) {
|
|
|
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList);
|
2010-03-18 22:26:40 +01:00
|
|
|
|
|
|
|
//morph skill
|
|
|
|
string skillName= n->getChild("morph-skill")->getAttribute("value")->getRestrictedValue();
|
|
|
|
morphSkillType= static_cast<const MorphSkillType*>(ut.getSkillType(skillName, scMorph));
|
|
|
|
|
|
|
|
//morph unit
|
|
|
|
string morphUnitName= n->getChild("morph-unit")->getAttribute("name")->getRestrictedValue();
|
|
|
|
morphUnit= ft->getUnitType(morphUnitName);
|
|
|
|
|
|
|
|
//discount
|
|
|
|
discount= n->getChild("discount")->getAttribute("value")->getIntValue();
|
2010-05-01 12:46:56 +02:00
|
|
|
|
|
|
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
string MorphCommandType::getDesc(const TotalUpgrade *totalUpgrade) const{
|
|
|
|
string str= name+"\n";
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
|
|
|
|
//prod speed
|
|
|
|
str+= lang.get("MorphSpeed")+": "+ intToStr(morphSkillType->getSpeed())+"\n";
|
|
|
|
|
|
|
|
//mpcost
|
|
|
|
if(morphSkillType->getEpCost()!=0){
|
|
|
|
str+= lang.get("EpCost")+": "+intToStr(morphSkillType->getEpCost())+"\n";
|
2011-02-06 19:33:49 +01:00
|
|
|
}
|
|
|
|
if(morphSkillType->getHpCost()!=0){
|
|
|
|
str+= lang.get("HpCost")+": "+intToStr(morphSkillType->getHpCost())+"\n";
|
2010-03-18 22:26:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//discount
|
|
|
|
if(discount!=0){
|
|
|
|
str+= lang.get("Discount")+": "+intToStr(discount)+"%\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
str+= "\n"+getProduced()->getReqDesc();
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
string MorphCommandType::toString() const{
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
return lang.get("Morph");
|
|
|
|
}
|
|
|
|
|
|
|
|
string MorphCommandType::getReqDesc() const{
|
|
|
|
return RequirableType::getReqDesc() + "\n" + getProduced()->getReqDesc();
|
|
|
|
}
|
|
|
|
|
|
|
|
const ProducibleType *MorphCommandType::getProduced() const{
|
|
|
|
return morphUnit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class CommandFactory
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
CommandTypeFactory::CommandTypeFactory(){
|
|
|
|
registerClass<StopCommandType>("stop");
|
|
|
|
registerClass<MoveCommandType>("move");
|
|
|
|
registerClass<AttackCommandType>("attack");
|
|
|
|
registerClass<AttackStoppedCommandType>("attack_stopped");
|
|
|
|
registerClass<BuildCommandType>("build");
|
|
|
|
registerClass<HarvestCommandType>("harvest");
|
|
|
|
registerClass<RepairCommandType>("repair");
|
|
|
|
registerClass<ProduceCommandType>("produce");
|
|
|
|
registerClass<UpgradeCommandType>("upgrade");
|
|
|
|
registerClass<MorphCommandType>("morph");
|
|
|
|
}
|
|
|
|
|
|
|
|
CommandTypeFactory &CommandTypeFactory::getInstance(){
|
|
|
|
static CommandTypeFactory ctf;
|
|
|
|
return ctf;
|
|
|
|
}
|
|
|
|
|
|
|
|
}}//end namespace
|