Testing Notepad

From FreeOrionWiki
Jump to: navigation, search

Unresolved Issues

Condition Problem...

This scope works:

scope = And [
    Contains Planet type = Asteroids
    All
]

This doesn't:

scope = And [
    All
    Contains Planet type = Asteroids
]

Descriptions

Techs with defined stringtable descriptions still get procedurally generated effects desciptions. This should only happen if the tech has no stringtable description defined. Or better, there should be two separate descriptions for a tech: one general, and one specifically for effects. If the general description is defined by the effects description not, then procedurally generate effects descriptions. If the effects description is defined, then use it, and not the autogenerated one.

Adding Categories Trouble

Checked May 18, 2006.

FO doesn't seem to like additional tech categories being added. After adding a tech in the "TEST_CATEGORY", upon clicking on the Research button at the top-right:

std::runtime_error exception caught in GUI::Run(): OptionsDB::Get<>(): Attempted to get nonexistent option "UI.tech-category-6".Initiating Exit (code 1 - error termination)

Missing Activation Description Crash

Checked May 13, 2006.

Activation conditions don't seem to be as optional as the grammar outline leads one to believe...

Add this tech:

Tech
  name = "TEST_TECH"
  description = "TEST_TECH_DESC"
  techtype = Application
  category = "LEARNING_CATEGORY"
  researchcost = 1
  researchturns = 1
  prerequisites = []
  unlock = []
  effectsgroups = [
    EffectsGroup
      scope = And [
        Planet
        Not All
      ]
      effects = Destroy
  ]
  graphic = "tech_icons/The_Physical_Brain.png"

