View Single Post
  #62  
Old 10-03-2008, 01:57 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

Cavedude put it to me that the 'Stepped' column in the Tasks table is redundant. The reason it is there is to allow a sequential task to be created (where one activity must be completed before the next is unlocked) without the need to fill in the step field in the activity table.

I am proposing a change to do away with the 'Stepped' column:

Code:
Index: zone/tasks.cpp
===================================================================
--- zone/tasks.cpp      (revision 34)
+++ zone/tasks.cpp      (working copy)
@@ -204,7 +204,7 @@
                        Tasks[TaskID]->RewardMethod = (TaskMethodType)atoi(row[8]);
                        Tasks[TaskID]->StartZone = atoi(row[9]);
                        Tasks[TaskID]->ActivityCount = 0;
-                       Tasks[TaskID]->SequenceMode = (SequenceType)atoi(row[10]);
+                       Tasks[TaskID]->SequenceMode = ActivitiesSequential;
                        Tasks[TaskID]->LastStep = 0;

                        _log(TASKS__GLOBALLOAD,"TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s",
@@ -246,6 +246,10 @@
                                continue;
                        }
                        Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].StepNumber = Step;
+
+                       if(Step != 0)
+                               Tasks[TaskID]->SequenceMode = ActivitiesStepped;
+
                        if(Step >Tasks[TaskID]->LastStep) Tasks[TaskID]->LastStep = Step;

                        // Task Activities MUST be numbered sequentially from 0. If not, log an error
Required SQL:

Code:
ALTER TABLE `tasks` DROP `stepped` ;
The way this will work is if the step column for each activity is zero, then the task will be sequential (one activity must be completed before the next is unlocked), i.e. it will behave as if the stepped column in the task table was set to 0.

If there is a non-zero step number for any activity belonging to this task, then it will behave as if the stepped column was set to 1 (i.e. multiple activities can be being worked on at once).

I've tested this, just didn't want to commit it without posting about it first.
Reply With Quote