const-correctness: fumbles are not allowed to change castorder

This commit is contained in:
Enno Rehling 2014-02-17 02:26:59 -08:00
parent 3db9fcf82f
commit b795602b5d
4 changed files with 10 additions and 10 deletions

View File

@ -2048,11 +2048,11 @@ static spellparameter *add_spellparameter(region * target_r, unit * u,
return par; return par;
} }
struct unit * co_get_caster(struct castorder * co) { struct unit * co_get_caster(const struct castorder * co) {
return co->_familiar ? co->_familiar : co->magician.u; return co->_familiar ? co->_familiar : co->magician.u;
} }
struct region * co_get_region(struct castorder * co) { struct region * co_get_region(const struct castorder * co) {
return co->_rtarget; return co->_rtarget;
} }

View File

@ -135,8 +135,8 @@ typedef struct sc_mage {
struct spellparameter *par; /* für weitere Parameter */ struct spellparameter *par; /* für weitere Parameter */
} castorder; } castorder;
struct unit * co_get_caster(struct castorder * co); struct unit * co_get_caster(const struct castorder * co);
struct region * co_get_region(struct castorder * co); struct region * co_get_region(const struct castorder * co);
typedef struct spell_component { typedef struct spell_component {
const struct resource_type *type; const struct resource_type *type;

View File

@ -24,7 +24,7 @@ extern "C" {
struct castorder; struct castorder;
typedef int (*spell_f)(struct castorder * co); typedef int (*spell_f)(struct castorder * co);
typedef void(*fumble_f)(struct castorder * co); typedef void(*fumble_f)(const struct castorder * co);
typedef struct spell { typedef struct spell {
unsigned int id; unsigned int id;

View File

@ -1167,7 +1167,7 @@ static int sp_mallornhain(castorder * co)
return cast_level; return cast_level;
} }
void patzer_ents(castorder * co) static void fumble_ents(const castorder * co)
{ {
int ents; int ents;
unit *u; unit *u;
@ -2301,7 +2301,7 @@ static int sp_earthquake(castorder * co)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* CHAOS / M_DRAIG / Draig */ /* CHAOS / M_DRAIG / Draig */
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
void patzer_peasantmob(castorder * co) void patzer_peasantmob(const castorder * co)
{ {
int anteil = 6, n; int anteil = 6, n;
unit *u; unit *u;
@ -2488,7 +2488,7 @@ static int sp_fumblecurse(castorder * co)
return cast_level; return cast_level;
} }
void patzer_fumblecurse(castorder * co) void patzer_fumblecurse(const castorder * co)
{ {
unit *mage = co->magician.u; unit *mage = co->magician.u;
int cast_level = co->level; int cast_level = co->level;
@ -6469,13 +6469,13 @@ static spelldata spell_functions[] = {
/* M_GWYRRD */ /* M_GWYRRD */
{ "stonegolem", sp_create_stonegolem, 0}, { "stonegolem", sp_create_stonegolem, 0},
{ "irongolem", sp_create_irongolem, 0}, { "irongolem", sp_create_irongolem, 0},
{ "treegrow", sp_hain, patzer_ents}, { "treegrow", sp_hain, fumble_ents},
{ "rustweapon", sp_rosthauch, 0}, { "rustweapon", sp_rosthauch, 0},
{ "cold_protection", sp_kaelteschutz, 0}, { "cold_protection", sp_kaelteschutz, 0},
{ "ironkeeper", sp_ironkeeper, 0}, { "ironkeeper", sp_ironkeeper, 0},
{ "magicstreet", sp_magicstreet, 0}, { "magicstreet", sp_magicstreet, 0},
{ "windshield", sp_windshield, 0}, { "windshield", sp_windshield, 0},
{ "mallorntreegrow", sp_mallornhain, patzer_ents}, { "mallorntreegrow", sp_mallornhain, fumble_ents},
{ "goodwinds", sp_goodwinds, 0}, { "goodwinds", sp_goodwinds, 0},
{ "healing", sp_healing, 0}, { "healing", sp_healing, 0},
{ "reelingarrows", sp_reeling_arrows, 0}, { "reelingarrows", sp_reeling_arrows, 0},