コード例 #1
0
ファイル: faction.c プロジェクト: s0be/naev
/**
 * @brief Modifies the player's standing with a faction.
 *
 * Affects enemies and allies too.
 *
 *    @param f Faction to modify player's standing.
 *    @param mod Modifier to modify by.
 */
void faction_modPlayer( int f, double mod, const char *source )
{
   int i;
   Faction *faction;

   if (!faction_isFaction(f)) {
      WARN("%d is an invalid faction", f);
      return;
   }
   faction = &faction_stack[f];

   /* Modify faction standing with parent faction. */
   faction_modPlayerLua( f, mod, source, 0 );

   /* Now mod allies to a lesser degree */
   for (i=0; i<faction->nallies; i++) {
      /* Modify faction standing */
      faction_modPlayerLua( faction->allies[i], mod, source, 1 );
   }

   /* Now mod enemies */
   for (i=0; i<faction->nenemies; i++) {
      /* Modify faction standing. */
      faction_modPlayerLua( faction->enemies[i], -mod, source, 1 );
   }
}
コード例 #2
0
ファイル: faction.c プロジェクト: Jazzkovsky/naev
/**
 * @brief Modifies the player's standing without affecting others.
 *
 * Does not affect allies nor enemies.
 *
 *    @param f Faction whose standing to modify.
 *    @param mod Amount to modify standing by.
 *
 * @sa faction_modPlayer
 */
void faction_modPlayerSingle( int f, double mod, const char *source )
{
   if (!faction_isFaction(f)) {
      WARN("%d is an invalid faction", f);
      return;
   }

   faction_modPlayerLua( f, mod, source, 0 );
}