Beispiel #1
0
/**
 * \brief Calls the on_changed() method of a Lua game.
 *
 * Does nothing if the method is not defined.
 *
 * \param game A game.
 * \param map The new active map.
 */
void LuaContext::game_on_map_changed(Game& game, Map& map) {

  if (!userdata_has_field(game.get_savegame(), "on_map_changed")) {
    return;
  }

  push_game(l, game.get_savegame());
  on_map_changed(map);
  lua_pop(l, 1);
}
Beispiel #2
0
/**
 * \brief Calls the on_map_changed() method of a Lua equipment item.
 *
 * Does nothing if the method is not defined.
 *
 * \param item An equipment item.
 * \param map A map.
 */
void LuaContext::item_on_map_changed(EquipmentItem& item, Map& map) {

  if (!userdata_has_field(item, "on_map_changed")) {
    return;
  }

  push_item(l, item);
  on_map_changed(map);
  lua_pop(l, 1);
}
Beispiel #3
0
/**
 * @brief Calls the on_changed() method of a Lua game.
 * @param game A game.
 * @param map The new active map.
 */
void LuaContext::game_on_map_changed(Game& game, Map& map) {

  push_game(l, game.get_savegame());
  on_map_changed(map);
  lua_pop(l, 1);
}