Esempio n. 1
0
void TestAttal::testLord()
{

    useTheme();

    DataTheme.init();
    GenericLord lord( 1 );
    GenericLordModel * model = DataTheme.lords.at( 1 );
    lord.reinit();
    QCOMPARE( lord.getCharac( LEVEL ) , 0 );
    QCOMPARE( lord.getOwner() , (GenericPlayer *)0 );
    QCOMPARE( lord.getId() , 1 );
    QCOMPARE( lord.getBaseCharac( MOVE ) , model->getBaseCharac( MAXMOVE ) );
    lord.setBaseCharac( MOVE, lord.getCharac( MAXMOVE ) );
    lord.decreaseBaseCharac( MOVE, 2 );
    QCOMPARE( lord.getBaseCharac( MOVE ) , model->getBaseCharac( MAXMOVE ) -2  );
    lord.endTurn();
    QCOMPARE( lord.getBaseCharac( MOVE ) , model->getBaseCharac( MAXMOVE ) );
    QCOMPARE( ( uint ) lord.getRace() , model->getRace() );
    //int count = lord.countUnits();
    Creature * crea = new Creature();
    lord.addCreatures( crea, 10 );
    lord.clearUnits();
    QCOMPARE( lord.countUnits() , 0 );
    lord.setCost( 0, 100);
    QCOMPARE( ( int ) lord.getCost(0) ,100 );
    lord.setVisible( false );
    QCOMPARE( lord.isVisible() ,false );
    GenericCell * cell = new GenericCell();
    lord.setCell( cell );
    QCOMPARE( lord.getCell() ,cell );
    QCOMPARE( cell->getLord() ,(GenericLord *)&lord );
    lord.removeFromGame();
    QCOMPARE( lord.getCell() , (GenericCell * )0 );
    QCOMPARE( cell->getLord() ,(GenericLord *)0 );
    QCOMPARE( lord.hasMachineType( 0 ) , false );

    delete crea;
    delete cell;

}
Esempio n. 2
0
static char *
liner_desc_char(int n)
{
  char buf[LEN];
  extern int show_combat_flag;
  char *s;
  int sk;

  strcpy(buf, box_name(n));

  sk = subkind(n);

  if (sk == sub_ni) {
    int mk = noble_item(n);
    int num = has_item(n, mk) + 1;

    if (num == 1)
      strcat(buf, sout(", %s", plural_item_name(mk, num)));
    else
      strcat(buf, sout(", %s, number:~%s",
                       plural_item_name(mk, num), comma_num(num)));
  }
  else if (sk) {
    if (sk == sub_temple) {
      if (is_temple(n)) {
        strcat(buf, sout(", Temple of %s", god_name(is_temple(n))));
      }
      else {
        strcat(buf, sout(", undedicated temple"));
      };
    }
    else if (sk == sub_guild) {
      strcat(buf, sout(", %s Guild", box_name(is_guild(n))));
    }
    else {
      strcat(buf, sout(", %s", subkind_s[sk]));
    };
  }

  strcat(buf, nation_s(n));
  strcat(buf, deserted_s(n));
  strcat(buf, rank_s(n));
  strcat(buf, mage_s(n));
  strcat(buf, priest_s(n));
#if 0
  strcat(buf, wield_s(n));
#endif

  if (show_combat_flag) {
    if (char_behind(n))
      strcat(buf, sout(", behind~%d%s", char_behind(n), combat_ally));
    else
      strcat(buf, combat_ally);
  }
  else if (char_guard(n) && stack_leader(n) == n &&
           subkind(n) != sub_garrison)
    strcat(buf, ", on guard");

#if 0
  if (subkind(n) == 0) {        /* only show lord for regular players */
    int sp = lord(n);

    if (sp != indep_player && !cloak_lord(n))
      strcat(buf, sout(", of~%s", box_code_less(sp)));
  }
#endif

  if (show_display_string) {
    s = banner(n);

    if (s && *s)
      strcat(buf, sout(", \"%s\"", s));
  }

  strcat(buf, with_inventory_string(n));

  if (is_prisoner(n))
    strcat(buf, ", prisoner");

  return sout("%s", buf);
}