summaryrefslogtreecommitdiff
path: root/src/map/magic.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2012-12-13 16:25:50 -0800
committerBen Longbons <b.r.longbons@gmail.com>2012-12-14 16:18:22 -0800
commit069f39e8a1ebee3e4a4ce8302d0099842876782b (patch)
tree57d8de5f57d65878f8ef560e2884b9dee08e9323 /src/map/magic.cpp
parentf9563edf69f083287630f4b17db70d97524196d6 (diff)
downloadtmwa-069f39e8a1ebee3e4a4ce8302d0099842876782b.tar.gz
tmwa-069f39e8a1ebee3e4a4ce8302d0099842876782b.tar.bz2
tmwa-069f39e8a1ebee3e4a4ce8302d0099842876782b.tar.xz
tmwa-069f39e8a1ebee3e4a4ce8302d0099842876782b.zip
Some formatting fixes before I go insane
Also delete the French translation from ladmin.
Diffstat (limited to 'src/map/magic.cpp')
-rw-r--r--src/map/magic.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/map/magic.cpp b/src/map/magic.cpp
index 4311f09..48010e6 100644
--- a/src/map/magic.cpp
+++ b/src/map/magic.cpp
@@ -7,19 +7,19 @@
#undef DEBUG
-static char *magic_preprocess_message (character_t * character, char *start,
+static char *magic_preprocess_message(character_t * character, char *start,
char *end)
{
if (character->state.shroud_active
&& character->state.shroud_disappears_on_talk)
- magic_unshroud (character);
+ magic_unshroud(character);
if (character->state.shroud_active
&& character->state.shroud_hides_name_talking)
{
- int len = strlen (end);
- strcpy (start, "? ");
- memmove (start + 2, end, len + 1);
+ int len = strlen(end);
+ strcpy(start, "? ");
+ memmove(start + 2, end, len + 1);
return start + 4;
}
else
@@ -30,12 +30,12 @@ static char *magic_preprocess_message (character_t * character, char *start,
/* Returns a dynamically allocated copy of `src'.
* `*parameter' may point within that copy or be NULL. */
-static char *magic_tokenise (char *src, char **parameter)
+static char *magic_tokenise(char *src, char **parameter)
{
- char *retval = strdup (src);
+ char *retval = strdup(src);
char *seeker = retval;
- while (*seeker && !ISBLANK (*seeker))
+ while (*seeker && !ISBLANK(*seeker))
++seeker;
if (!*seeker)
@@ -45,7 +45,7 @@ static char *magic_tokenise (char *src, char **parameter)
*seeker = 0; /* Terminate invocation */
++seeker;
- while (ISBLANK (*seeker))
+ while (ISBLANK(*seeker))
++seeker;
*parameter = seeker;
@@ -54,15 +54,15 @@ static char *magic_tokenise (char *src, char **parameter)
return retval;
}
-int magic_message (character_t * caster, char *spell_, size_t spell_len)
+int magic_message(character_t * caster, char *spell_, size_t spell_len)
{
- if (pc_isdead (caster))
+ if (pc_isdead(caster))
return 0;
- int power = caster->matk1;
+ int power = caster->matk1;
char *invocation_base = spell_ + 8;
char *source_invocation =
- 1 + invocation_base + strlen (caster->status.name);
+ 1 + invocation_base + strlen(caster->status.name);
spell_t *spell;
char *parameter;
char *spell_invocation;
@@ -72,57 +72,57 @@ int magic_message (character_t * caster, char *spell_, size_t spell_len)
/* Pre-message filter in case some spell alters output */
source_invocation =
- magic_preprocess_message (caster, invocation_base, source_invocation);
+ magic_preprocess_message(caster, invocation_base, source_invocation);
- spell_invocation = magic_tokenise (source_invocation, &parameter);
- parameter = parameter ? strdup (parameter) : strdup ("");
+ spell_invocation = magic_tokenise(source_invocation, &parameter);
+ parameter = parameter ? strdup(parameter) : strdup("");
- spell = magic_find_spell (spell_invocation);
- free (spell_invocation);
+ spell = magic_find_spell(spell_invocation);
+ free(spell_invocation);
if (spell)
{
- int near_miss;
+ int near_miss;
env_t *env =
- spell_create_env (&magic_conf, spell, caster, power, parameter);
+ spell_create_env(&magic_conf, spell, caster, power, parameter);
effect_set_t *effects;
if ((spell->flags & SPELL_FLAG_NONMAGIC) || (power >= 1))
- effects = spell_trigger (spell, caster, env, &near_miss);
+ effects = spell_trigger(spell, caster, env, &near_miss);
else
effects = NULL;
#ifdef DEBUG
- fprintf (stderr, "Found spell `%s', triggered = %d\n", spell_,
+ fprintf(stderr, "Found spell `%s', triggered = %d\n", spell_,
effects != NULL);
#endif
if (caster->status.option & OPTION_HIDE)
return 0; // No spellcasting while hidden
- MAP_LOG_PC (caster, "CAST %s %s",
+ MAP_LOG_PC(caster, "CAST %s %s",
spell->name, effects ? "SUCCESS" : "FAILURE");
if (effects)
{
- invocation_t *invocation = spell_instantiate (effects, env);
+ invocation_t *invocation = spell_instantiate(effects, env);
- spell_bind (caster, invocation);
- spell_execute (invocation);
+ spell_bind(caster, invocation);
+ spell_execute(invocation);
return (spell->flags & SPELL_FLAG_SILENT) ? -1 : 1;
}
else
- magic_free_env (env);
+ magic_free_env(env);
return 1;
}
else
- free (parameter);
+ free(parameter);
return 0; /* Not a spell */
}
-void do_init_magic (void)
+void do_init_magic(void)
{
- magic_init (MAGIC_CONFIG_FILE);
+ magic_init(MAGIC_CONFIG_FILE);
}