mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 03:32:35 +01:00
removed old debug printfs in comments
fixed relative switch for unit particles fixed gravity for unit particles
This commit is contained in:
parent
e4b3c3117e
commit
c4d32651c6
@ -524,11 +524,9 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
||||
int bestIndex=-1;
|
||||
int besti=0;
|
||||
int currentCommandCount=0;
|
||||
// printf("command sizes: ");
|
||||
for(unsigned int i=randomstart; i<producers.size()+randomstart; i++)
|
||||
{
|
||||
currentProducerIndex=producers[i%(producers.size())];
|
||||
// printf("%d ,",aiInterface->getMyUnit(currentProducerIndex)->getCommandSize());
|
||||
currentCommandCount=aiInterface->getMyUnit(currentProducerIndex)->getCommandSize();
|
||||
if( currentCommandCount==1 &&
|
||||
aiInterface->getMyUnit(currentProducerIndex)->getCurrCommand()->getCommandType()->getClass()==ccStop)
|
||||
@ -542,15 +540,6 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
||||
besti=i%(producers.size());
|
||||
}
|
||||
}
|
||||
|
||||
// printf("\ncurrent team=%d producercount=%d bestindex=%d commandsize=%d besti=%d\n",
|
||||
// aiInterface->getMyUnit(currentProducerIndex)->getTeam(),
|
||||
// producers.size(),
|
||||
// bestIndex,
|
||||
// aiInterface->getMyUnit(currentProducerIndex)->getCommandSize(),
|
||||
// besti
|
||||
// );
|
||||
|
||||
if( aiInterface->getMyUnit(bestIndex)->getCommandSize()>2)
|
||||
{
|
||||
// maybe we need another producer of this kind if possible!
|
||||
@ -561,16 +550,13 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
||||
}
|
||||
// need to calculte another producer, maybe its better to produce another warrior with another producer
|
||||
vector<int> backupProducers;
|
||||
// printf("start ----- need to calculate a new producer! \n");
|
||||
// find another producer unit which is free and produce any kind of warrior.
|
||||
//for each unit
|
||||
for(int i=0; i<aiInterface->getMyUnitCount(); ++i){
|
||||
const UnitType *ut= aiInterface->getMyUnit(i)->getType();
|
||||
// printf("unit%d\n",i);
|
||||
//for each command
|
||||
for(int j=0; j<ut->getCommandTypeCount(); ++j){
|
||||
const CommandType *ct= ut->getCommandType(j);
|
||||
// printf("command%d\n",j);
|
||||
//if the command is produce
|
||||
if(ct->getClass()==ccProduce)
|
||||
{
|
||||
@ -584,19 +570,15 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
||||
}
|
||||
if(!backupProducers.empty())
|
||||
{
|
||||
// printf("Number of possible backupproducers %d",backupProducers.size());
|
||||
|
||||
vector<int> productionCommandIndexes;
|
||||
int randomstart=ai->getRandom()->randRange(0, backupProducers.size()-1);
|
||||
int lowestCommandCount=1000000;
|
||||
int currentProducerIndex=backupProducers[randomstart];
|
||||
int bestIndex=-1;
|
||||
int currentCommandCount=0;
|
||||
// printf("command sizes: ");
|
||||
for(unsigned int i=randomstart; i<backupProducers.size()+randomstart; i++)
|
||||
{
|
||||
currentProducerIndex=backupProducers[i%(backupProducers.size())];
|
||||
// printf("%d ,",aiInterface->getMyUnit(currentProducerIndex)->getCommandSize());
|
||||
currentCommandCount=aiInterface->getMyUnit(currentProducerIndex)->getCommandSize();
|
||||
if( currentCommandCount==1 &&
|
||||
aiInterface->getMyUnit(currentProducerIndex)->getCurrCommand()->getCommandType()->getClass()==ccStop)
|
||||
@ -627,8 +609,6 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
||||
}
|
||||
int commandIndex=productionCommandIndexes[ai->getRandom()->randRange(0, productionCommandIndexes.size()-1)];
|
||||
aiInterface->giveCommand(bestIndex, ut->getCommandType(commandIndex));
|
||||
// printf("\nbestindex=%d\n",bestIndex);
|
||||
// printf("end ----- need to calculate a new producer! \n");
|
||||
}
|
||||
else
|
||||
{// do it like normal CPU
|
||||
|
@ -22,7 +22,7 @@ using namespace Shared::Util;
|
||||
namespace Glest{ namespace Game{
|
||||
|
||||
const string mailString= "contact_game@glest.org";
|
||||
const string glestVersionString= "v3.2.4-1-beta2";
|
||||
const string glestVersionString= "v3.2.4-2-beta2";
|
||||
|
||||
string getCrashDumpFileName(){
|
||||
return "glest"+glestVersionString+".dmp";
|
||||
|
@ -148,6 +148,7 @@ void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
|
||||
ups->setMaxParticleEnergy(energyMax);
|
||||
ups->setVarParticleEnergy(energyVar);
|
||||
ups->setFixed(fixed);
|
||||
ups->setRelative(relative);
|
||||
ups->setTeamcolorNoEnergy(teamcolorNoEnergy);
|
||||
ups->setTeamcolorEnergy(teamcolorEnergy);
|
||||
ups->setRadius(radius);
|
||||
|
@ -355,15 +355,20 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
|
||||
p->speed= Vec3f(direction.x*speed+direction.x*speed*random.randRange(-0.5f, 0.5f),
|
||||
direction.y*speed+direction.y*speed*random.randRange(-0.5f, 0.5f),
|
||||
direction.z*speed+direction.z*speed*random.randRange(-0.5f, 0.5f));
|
||||
p->accel= Vec3f(0.0f, -gravity, 0.0f);
|
||||
|
||||
if(relative){
|
||||
if(!relative){
|
||||
p->pos= Vec3f(pos.x+x+offset.x, pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+offset.z);
|
||||
}
|
||||
else
|
||||
{// rotate it according to rotation
|
||||
float rad=degToRad(rotation);
|
||||
p->pos= Vec3f(pos.x+x+offset.x*cosf(rad)-offset.z*sinf(rad)*-1, pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+offset.z*cosf(rad)+offset.x*sinf(rad));
|
||||
p->speed=Vec3f(p->speed.x*cosf(rad)-p->speed.z*sinf(rad)*-1,p->speed.y,p->speed.z*cosf(rad)+p->speed.x*sinf(rad));
|
||||
// p->pos= Vec3f(pos.x+x+offset.x*cosf(rad)-offset.z*sinf(rad)*-1, pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+offset.z*cosf(rad)+offset.x*sinf(rad));
|
||||
// p->speed=Vec3f(p->speed.x*cosf(rad)-p->speed.z*sinf(rad)*-1,p->speed.y,p->speed.z*cosf(rad)+p->speed.x*sinf(rad));
|
||||
// p->pos= Vec3f(pos.x+x+(offset.x*cosf(rad)-offset.z*sinf(rad))*-1, pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+(offset.z*cosf(rad)+offset.x*sinf(rad)));
|
||||
// p->speed=Vec3f((p->speed.x*cosf(rad)-p->speed.z*sinf(rad))*-1,p->speed.y,(p->speed.z*cosf(rad)+p->speed.x*sinf(rad)));
|
||||
p->pos= Vec3f(pos.x+x+offset.z*sinf(rad)-offset.x*cosf(rad), pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+(offset.z*cosf(rad)+offset.x*sinf(rad)));
|
||||
p->speed=Vec3f(p->speed.z*sinf(rad)-p->speed.x*cosf(rad),p->speed.y,(p->speed.z*cosf(rad)+p->speed.x*sinf(rad)));
|
||||
}//p->pos=Vec3f(p->pos.x*cosf(rad)-p->pos.z*sinf(rad),p->pos.y,p->pos.z*cosf(rad)+p->pos.z*sinf(rad));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user