Start the game, go to the research screen, click on the tech. (or possibly double click, I'm not sure which I did). Game crashes. In the debugger, the offending line is the one start with "retval.activation_description = ..."

Also, various other crashes due to adding effects groups to techs have turned out to go away whenever those effects groups have activation conditions added.

The top of the call stack was:

>	freeorion.exe!Effect::EffectsGroup::GetDescription()  Line 134 + 0x12 bytes	C++
 	freeorion.exe!Effect::EffectsGroup::DescriptionString()  Line 148	C++
 	freeorion.exe!EffectsDescription(const std::vector<boost::shared_ptr<Effect::EffectsGroup const >,std::allocator<boost::shared_ptr<Effect::EffectsGroup const > > > & effects_groups=[1]({px=0x0368fec0 pn={...} }))  Line 200 + 0x15 bytes	C++
 	freeorion.exe!TechTreeWnd::TechDetailPanel::Reset()  Line 573 + 0x30 bytes	C++
 	freeorion.exe!TechTreeWnd::TechClickedSlot(const Tech * tech=0x036728a0)  Line 1787	C++

AddOwner & Click Crash 1

Checked May 13, 2006.

Add this tech:

Tech
  name = "TEST_TECH"
  description = "TEST_TECH_DESC"
  techtype = Application
  category = "LEARNING_CATEGORY"
  researchcost = 1
  researchturns = 1
  prerequisites = []
  unlock = []
  effectsgroups = [
    EffectsGroup
      scope = All
      activation = Source
      effects = AddOwner empire=Source.Owner
  ]
  graphic = "tech_icons/The_Physical_Brain.png"

Start the game, and research the tech. Click on your homeworld. Game crashes.

Top of the call stack is:

>	msvcr80.dll!_crt_debugger_hook(int _Reserved=)  Line 65	C
 	msvcr80.dll!_invoke_watson(const wchar_t * pszExpression=0x00000000, const wchar_t * pszFunction=0x00000000, const wchar_t * pszFile=0x00000000, unsigned int nLine=0, unsigned int pReserved=0)  Line 181 + 0x7 bytes	C++
 	msvcr80.dll!_invalid_parameter_noinfo()  Line 99 + 0xc bytes	C++
 	freeorion.exe!FocusSelector::Render()  Line 237 + 0x1f bytes	C++
 	GiGi.dll!GG::GUI::RenderWindow(GG::Wnd * wnd=0x098dae68)  Line 536	C++
 	GiGi.dll!GG::GUI::RenderWindow(GG::Wnd * wnd=0x0aa038b8)  Line 541 + 0x10 bytes	C++
 	GiGi.dll!GG::GUI::RenderWindow(GG::Wnd * wnd=0x0118b638)  Line 541 + 0x10 bytes	C++
 	GiGi.dll!GG::GUI::RenderWindow(GG::Wnd * wnd=0x0363ae10)  Line 541 + 0x10 bytes	C++
 	GiGi.dll!GG::GUI::RenderWindow(GG::Wnd * wnd=0x0363dbb8)  Line 541 + 0x10 bytes	C++
 	GiGi.dll!GG::GUI::Render()  Line 909 + 0x10 bytes	C++

AddOwner & Click Crash 2

Checked May 13, 2006.

Add the same tech as in AddOwner & Click Crash 1, then instead of clicking on a system, click on a fleet. Clicking on my own fleet that I had the turn before the tech took effect seems to work fine. Then right clicking on a system to give a move order crashes the client. There is debug output:

std::invalid_argument exception caught in GUI::Run(): Fleet::SetRoute() : Attempted to set an empty route.Initiating Exit (code 1 - error termination)

Destroying Everything Causes Crash

Checked May 13, 2006

Add this tech and research it. End turn until after turn 5. During turn processing, something crahes, and the client returns to the main title splash screen with a game over popup.

Tech
  name = "TEST_TECH"
  description = "TEST_TECH_DESC"
  techtype = Application
  category = "LEARNING_CATEGORY"
  researchcost = 1
  researchturns = 1
  prerequisites = []
  unlock = []
  effectsgroups = [
    EffectsGroup
      scope = Turn low=5 high=10
      activation = Source
      effects = Destroy
  ]
  graphic = "tech_icons/The_Physical_Brain.png"

The top of the call stack was:

>	freeoriond.exe!UniverseObject::ID()  Line 89	C++
 	freeoriond.exe!Universe::DestroyImpl(int id=55)  Line 2372 + 0x7 bytes	C++
 	freeoriond.exe!Universe::ApplyEffects()  Line 1229 + 0x22 bytes	C++
 	freeoriond.exe!ServerApp::ProcessTurns()  Line 1831	C++

Predicted Meter Change Wrong

Update June 17, 2006

The predicted new max meter values in the GUI due to focus changes seem to not account for any building effects.

Checked May 13, 2006

Add this tech:

Tech
  name = "TEST_TECH"
  description = "TEST_TECH_DESC"
  techtype = Application
  category = "LEARNING_CATEGORY"
  researchcost = 1
  researchturns = 1
  prerequisites = []
  unlock = []
  effectsgroups = [
    EffectsGroup
      scope = PrimaryFocus focus = Research
      activation = Source
      effects = SetMaxResearch value = Target.MaxResearch + (Target.CurrentPopulation * 2)
  ]
  graphic = "tech_icons/The_Physical_Brain.png"

After researching, the predicted change in max research for planets that change their primary focus from or to research are wildly wrong.


Test Cases (Need to be Updated)

Stringtable entries:

TEST_CATEGORY
Test

TEST_1
ContainedBy & StarType (Yellow): Destroy

TEST_1_DESC
Test Case: When researched, should destroy everything in systems with yellow stars.

TEST_2
Turn 5-10: SetPlanetType Desert

TEST_2_DESC
Test Case: When researched and turn is between 5 and 10 inclusive, should change all planet environments to Desert.

TEST_3
NumberOf & Type (Fleet): Destroy

TEST_3_DESC
Test Case: When researched, every turn should destroy 1 fleet.

TEST_4
Contains & PlanetType (Terran): SetStarType (Black)

TEST_4_DESC
Test Case: When researched, should change the starcolour to black for all systems that contain terran planets

TEST_5
And ( Type (PopCentre), Affiliation (Self), Focus (Primary, Research ) ): SetPlanetSize (Tiny)

TEST_5_DESC
Test Case: When researched, should change size to tiny for planets (or other population centres) owned by researching empire which have their primary focus set to research.

TEST_6
AddOwner ( Source.Owner )

TEST_6_DESC
Test Case: When researched, should add ownership of every object in the game universe to the researcher.  After the player researches this tech, s/he should be able to investigate and manipulate all the planets, systems, fleets, etc. without crashing the client.  Giving orders should work logically, though the specifics of what way this is aren't yet determined.

Techs.xml entries:

<Category>TEST_CATEGORY</Category>

<Tech>
  <name>TEST_1</name>
  <description>TEST_1_DESC</description>
  <type>TT_THEORY</type>
  <category>TEST_CATEGORY</category>
  <research_cost>1</research_cost>
  <research_turns>1</research_turns>
  <prerequisites/>
  <unlocked_items/>
  <graphic>tech_icons/The_Physical_Brain.png</graphic>
  <effects>
    <EffectsGroup>
      <scope>
        <Condition::ContainedBy>
          <Condition::StarType>
            <StarType>STAR_YELLOW</StarType>
          </Condition::StarType>
        </Condition::ContainedBy>
      </scope>
      <effects>
        <Effect::Destroy/>
      </effects>
    </EffectsGroup>
  </effects>
</Tech>

<Tech>
  <name>TEST_2</name>
  <description>TEST_2_DESC</description>
  <type>TT_APPLICATION</type>
  <category>TEST_CATEGORY</category>
  <research_cost>1</research_cost>
  <research_turns>1</research_turns>
  <prerequisites/>
  <unlocked_items/>
  <graphic>tech_icons/Algorithmic_Elegance.png</graphic>
  <effects>
    <EffectsGroup>
      <scope>
        <Condition::Turn>
          <high>10</high>
          <low>5</low>
        </Condition::Turn>
      </scope>
      <effects>
        <Effect::SetPlanetType>PT_DESERT</Effect::SetPlanetType>
      </effects>
    </EffectsGroup>
  </effects>
</Tech>

<Tech>
  <name>TEST_3</name>
  <description>TEST_3_DESC</description>
  <type>TT_THEORY</type>
  <category>TEST_CATEGORY</category>
  <research_cost>1</research_cost>
  <research_turns>1</research_turns>
  <prerequisites/>
  <unlocked_items/>
  <graphic>tech_icons/Galactic_Exploration.png</graphic>
  <effects>
    <EffectsGroup>
      <scope>
        <Condition::NumberOf>
          <number>1</number>
          <condition>
            <Condition::Type>OBJ_FLEET</Condition::Type>
          </condition>
        </Condition::NumberOf>
      </scope>
      <effects>
        <Effect::Destroy/>
      </effects>
    </EffectsGroup>
  </effects>
</Tech>

<Tech>
  <name>TEST_4</name>
  <description>TEST_4_DESC</description>
  <type>TT_THEORY</type>
  <category>TEST_CATEGORY</category>
  <research_cost>1</research_cost>
  <research_turns>1</research_turns>
  <prerequisites/>
  <unlocked_items/>
  <graphic>tech_icons/The_Physical_Brain.png</graphic>
  <effects>
    <EffectsGroup>
      <scope>
        <Condition::Contains>
          <Condition::PlanetType>
            <PlanetType>PT_TERRAN</PlanetType>
          </Condition::PlanetType>
        </Condition::Contains>
      </scope>
      <effects>
        <Effect::SetStarType>STAR_BLACK</Effect::SetStarType>
      </effects>
    </EffectsGroup>
  </effects>
</Tech>

<Tech>
  <name>TEST_5</name>
  <description>TEST_5_DESC</description>
  <type>TT_APPLICATION</type>
  <category>TEST_CATEGORY</category>
  <research_cost>1</research_cost>
  <research_turns>1</research_turns>
  <prerequisites/>
  <unlocked_items/>
  <graphic>tech_icons/Algorithmic_Elegance.png</graphic>
  <effects>
    <EffectsGroup>
      <scope>
          <Condition::And>
            <Condition::EmpireAffiliation>
              <empire_id>Source.Owner</empire_id>
              <affiliation>AFFIL_SELF</affiliation>
              <exclusive>1</exclusive>
            </Condition::EmpireAffiliation>
            <Condition::Type>OBJ_POP_CENTER</Condition::Type>
            <Condition::FocusType>
              <primary>1</primary>
              <FocusType>FOCUS_RESEARCH</FocusType>
            </Condition::FocusType>
          </Condition::And>
      </scope>
      <effects>
        <Effect::SetPlanetSize>SZ_TINY</Effect::SetPlanetType>
      </effects>
    </EffectsGroup>
  </effects>
</Tech>

<Tech>
  <name>TEST_6</name>
  <description>TEST_6_DESC</description>
  <type>TT_THEORY</type>
  <category>TEST_CATEGORY</category>
  <research_cost>1</research_cost>
  <research_turns>1</research_turns>
  <prerequisites/>
  <unlocked_items/>
  <graphic>tech_icons/Galactic_Exploration.png</graphic>
  <effects>
    <EffectsGroup>
      <scope>
        <Condition::All/>
      </scope>
      <activation>
        <Condition::Self/>
      </activation>
      <effects>
        <Effect::AddOwner>Source.Owner</Effect::AddOwner>
      </effects>
    </EffectsGroup>
  </effects>
</Tech>