convert to CRLF line endings

This commit is contained in:
GenevensiS
2026-01-05 01:01:18 +01:00
parent 168f6abe51
commit fbf2023848
68 changed files with 822 additions and 822 deletions
+109 -109
View File
@@ -764,7 +764,7 @@ SCRIPT_FUNCTION(get_card_export_settings) {
ScriptObject<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(input.get());
ScriptObject<Set*>* s = dynamic_cast<ScriptObject<Set*>*>(set.get());
if (s && c) {
Settings::ExportSettings card_settings = settings.exportSettingsFor(s->getValue()->stylesheetFor(c->getValue()));
Settings::ExportSettings card_settings = settings.exportSettingsFor(s->getValue()->stylesheetFor(c->getValue()));
ScriptCustomCollectionP ret(new ScriptCustomCollection());
ret->value.push_back(to_script(lround(card_settings.zoom * 100)));
ret->value.push_back(to_script(lround(rad_to_deg(card_settings.angle_radians))));
@@ -782,148 +782,148 @@ SCRIPT_FUNCTION(get_card_from_uid) {
SCRIPT_FUNCTION(get_cards_from_link) {
SCRIPT_PARAM_C(Set*, set);
SCRIPT_PARAM_C(ScriptValueP, input);
CardP input_card = nullptr;
if (ScriptObject<CardP>* ic = dynamic_cast<ScriptObject<CardP>*>(input.get())) {
input_card = ic->getValue();
}
else if (input->type() == SCRIPT_STRING) {
input_card = Card::getCardFromUid(*set, input->toString());
}
if (!input_card) {
queue_message(MESSAGE_ERROR, _ERROR_("could not find input"));
return script_nil;
SCRIPT_PARAM_C(ScriptValueP, input);
CardP input_card = nullptr;
if (ScriptObject<CardP>* ic = dynamic_cast<ScriptObject<CardP>*>(input.get())) {
input_card = ic->getValue();
}
else if (input->type() == SCRIPT_STRING) {
input_card = Card::getCardFromUid(*set, input->toString());
}
if (!input_card) {
queue_message(MESSAGE_ERROR, _ERROR_("could not find input"));
return script_nil;
}
SCRIPT_PARAM(String, linked_relation);
ScriptCustomCollectionP ret(new ScriptCustomCollection());
vector<CardP> other_cards = input_card->getLinkedCardsFromLink(*set, linked_relation, true);
if (other_cards.size() > 0) {
FOR_EACH(other_card, other_cards) {
ret->value.push_back(to_script(other_card));
}
ScriptCustomCollectionP ret(new ScriptCustomCollection());
vector<CardP> other_cards = input_card->getLinkedCardsFromLink(*set, linked_relation, true);
if (other_cards.size() > 0) {
FOR_EACH(other_card, other_cards) {
ret->value.push_back(to_script(other_card));
}
}
else if (set->game->card_links_alt_names.find(linked_relation) != set->game->card_links_alt_names.end()) {
other_cards = input_card->getLinkedCardsFromLink(*set, set->game->card_links_alt_names[linked_relation], true);
FOR_EACH(other_card, other_cards) {
ret->value.push_back(to_script(other_card));
}
}
else if (set->game->card_links_alt_names.find(linked_relation) != set->game->card_links_alt_names.end()) {
other_cards = input_card->getLinkedCardsFromLink(*set, set->game->card_links_alt_names[linked_relation], true);
FOR_EACH(other_card, other_cards) {
ret->value.push_back(to_script(other_card));
}
}
return ret;
}
}
SCRIPT_FUNCTION(get_front_face) {
SCRIPT_PARAM_C(Set*, set);
SCRIPT_PARAM_C(ScriptValueP, input);
CardP input_card = nullptr;
if (ScriptObject<CardP>* ic = dynamic_cast<ScriptObject<CardP>*>(input.get())) {
input_card = ic->getValue();
}
else if (input->type() == SCRIPT_STRING) {
input_card = Card::getCardFromUid(*set, input->toString());
}
if (!input_card) {
queue_message(MESSAGE_ERROR, _ERROR_("could not find input"));
return script_nil;
}
vector<CardP> other_cards = input_card->getLinkedCardsFromLink(*set, "Front Face", true);
if (other_cards.size() == 0) return script_nil;
SCRIPT_PARAM_C(ScriptValueP, input);
CardP input_card = nullptr;
if (ScriptObject<CardP>* ic = dynamic_cast<ScriptObject<CardP>*>(input.get())) {
input_card = ic->getValue();
}
else if (input->type() == SCRIPT_STRING) {
input_card = Card::getCardFromUid(*set, input->toString());
}
if (!input_card) {
queue_message(MESSAGE_ERROR, _ERROR_("could not find input"));
return script_nil;
}
vector<CardP> other_cards = input_card->getLinkedCardsFromLink(*set, "Front Face", true);
if (other_cards.size() == 0) return script_nil;
if (other_cards.size() > 1) queue_message(MESSAGE_WARNING, _ERROR_1_("multiple front faces", input_card->identification()));
SCRIPT_RETURN(other_cards[0]);
}
SCRIPT_FUNCTION(get_back_face) {
SCRIPT_PARAM_C(Set*, set);
SCRIPT_PARAM_C(ScriptValueP, input);
CardP input_card = nullptr;
if (ScriptObject<CardP>* ic = dynamic_cast<ScriptObject<CardP>*>(input.get())) {
input_card = ic->getValue();
}
else if (input->type() == SCRIPT_STRING) {
input_card = Card::getCardFromUid(*set, input->toString());
}
if (!input_card) {
queue_message(MESSAGE_ERROR, _ERROR_("could not find input"));
return script_nil;
}
vector<CardP> other_cards = input_card->getLinkedCardsFromLink(*set, "Back Face", true);
if (other_cards.size() == 0) return script_nil;
SCRIPT_PARAM_C(ScriptValueP, input);
CardP input_card = nullptr;
if (ScriptObject<CardP>* ic = dynamic_cast<ScriptObject<CardP>*>(input.get())) {
input_card = ic->getValue();
}
else if (input->type() == SCRIPT_STRING) {
input_card = Card::getCardFromUid(*set, input->toString());
}
if (!input_card) {
queue_message(MESSAGE_ERROR, _ERROR_("could not find input"));
return script_nil;
}
vector<CardP> other_cards = input_card->getLinkedCardsFromLink(*set, "Back Face", true);
if (other_cards.size() == 0) return script_nil;
if (other_cards.size() > 1) queue_message(MESSAGE_WARNING, _ERROR_1_("multiple back faces", input_card->identification()));
SCRIPT_RETURN(other_cards[0]);
}
SCRIPT_FUNCTION(add_link) {
SCRIPT_PARAM_C(Set*, set);
SCRIPT_PARAM_C(ScriptValueP, input);
CardP input_card = nullptr;
if (ScriptObject<CardP>* ic = dynamic_cast<ScriptObject<CardP>*>(input.get())) {
input_card = ic->getValue();
}
else if (input->type() == SCRIPT_STRING) {
input_card = Card::getCardFromUid(*set, input->toString());
}
if (!input_card) {
queue_message(MESSAGE_ERROR, _ERROR_("could not find input"));
return script_nil;
SCRIPT_PARAM_C(ScriptValueP, input);
CardP input_card = nullptr;
if (ScriptObject<CardP>* ic = dynamic_cast<ScriptObject<CardP>*>(input.get())) {
input_card = ic->getValue();
}
SCRIPT_PARAM(ScriptValueP, linked_card);
else if (input->type() == SCRIPT_STRING) {
input_card = Card::getCardFromUid(*set, input->toString());
}
if (!input_card) {
queue_message(MESSAGE_ERROR, _ERROR_("could not find input"));
return script_nil;
}
SCRIPT_PARAM(ScriptValueP, linked_card);
CardP other_card = nullptr;
if (ScriptObject<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(linked_card.get())) {
other_card = c->getValue();
}
else if (linked_card->type() == SCRIPT_STRING) {
other_card = Card::getCardFromUid(*set, linked_card->toString());
}
if (!other_card) {
queue_message(MESSAGE_WARNING, _ERROR_("could not find linked"));
return script_nil;
if (ScriptObject<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(linked_card.get())) {
other_card = c->getValue();
}
else if (linked_card->type() == SCRIPT_STRING) {
other_card = Card::getCardFromUid(*set, linked_card->toString());
}
if (!other_card) {
queue_message(MESSAGE_WARNING, _ERROR_("could not find linked"));
return script_nil;
}
SCRIPT_PARAM(String, selected_relation);
SCRIPT_PARAM(String, linked_relation);
input_card->link(*set, other_card, selected_relation, linked_relation);
SCRIPT_PARAM(String, linked_relation);
input_card->link(*set, other_card, selected_relation, linked_relation);
SCRIPT_RETURN(other_card);
}
SCRIPT_FUNCTION(remove_links) {
SCRIPT_PARAM_C(Set*, set);
ScriptCustomCollectionP ret(new ScriptCustomCollection());
SCRIPT_PARAM_C(ScriptValueP, input);
CardP input_card = nullptr;
if (ScriptObject<CardP>* ic = dynamic_cast<ScriptObject<CardP>*>(input.get())) {
input_card = ic->getValue();
}
else if (input->type() == SCRIPT_STRING) {
input_card = Card::getCardFromUid(*set, input->toString());
}
if (!input_card) {
queue_message(MESSAGE_ERROR, _ERROR_("could not find input"));
return ret;
}
SCRIPT_PARAM_C(ScriptValueP, input);
CardP input_card = nullptr;
if (ScriptObject<CardP>* ic = dynamic_cast<ScriptObject<CardP>*>(input.get())) {
input_card = ic->getValue();
}
else if (input->type() == SCRIPT_STRING) {
input_card = Card::getCardFromUid(*set, input->toString());
}
if (!input_card) {
queue_message(MESSAGE_ERROR, _ERROR_("could not find input"));
return ret;
}
vector<CardP> other_cards;
SCRIPT_PARAM_DEFAULT(ScriptValueP, linked_card, script_nil);
if (linked_card != script_nil) {
SCRIPT_PARAM_DEFAULT(ScriptValueP, linked_card, script_nil);
if (linked_card != script_nil) {
CardP other_card = nullptr;
if (ScriptObject<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(linked_card.get())) {
other_card = c->getValue();
}
else if (linked_card->type() == SCRIPT_STRING) {
other_card = Card::getCardFromUid(*set, linked_card->toString());
}
if (!other_card) {
queue_message(MESSAGE_WARNING, _ERROR_("could not find linked"));
}
else other_cards.push_back(other_card);
if (ScriptObject<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(linked_card.get())) {
other_card = c->getValue();
}
else if (linked_card->type() == SCRIPT_STRING) {
other_card = Card::getCardFromUid(*set, linked_card->toString());
}
if (!other_card) {
queue_message(MESSAGE_WARNING, _ERROR_("could not find linked"));
}
else other_cards.push_back(other_card);
}
SCRIPT_PARAM_DEFAULT(ScriptValueP, linked_relation, script_nil);
if (linked_relation != script_nil) {
if (linked_relation->type() == SCRIPT_STRING) {
vector<CardP> other_other_cards = input_card->getLinkedCardsFromLink(*set, linked_relation->toString(), true);
other_cards.insert(other_cards.end(), other_other_cards.begin(), other_other_cards.end());
if (linked_relation != script_nil) {
if (linked_relation->type() == SCRIPT_STRING) {
vector<CardP> other_other_cards = input_card->getLinkedCardsFromLink(*set, linked_relation->toString(), true);
other_cards.insert(other_cards.end(), other_other_cards.begin(), other_other_cards.end());
}
}
input_card->unlink(other_cards);
FOR_EACH(other_card, other_cards) {
ret->value.push_back(to_script(other_card));
}
}
input_card->unlink(other_cards);
FOR_EACH(other_card, other_cards) {
ret->value.push_back(to_script(other_card));
}
return ret;
}